home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.11k stars 29.79k forks source link

Switches displayed as dimmable light in emulated hue #26860

Closed schiegg closed 4 years ago

schiegg commented 4 years ago

Home Assistant release with the issue: 0.95 (I think it was) and 0.99 (latest) after update

Last working Home Assistant release (if known): Started with fresh installation of 0.95 (as I think it was)

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io 2.12

Component/platform: Raspberry Pi 3B+

Description of problem: I have the same issue as in closed issue #13296. My Osram pluggable switches are correctly working over the deCONZ zigbee add-on integrated as lights in Hass.io but are advertised as dimmable lights by emulated hue. I somehow found a way to "fix" it, as long as the plugs were on while discovery by Alexa, but if they were off for a longer time and Alexa may did some background checking, their state went back to dimmable light. As dimmable lights they switch on and immediately off again if Alexa tries to turn them on. Any way to fix this? My Python is not the best. I don't exactly understand what @sigwinch28 did in his commit but the part of if brightness is not None: [...] else: light_type = 'On/Off light' sounds good to me actually.

Additional information: I dont use exposed by default and there are only ~10 exposed devices that i listed seperately.

"18": { "modelid": "HASS123", "name": "Wohnzimmer - Fernseher", "state": { "bri": 0, "hue": null, "on": true, "reachable": true, "sat": null }, "swversion": "123", "type": "Dimmable light", "uniqueid": "switch.wohnzimmer_fernseher" },

Thank you all in advance.

pattyland commented 4 years ago

