Optimistic MQTT light#14401
Merged
fabaff merged 10 commits intohome-assistant:devfrom May 15, 2018
Merged
Conversation
houndci-bot
reviewed
May 11, 2018
| 'white_value': 50}) | ||
| print(fake_state) | ||
| with patch('homeassistant.components.light.mqtt.async_get_last_state', | ||
| return_value=mock_coro(fake_state)): |
There was a problem hiding this comment.
continuation line under-indented for visual indent
houndci-bot
reviewed
May 11, 2018
| 'color_temp': 100, | ||
| 'white_value': 50}) | ||
| with patch('homeassistant.components.light.mqtt.async_get_last_state', | ||
| return_value=mock_coro(fake_state)): |
There was a problem hiding this comment.
continuation line under-indented for visual indent
houndci-bot
reviewed
May 12, 2018
| 'color_temp': 100, | ||
| 'white_value': 50}) | ||
|
|
||
| with patch('homeassistant.components.light.mqtt_json.async_get_last_state', |
There was a problem hiding this comment.
line too long (83 > 79 characters)
fabaff
reviewed
May 12, 2018
| brightness_received, self._qos) | ||
| self._brightness = 255 | ||
| elif self._optimistic_brightness and last_state\ | ||
| and last_state.attributes.get('brightness'): |
Member
There was a problem hiding this comment.
Please use ATTR_BRIGHTNESS from light/__init__.py. And on other places where a const which is defined in light/__init__.py make sense.
syssi
approved these changes
May 14, 2018
Merged
girlpunk
pushed a commit
to girlpunk/home-assistant
that referenced
this pull request
Sep 4, 2018
* Restores light state, case the light is optimistic * lint * hound * hound * Added mqtt_json * hound * added mqtt_template * lint * cleanup * use ATTR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This is a follow-up to #14151
When the light works in optimistic mode, HA is unaware of the current light state and always defaults to OFF on restart.
This pull request restores the state (and attributes) of the light to the last state, which is somehow what is expected from an optimistic light (that it has kept the state since the last restart and not defaulted to OFF)
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: