1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00
Commit Graph

121 Commits

Author SHA1 Message Date
Josh Soref
2f5f6cc05e
spelling: components/emulated_hue (#64250)
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-01-19 09:14:57 +01:00
Marc Mueller
7b78862a11
Revert "Use Platform enum [emulated_hue] (#63498)" (#63576)
This reverts commit 4fd555f508.
2022-01-07 11:38:48 +01:00
Marc Mueller
4fd555f508
Use Platform enum [emulated_hue] (#63498) 2022-01-05 20:27:01 +01:00
Marc Mueller
1b32385ab2
Use const imports [a-e] (#63467) 2022-01-05 16:44:13 +01:00
epenet
04e8e84058
Add init type hints [e] (#63102)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-31 11:05:44 +01:00
Simone Chemelli
5fc51130ea
Replace util.get_local_ip in favor of components.network.async_get_source_ip() - part 4 (#58669)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-11-15 09:18:57 -08:00
Marc Mueller
12d1dfdaf9
Use assignment expressions 10 (#57791) 2021-10-15 21:36:03 +02:00
Ville Skyttä
d8d34fdd3b
Prefer HTTPStatus over int in HA view JSON functions (#56504)
* Prefer HTTPStatus over int in HA view JSON functions

* Update zwave tests to not expect a fixed typo
2021-09-22 21:59:52 +03:00
Simone Chemelli
8b6d0ca13f
Replace util.get_local_ip in favor of components.network.async_get_source_ip() - part 2 (#53368)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-09-06 08:44:38 -10:00
J. Nick Koston
70961c79a0
Migrate emulate_hue to use storage to fix I/O in event loop (#50473) 2021-05-12 16:10:28 +02:00
J. Nick Koston
3fa8ffa731
Enable mccabe complexity checks in flake8 (#49616)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-25 12:38:40 +02:00
Thomas Hollstegge
66dbb17a4a
Fix opening cover via emulated_hue without specifying a position (#49570) 2021-04-22 19:12:52 -10:00
Erik Montnemery
a9065f381d
Use supported_color_modes in emulated_hue (#49175) 2021-04-22 16:42:28 -07:00
Franck Nijhof
055cdc64c0
Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
Franck Nijhof
0d595a2845
Merge of nested IF-IF cases - E-G (#48367) 2021-03-27 12:39:37 +01:00
Franck Nijhof
6932cf9534
Use contextlib.suppress where possible (#48189) 2021-03-23 14:36:43 +01:00
Franck Nijhof
8a56dbf587
Add flake8 comprehensions checks to pre-commit & CI (#48111) 2021-03-19 13:41:09 +01:00
tkdrob
8e06fa017d
Use core constants for emulated_hue (#46092) 2021-02-07 13:52:48 -05:00
denes44
14d914e300
Enable emulated_hue setting XY color and transition time by client (#45844)
* Enable setting XY color and transition time by client

* New test for setting XY color value

* Correct block outdent

* New test for setting transition time value

* Fixed commented out code
2021-02-03 15:35:27 -10:00
Jean-Yves Avenard
cf4b6307ae
Provide compatibility with older Home Assistant installations. (#39539)
Prior 0.113 all lights and switches were reported as dimmable devices and this was fixed by #37978.
However, under some circumstances Alexa will not smoothly transition from those broken devices to the new ones as it cache the list of entities.
It is imperative to have Alexa rediscover all devices and then remove the now non-responding duplicates using the Alexa phone App. This can take quite a while if you have lots of devices.
An alternative would be to log to the Alexa web site and remove all the lights instead and then re-discover them all.

If you have multiple echo devices on your network, it is possible that the entries would continue to show as duplicates. This is due to an individual echo devices caching the old list and re-using it.
The only known solution for this is to remove your echo devices from your Amazon account and re-add them.
After that, have Alexa rediscover all your devices.

This is a one-off requirement.

Fixes #39503
2020-09-01 09:16:40 -05:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
J. Nick Koston
3cc099af80
Make emulated_hue upnp responder async (#39126) 2020-08-23 09:50:59 +02:00
J. Nick Koston
4371068f6a
Fix emulated hue on/off devices compatibility with alexa (#39063) 2020-08-20 10:27:14 +02:00
kbickar
1505343b4b
Update emulated_hue to allow getting bridge config without username (#38986)
* Allow bridge config without username

* Updated emulated_hue tests

* Test cleanup
2020-08-18 14:02:38 -05:00
Franck Nijhof
cc4ebc925c
Improve X-Forwarded-* request headers handling (#38696)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
2020-08-11 22:57:50 +02:00
Jean-Yves Avenard
988cbf12ce
Cache emulated hue states attributes between get and put calls to avoid unexpected alexa errors (#38451)
* 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>
2020-08-03 15:30:16 -10:00
J. Nick Koston
03a0114e10
Avoid shutdown delays when emulated_hue is enabled (#38472)
We would have to wait for the select to timeout for
emulated_hue upnp thread to shutdown

We now close the socket so the select unblocks
right away
2020-08-02 08:32:07 -10:00
Jean-Yves Avenard
36ee9ff58f
Don't advertise switch devices as dimmable lights (#37978)
This issue has been corrected and then reverted multiple times.
It seems that the core issue was a casing one (On/off vs On/Off) ; for better
matching with a real Hue hub, also add the productname.

Tested to work with echo 2 and echo 5.
2020-07-19 22:33:56 -10:00
Franck Nijhof
53545c984b
Log lines do not end with a full stop (#37527) 2020-07-05 23:04:19 +02:00
Shulyaka
5ba38e5053
Add humidifier support to emulated_hue (#37110)
* Add humidifier support to emulated_hue

* add humidifier dependency

* move dependency to after_dependency

* move dependency to hassfest
2020-07-04 17:53:36 -05:00
J. Nick Koston
7746ecc9fb
Cache checking for entity exposure in emulated_hue (#37260)
Since we now base all of exposure checks on data that
will not change, we can cache the result instead
of calculating it every loop.

This change complements the work done in #32718
2020-06-30 13:22:17 -05:00
Igor Gocalinski
2ac4d30736
Add delay in emulated_hue after PUT (#35307) 2020-06-10 15:15:32 +02:00
Thomas Hollstegge
ed62fe03b0
Fix emulated_hue compatibility with older devices (#36090)
* Fix emulated_hue compatibility with older devices

* Fix test ugliness

* Fix pylint errors
2020-05-25 14:55:23 -05:00
Thomas Hollstegge
c5379a0f35
Improve emulated_hue compatibility with newer systems (#35148)
* Make emulated hue detectable by Busch-Jaeger free@home SysAP

* Emulated hue: Remove unnecessary host line from UPnP response

* Test that external IPs are blocked for config route

* Add another test for unauthorized users

* Change hue username to nouser

nouser seems to be used by the official Hue Bridge v1 Android app and is
used by other projects as well

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-04 00:18:33 -05:00
Thomas Hollstegge
e4e89becc6
Return emulated hue id for update requests (#35139)
* Return emulated hue id for update requests

* Emulated Hue: Rename function argument to match its content

* Use HTTP status consts throughout the test

* Use HTTP status consts in UPnP test
2020-05-03 19:27:19 -05:00
J. Nick Koston
23f278e090
Fix emulated_hue brightness off by one (#34185)
* Fix emulated_hue brightness off by one

Hue uses a max brightness of 254, Home Assistant
uses a max brightness of 255. Values > 127 were
off by one.

* use constant

* fix test

* add debug

* Revert "add debug"

This reverts commit 242220a02e.
2020-04-17 11:59:27 -05:00
springstan
46bbe816f6
Remove None from dict.get(key, None) (#33794) 2020-04-07 21:06:05 +02:00
springstan
0d95eff21d
Use dict literals (#33658) 2020-04-04 22:31:56 +02:00
Franck Nijhof
6f1900c6f4
Replace OSError aliases with OSError (#33655) 2020-04-04 22:09:11 +02:00
Paulus Schoutsen
f1d3c0d19b
Remove unused manifest fields (#33595) 2020-04-03 12:58:19 -07:00
J. Nick Koston
750ed2facd
Optimize is_entity_exposed in emulated_hue by removing deprec… (#32718)
* emulated_hue: Optimize is_entity_exposed

Switch all list transversals in is_entity_exposed to
hash lookups

get_deprecated is now only called if explict_expose is
set

This funciton was iterating multiple lists per enitity
every time there was an update.  It was responsible for
a chunk of execution time when there are large number
of entities in home assistant.

* Complete deprecation of ATTR_EMULATED_HUE attribute

* Complete deprecation of ATTR_EMULATED_HUE attribute (remove const)

* Remove ATTR_EMULATED_HUE_HIDDEN and Rewrite tests
2020-03-13 21:47:47 -07:00
Slava
9db3900cff
Add brightness state to emulated hue when devices support only color temp and brightness (#31834) 2020-03-13 23:42:47 +01:00
Paulus Schoutsen
db7d0eb9b9
Remove hassfest blacklisted rest (#32441)
* Remove blacklisted deps from hassfest deps

* Whitelist all internal integrations
2020-03-03 13:57:09 -08:00
springstan
9801810552
Use f-strings in integrations starting with "B"-"E" (#32121)
* Use f-strings in integrations starting with B

* Use f-strings in integrations starting with C

* Use f-strings in integrations starting with D

* Use f-strings in integrations starting with E

* Fix pylint errors

* Fix pylint errors v2

* Fix tests

* Fix tests v2
2020-02-24 08:47:52 -08:00
Martin
af105d2d61
Emulated Hue + Alexa: Fix devices not discovered and error response (#30013 & #29899) (#31413)
* Revert "Emulated Hue: changed the reported fallback device-type to fix Alexa compatibility issues (#30013)"

This reverts commit ddc8d9e25c.

* Revert "Emulated Hue: updated tests (#30013)"

This reverts commit 90df461e75.

* Emulated Hue + Alexa: changed the fallback device-type again to "Dimmable Light" (#30013) after collective debugging; fixed brightness for on/off-devices and scripts to prevent "device malfunction" response from Alexa (#29899)

* Emulated Hue + Alexa: lint (#30013, #29899)
2020-02-02 14:52:00 -08:00
Christian Clauss
df7d2b3aeb
Fix typos found by codespell (#31243)
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Martin
b22dfa119b
Emulated Hue: changed fallback device-type to fix Alexa compatibility issues (#30013) (#31330)
* Emulated Hue: changed the reported fallback device-type to fix Alexa compatibility issues (#30013)

* Emulated Hue: updated tests (#30013)
2020-01-30 23:30:13 -08:00
Rafał Słota
080827fb62
Fix light.turn_on for emulated_hue (#31195)
* Fix light.turn_on for emulated_hue

HarmonyHub sends `{'xy': [0, 0], 'on': True, 'bri': 0}` when turning on lights that do not support brightness control. Unfortunately current logic always uses  brightness value to control on/off state which makes no sense for lights that don't support brightness at all. This change fixes that behavior, making light without brightness control usable with HarmonyHub and probably some other remotes.

* Test 'no_brightness' lights
2020-01-29 12:11:22 +01:00
NobleKangaroo
e2f591e5bc Remove self as Emulated Hue codeowner (#30654) 2020-01-10 22:35:18 +01:00
Franck Nijhof
bfa0edaf92 Migrate Integration Quality Scale from docs to manifest: internal (#30551) 2020-01-07 20:58:49 +01:00