hass-emulated-hue/core

Shelly bulbs show as 'on/off' only

finopsfuntimes opened this issue · 6 comments

Describe the bug

Shelly bulbs added using the Shelly integration in Home Assistant will only show up as a type "on/off light", despite having additional features.

Steps to Reproduce

Expected behavior

Bulbs should be exposed with their relevant capabilities for brightness and color temp etc.

Logs

Hardware Info:

Additional context

Method __async_entity_to_hue() in api.py is using the supported_features attribute of an entity to determine which features that a light has. Shelly integration is using the supported_color_modes to indicate this instead.

Example of attributes for a Shelly Bulb Duo entity in HA:

min_mireds: 153
max_mireds: 370
supported_color_modes: color_temp
friendly_name: ShellyBulbDuo-483FDAXXXXXX
supported_features: 0

According to the documentation, a number of values for this attribute (ones that are used in the code) are deprecated and will be removed from HA soon, so a change is probably needed anyway.

The supported_color_modes attribute seems to be the standard approach going forwards.

Thanks for the detailed report! I'll take a look at it later this week.

@finopsfuntimes Can you give the "color-modes" branch a try using the dev addon?

Tested and working great for the Shelly Duo bulbs!

Example of resulting light object from /lights

 "7": {
        "state": {
            "on": false,
            "reachable": true,
            "mode": "homeautomation",
            "bri": 0,
            "colormode": "ct",
            "ct": 0
        },
        "name": "ShellyBulbDuo-483FDA6FBXXX",
        "uniqueid": "483FDA6FBXXX",
        "swupdate": {
            "state": "noupdates",
            "lastinstall": "2021-07-27T08:31:32"
        },
        "config": {
            "archetype": "sultanbulb",
            "direction": "omnidirectional",
            "function": "mixed",
            "startup": {
                "configured": true,
                "mode": "safety"
            }
        },
        "capabilities": {
            "certified": true,
            "control": {
                "mindimlevel": 1000,
                "maxlumen": 800,
                "ct": {
                    "min": 153,
                    "max": 370
                }
            },
            "streaming": {
                "renderer": false,
                "proxy": false
            }
        },
        "type": "Color temperature light",
        "manufacturername": "Shelly",
        "productname": "ShellyBulbDuo-483FDA6FBXXX",
        "modelid": "Shelly DUO",
        "swversion": "20201124-090917/v1.9.0@57ac4ad8"
    }

I have spotted another issue, I suspect unrelated, but will dig in a bit more and see what I can figure out...
There's a hass area where all the bulbs have a state of 'off' but the all_on and any_on state values for the room are showing as true.

"3": {
            "action": {
                "on": false
            },
            "area_id": "fcd6bef3d3853c4bbd461c3c043dd8b2",
            "class": "Other",
            "enabled": true,
            "lights": [
                "2",
                "3",
                "4",
                "5",
                "6",
                "7"
            ],
            "name": "Bedroom",
            "sensors": [],
            "state": {
                "all_on": true,
                "any_on": true
            },
            "type": "Room"
        }

Forked and fixed the other issue, maybe you can review and see if you think that's a bug that should be adopted into the master?
Commit - Update api.py - Set any_on and all_on state values to False when appropriate for a group.