Skip to content

Upgrade discord.py to v1.0.1#23523

Merged
fabaff merged 1 commit into
home-assistant:devfrom
cyrosy:dev
Apr 30, 2019
Merged

Upgrade discord.py to v1.0.1#23523
fabaff merged 1 commit into
home-assistant:devfrom
cyrosy:dev

Conversation

@cyrosy
Copy link
Copy Markdown
Contributor

@cyrosy cyrosy commented Apr 28, 2019

Description:

Upgrade discord.py to v1.0.1 to have Discord notify component working again

Related issue: fixes #21374

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly (example).
  • New dependencies have been added to requirements in the manifest (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@homeassistant
Copy link
Copy Markdown
Contributor

Hi @cyrosy,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copy link
Copy Markdown
Contributor

@OverloadUT OverloadUT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I haven't personally tested it; just reviewed the code.

Copy link
Copy Markdown
Member

@fabaff fabaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🐦

Service call:

{  
   "message":"The sun is {% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}!",
   "target":[  
      "3311xxxxxxxxx272"
   ],
   "data":{  
      "images":[  
         "/home/ha_test_dev/.homeassistant/logo.png"
      ]
   }
}

@fabaff fabaff merged commit 75a2c05 into home-assistant:dev Apr 30, 2019
@home-assistant home-assistant deleted a comment from homeassistant Apr 30, 2019
images = list()

for image in data.get(ATTR_IMAGES):
if os.path.isfile(image):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does I/O and we're in a coroutine. That combo is not allowed. Use hass.async_add_executor_job to schedule the I/O on the executor thread pool.

@cyrosy cyrosy mentioned this pull request May 1, 2019
7 tasks
@balloob balloob mentioned this pull request May 14, 2019
if ATTR_DATA in kwargs:
data = kwargs.get(ATTR_DATA)

if ATTR_IMAGES in data:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to have caused an unintended breaking change. If data is not in the service call it throws a NoneType error here. At minimum you must have data:{} now in order for the service call to be successful. Reported in issue #23948

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I saw that only after I updated do 0.93, and was waiting for the weekend to fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord notifications not working

7 participants