Skip to content
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

Use None as initial state in zha component #14389

Merged

Conversation

damarco
Copy link
Contributor

@damarco damarco commented May 11, 2018

Description:

According to @MartinHjelmare comment in #14361, return None if state is unknown.

Checklist:

  • The code change is tested and works locally.

@@ -102,8 +102,8 @@ def unit_of_measurement(self):
@property
def state(self):
"""Return the state of the entity."""
if self._state == 'unknown':
return 'unknown'
if self._state == STATE_UNKNOWN:
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't use STATE_UNKNOWN at all in the platforms or components. Probably change this in the zha component, that seems to set the initial state. Initial state should be None.

@damarco damarco changed the title Return None if state is unknown Use None as initial state May 12, 2018
Copy link
Member

@MartinHjelmare MartinHjelmare 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!

@MartinHjelmare MartinHjelmare changed the title Use None as initial state Use None as initial state in zha component and platforms May 12, 2018
@MartinHjelmare MartinHjelmare changed the title Use None as initial state in zha component and platforms Use None as initial state in zha component May 12, 2018
@MartinHjelmare MartinHjelmare merged commit 01ce43e into home-assistant:dev May 12, 2018
@damarco damarco deleted the zha-binary-sensor-unknown-state branch May 13, 2018 07:55
@balloob balloob mentioned this pull request May 28, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed integration: zha small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants