Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix Skybell binary sensor state update #14927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

trisk
Copy link
Contributor

@trisk trisk commented Jun 11, 2018

Description:

The binary_sensor.skybell platform can fail to update its state when the event list returned by the Skybell API does not have entries for the monitored conditions. This is due to an bug that makes the event list None rather than an empty dictionary.

Both binary_sensor.skybell and sensor.skybell can also return None instead of STATE_UNKNOWN as their state, this is also fixed.

Related issue (if applicable): fixes #14871

Example entry for configuration.yaml (if applicable):

skybell:
  username: ...
  password: ...
binary_sensor:
  - platform: skybell
    monitored_conditions:
      - button
      - motion

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

@ghost ghost added in progress and removed small-pr PRs with less than 30 lines. labels Jun 11, 2018
@@ -80,3 +80,5 @@ def update(self):

if self._sensor_type == 'chime_level':
self._state = self._device.outdoor_chime_level
else
self._state = STATE_UNKNOWN

Choose a reason for hiding this comment

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

unexpected indentation

@@ -80,3 +80,5 @@ def update(self):

if self._sensor_type == 'chime_level':
self._state = self._device.outdoor_chime_level
else

Choose a reason for hiding this comment

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

SyntaxError: invalid syntax

@trisk trisk force-pushed the skybell_binary_sensor_state_update branch from 72746f0 to ed1277c Compare June 11, 2018 14:20
@amelchio
Copy link
Contributor

Using None for unknown state is actually preferred, see https://github.com/home-assistant/home-assistant/blob/0.71.0/homeassistant/helpers/entity.py#L217-L218

@trisk
Copy link
Contributor Author

trisk commented Jun 11, 2018

@amelchio Thanks, I didn't know that. I'll remove that commit.

@trisk trisk force-pushed the skybell_binary_sensor_state_update branch from ed1277c to cb0a3d3 Compare June 11, 2018 15:27
@dgomes dgomes added Ready for review small-pr PRs with less than 30 lines. labels Jun 15, 2018
@balloob balloob merged commit 940577e into home-assistant:dev Jun 15, 2018
@ghost ghost removed the in progress label Jun 15, 2018
@balloob balloob mentioned this pull request Jun 22, 2018
girlpunk pushed a commit to girlpunk/home-assistant that referenced this pull request Sep 4, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

binary_sensor.skybell fails to update state
6 participants