Skip to content

Update tellduslive state in actuator methods#21705

Merged
cgarwood merged 1 commit into
home-assistant:devfrom
fredrike:tellduslive-sync_update
Mar 6, 2019
Merged

Update tellduslive state in actuator methods#21705
cgarwood merged 1 commit into
home-assistant:devfrom
fredrike:tellduslive-sync_update

Conversation

@fredrike
Copy link
Copy Markdown
Contributor

@fredrike fredrike commented Mar 6, 2019

Description:

#18780 removed self.schedule_update_ha_state() after a entity is toggled, that made HA think that the device still had the old value. I.e., when toggling a switch the switch changes state and then goes back to the old state (until the next scheduled update), this fixes that #20169 (comment).

Related issue (if applicable): fixes #

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.

@ghost ghost added the in progress label Mar 6, 2019
@homeassistant homeassistant added integration: tellduslive small-pr PRs with less than 30 lines. labels Mar 6, 2019
@MartinHjelmare MartinHjelmare changed the title Tell hass that changes have occured Update tellduslive state in actuator methods Mar 6, 2019
@fredrike fredrike marked this pull request as ready for review March 6, 2019 11:52
@cgarwood cgarwood merged commit 54895fc into home-assistant:dev Mar 6, 2019
@ghost ghost removed the in progress label Mar 6, 2019
@fredrike
Copy link
Copy Markdown
Contributor Author

fredrike commented Mar 6, 2019

@MartinHjelmare could this make 0.89?

@MartinHjelmare MartinHjelmare added this to the 0.89.0 milestone Mar 6, 2019
@MartinHjelmare
Copy link
Copy Markdown
Member

Ok, I've added it to 0.89 milestone.

balloob pushed a commit that referenced this pull request Mar 6, 2019
@balloob balloob mentioned this pull request Mar 6, 2019
@fredrike
Copy link
Copy Markdown
Contributor Author

fredrike commented Mar 8, 2019

@MartinHjelmare do you know why I need to send self.async_schedule_update_ha_state() after updating a switch?

I just came a cross the same issue with updated states with https://github.com/fredrike/home-assistant/blob/ab864c0d84427ce38f95b73bf97671e4c2b9ac90/homeassistant/components/climate/tfiac.py#L162 (after setting mode it takes until the next scheduled update for the new state to show up in HA). Is there something that I'm missing with the update?

@MartinHjelmare
Copy link
Copy Markdown
Member

MartinHjelmare commented Mar 8, 2019

Non polling entities need to handle state update themselves, preferably in a callback initiated by the device, but if that's not possible, directly in the actuator method. For polling entities the state update is handled automatically at the end of the service call.

@MartinHjelmare
Copy link
Copy Markdown
Member

Hit me up on discord for more discussion.

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Mar 8, 2019
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.

5 participants