988cbf12ce
* 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> |
||
---|---|---|
.. | ||
__init__.py | ||
const.py | ||
hue_api.py | ||
manifest.json | ||
services.yaml | ||
upnp.py |