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

Do not call update() in constructor #8892

Merged
merged 1 commit into from
Aug 8, 2017
Merged

Do not call update() in constructor #8892

merged 1 commit into from
Aug 8, 2017

Conversation

fabaff
Copy link
Member

@fabaff fabaff commented Aug 8, 2017

Description:

  • Do not call update() in constructor.

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: command_line
    name: CPU Temperature
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: '{{ value | multiply(0.001) }}'

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@@ -53,10 +53,9 @@ def __init__(self, hass, data, name, unit_of_measurement, value_template):
self._hass = hass
self.data = data
self._name = name
self._state = STATE_UNKNOWN
self._state = None
Copy link
Member

Choose a reason for hiding this comment

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

Why not 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.

It's the base Entity class that should handle converting None to STATE_UNKNOWN.

@pvizeli pvizeli merged commit be94f6e into dev Aug 8, 2017
@pvizeli pvizeli deleted the update-constructor-cl branch August 8, 2017 20:37
@fabaff fabaff mentioned this pull request Aug 12, 2017
dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
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.

4 participants