Sorry for an off-topic question but how do you get Alexa still working with emulated hue? The last months an old echo kept it working but since a weeks Alexa stopped working with any device from emulated hue :( Did you changed the port or some other secret setting?

schiegg commented 4 years ago

@pattyland Altough such offtopic questions are really annoying and destroy the whole principle of these bug systems, I will reply for short: I only changed the port to 80 and instructed Alexa to search for a Philipps Hue Bridge V1 (round) as instructed on so many other community helpdesks. (Sorry for being so pissy but ever been to FHEM forum? 30+ pages under one topic discussing like ~50 topics between the pages, you will freak out if you search for something and it destroys the whole project...)

Philje123 commented 4 years ago

Scenes are also exposed as a dimmable light. It would be good if these could also just show as an on/off light. I use my Harmony remote to control the emulated hue entities so it looks a bit weird having a brightness slider for a lighting scene.

collider123 commented 4 years ago

I have the same problem. Everything is exposed as dimmable lights.

kvermilion commented 4 years ago

@zichengchi, #26541 appears to fix that, but #25047 is still be present for me.

schiegg commented 4 years ago

I tried understanding the python code and discovered the following line: if (entity_features & SUPPORT_BRIGHTNESS) or entity.domain != light.DOMAIN: in line 574 of the hue_api.py script which seems to control the whole process of exposing to Alexa.

As my devices are switches (or in @Philje123 case scenes) and therefore not elements in the light.DOMAIN they get exposed as dimmable lights as the "or" gets true even not supporting brightness. For climate.DOMAIN, fan.DOMAIN, media_player.DOMAIN and cover.DOMAIN this works as the brightness is translated in their speed, volume or temperature values but for scenes and switches its a deal braker.

May an explicit declaration like this would help? if (entity_features & SUPPORT_BRIGHTNESS) or (entity.domain == climate.DOMAIN or entity.domain == fan.DOMAIN or entity.domain == media_player.DOMAIN or entity.domain == cover.DOMAIN):

aqWCfFgvp81SqO commented 4 years ago

I solved this issue on hass.io by:

• add directory: ../config/custom_components/emulated_hue • copy the emulated_hue raw text file by file into the same file names in the directory previously made • near the bottom of the hue_api.py is where the above referenced logic is not providing the desired result, take all the «or» return {} items and copy them above to the «if» • restart HA • test with http://«your_ip»/api/pi/lights • after removing all learned devices from Alexa, go through discovery again, choosing Philips Hue Bridge version 1

jbcodemonkey commented 4 years ago

@ts8789's fix https://github.com/home-assistant/home-assistant/pull/27767 resolved this for me. Thank you!

That was a painful few weeks playing games w Alexa...

duhow commented 4 years ago

Should be fixed by #28317 .

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

jerect commented 4 years ago

HI!, I have the last version of Hassos and it still doing this. what should I do?

jyavenard commented 4 years ago

Yeah, can confirm that this isn't fixed. All switches are reported as dimmable light.

How can you re-open a bug?

Here is an example

{"10": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "living_switch_top_right", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:b2:3d:fc:2f:28:7e:05-00"}, "11": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "living_switch_bottom_left", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:8f:31:e5:01:cb:80:f6-c9"}, "12": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "living_switch_bottom_right", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:fa:5a:fe:9a:7a:33:7d-69"}, "16": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "corridor_switch", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:41:76:69:0d:2e:d5:f3-5d"}, "17": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Walk-in Robe light", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:f5:b1:44:c8:8a:95:35-70"}, "18": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "laundry_switch_1", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:86:4a:08:f5:e6:19:02-7e"}, "19": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "laundry_switch_2", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:11:8e:58:f5:72:63:ee-17"}, "20": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "hannah_switch", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:1f:cd:7e:b4:53:69:fb-a3"}, "27": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Blue charger switch", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:05:4a:39:42:8c:36:4e-0a"}, "28": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Blue update switch", "state": {"bri": 254, "mode": "homeautomation", "on": true, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:15:99:64:91:81:5e:8c-d1"}, "29": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Blue maxrange switch", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:6d:b1:96:c8:97:c3:45-45"}, "3": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Zigbee2mqtt Main join", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:c6:86:fd:d4:03:6d:fa-65"}, "30": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Blue sentry mode switch", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:e1:e7:e5:a2:57:93:92-85"}, "31": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "patio_switch", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:a1:0f:a7:47:9e:be:a9-8d"}, "32": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "sebasien's fan", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:6a:17:5a:ac:a6:06:62-6e"}, "33": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "sebasien's fan Light", "state": {"bri": 1, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:5f:fc:c3:31:5c:71:7c-7c"}, "34": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "Living room light", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:2f:f2:b4:d1:33:8c:5e-2f"}, "35": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "dominique light", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:a7:1d:64:87:d6:45:f9-c3"}, "36": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Left", "state": {"bri": 1, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:3c:8b:6c:dd:cb:6b:63-2e"}, "37": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Right", "state": {"bri": 1, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:06:75:b2:56:7f:15:f2-58"}, "38": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "office light", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": true, "reachable": false}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:ca:59:d3:fa:59:45:02-fa"}, "39": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "Dressing 1 light", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:05:03:ea:54:ab:c5:1b-0c"}, "4": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "Dining Room Fan", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:4e:ee:61:16:ab:16:a7-3b"}, "40": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "Dressing 2 light", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:8f:6c:fe:a3:e6:33:91-d0"}, "41": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "Hannah's bedroom light", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": true, "reachable": false}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:a3:7d:85:07:da:23:2c-b2"}, "42": {"manufacturername": "Home Assistant", "modelid": "HASS312", "name": "Master Bedroom Fan", "state": {"bri": 1, "colormode": "ct", "ct": 153, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Color temperature light", "uniqueid": "00:16:77:dc:b7:6c:f3:83-ce"}, "43": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Master Bedroom Fan Light", "state": {"bri": 1, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:bf:8c:84:cd:37:52:cd-09"}, "44": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "dining_switch_1", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:ec:85:10:71:4f:8f:8f-3e"}, "45": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "dining_switch_3", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:91:f3:44:40:8c:03:16-8c"}, "46": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "dining_switch_2", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:29:74:34:f5:cc:b2:0b-c5"}, "5": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Dining Room Fan Light", "state": {"bri": 1, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:70:e7:7b:25:1d:1f:52-b3"}, "6": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "Zigbee2mqtt Main join", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:63:59:4d:b4:ff:1b:52-35"}, "7": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "toilet_switch_1", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:ba:9b:2c:67:83:54:5c-dc"}, "8": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "toilet_switch_2", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:84:8f:f3:af:cb:a4:43-e7"}, "9": {"manufacturername": "Home Assistant", "modelid": "HASS123", "name": "living_switch_top_left", "state": {"bri": 254, "mode": "homeautomation", "on": false, "reachable": true}, "swversion": "123", "type": "Dimmable light", "uniqueid": "00:a8:03:64:25:ae:d0:b3-56"}}

With a particular entry:

{
"manufacturername": "Home Assistant",
"modelid": "HASS123",
"name": "toilet_switch_1",
"state": {"bri": 254,
"mode": "homeautomation",
"on": false,
 "reachable": true},
 "swversion": "123", 
"type": "Dimmable light", 
"uniqueid": "00:ba:9b:2c:67:83:54:5c-dc"
}

This entry is a switch, not a light.

perebusquets commented 3 years ago

Hi. Somehow, this is still happening for me... When adding a switch, my Harmony remote picks it up as a dimmable light.

In case it helps, it's a switch for doing wake on lan for my desktop.

If you need any debugging info regarding this, please don't hesitate asking.

mageali commented 2 months ago

I have the same issue in 2024 with switches showing up as dimmable lights