988cbf12ce3b856861af0bfa72cdb9912f95fc26
* Wait for the state of the entity to actually change before resolving PUT request Additionally, we cache the entity's properties for up to two seconds for the successive GET state request When Alexa issues a command to a Hue hub; it immediately queries the hub for the entity's state to confirm if the command was successful. It expects the state to be effective immediately after the PUT request has been completed. There may be a delay for the new state to actually be active, this is particularly obvious when using group lights. This leads Alexa to report that the light had an error. So we wait for the state of the entity to actually change before responding to the PUT request. Due to rounding issue when converting the HA range (0..255) to Hue range (1..254) we now cache the state sets by Alexa and return those cached values for up to two seconds so that Alexa gets the same value as it originally set. Fixes #38446 * Add new tests verifying emulated_hue behaviour. * Increase code test coverage. The remaining uncovered lines can't be tested as they mostly check that the hass framework or the http server properly work. This commit doesn't attempt to fix exposed issues as it would be out of scope ; it merely create the tests to exercise the whole code. * Update homeassistant/components/emulated_hue/hue_api.py * Add test for state change wait timeout * Preserve the cache long enough for groups to change * Update tests/components/emulated_hue/test_hue_api.py Co-authored-by: J. Nick Koston <nick@koston.org>
Cache emulated hue states attributes between get and put calls to avoid unexpected alexa errors (#38451)
Cache emulated hue states attributes between get and put calls to avoid unexpected alexa errors (#38451)
Home Assistant |Chat Status| ================================================================================= Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Check out `home-assistant.io <https://home-assistant.io>`__ for `a demo <https://home-assistant.io/demo/>`__, `installation instructions <https://home-assistant.io/getting-started/>`__, `tutorials <https://home-assistant.io/getting-started/automation-2/>`__ and `documentation <https://home-assistant.io/docs/>`__. |screenshot-states| Featured integrations --------------------- |screenshot-components| The system is built using a modular approach so support for other devices or actions can be implemented easily. See also the `section on architecture <https://developers.home-assistant.io/docs/en/architecture_index.html>`__ and the `section on creating your own components <https://developers.home-assistant.io/docs/en/creating_component_index.html>`__. If you run into issues while using Home Assistant or during development of a component, check the `Home Assistant help section <https://home-assistant.io/help/>`__ of our website for further help and information. .. |Chat Status| image:: https://img.shields.io/discord/330944238910963714.svg :target: https://discord.gg/c5DvZ4e .. |screenshot-states| image:: https://raw.github.com/home-assistant/home-assistant/master/docs/screenshots.png :target: https://home-assistant.io/demo/ .. |screenshot-components| image:: https://raw.github.com/home-assistant/home-assistant/dev/docs/screenshot-components.png :target: https://home-assistant.io/integrations/
Description
Languages
Python
100%