Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request/Enhancement: Expose "On/Off plug-in unit" as switches instead of lights #13

Closed
timbru31 opened this issue Jun 12, 2018 · 14 comments

Comments

@timbru31
Copy link

Sadly deconz exposes my Osram Smart+ Plugs (https://www.osram-lamps.com/ecatalog/smart-home/smart-home-components/smart-plug/index.jsp) as lights, but they have the type On/Off plug-in unit. It would be awesome if this project would expose these entites as switches instead of lights.
Example from deconz API:

    "23": {
        "etag": "318bed1a0d0894ffc04b63a264f1d79d",
        "hascolor": false,
        "manufacturername": "OSRAM",
        "modelid": "Plug 01",
        "name": "Power Plug 1",
        "state": {
            "alert": "none",
            "on": false,
            "reachable": true
        },
        "swversion": "V1.04.12",
        "type": "On/Off plug-in unit",
        "uniqueid": "80:18:76:00:00:0d:36:ac-03"
    },

Let me know if I can help you with that.
Thanks in advance!

@timbru31
Copy link
Author

This is how homebridge-hue "identifies" the switches: ebaauw/homebridge-hue@6c1ce67

@Kane610
Copy link
Owner

Kane610 commented Jun 12, 2018

Great! I hadn't even reflected over that plug ins are represented as lights, but that is true. Do you know if all plug in units are represented by the same type?

@timbru31
Copy link
Author

Sadly not. Maybe @ebaauw can help with this question ("are all plug in units are represented via 'On/Off plug-in unit'?")

@ebaauw
Copy link

ebaauw commented Jun 12, 2018

The type REST API attribute is derived from the ZIgBee device type (per endpoint). Unfortunately, there's multiple values for plugs, and not all devices use the correct value. So far I've seen "On/Off plug-in unit", "Smart plug", and "Dimmable plug-in unit" (for the old Philips LivingWhites plug, which actually supports dimming, so you probably want to expose that as a light).

See https://github.com/dresden-elektronik/deconz-rest-plugin/blob/07fa1bf0fba5254b71667e59f25b6d5b0144ee68/light_node.cpp#L530 for a complete overview of the supported device types and corresponding values for type.

Basically homebridge-hue checks what state attributes are provided. This used to work, until the innr SP 120 came along. This smart plug actually supports a Level Control cluster, so deCONZ creates a state.bri for it. It doesn't actually support dimming, but it does react to the Move to Level with On/Off command, I suspect because this is what the innr remote sends instead of On and Off.
I whitelisted the plug in homebridge-hue to ignore state.bri and expose it to HomeKit as an Outlet instead of a LightBulb service.

Note that there are also other devices that are exposed as a /lights resource, like sirens ("Warning device"), the Keen Smart vent ("Level controllable output"), and the Xiaomi curtain controller ("Window covering device").

@Kane610
Copy link
Owner

Kane610 commented Jun 13, 2018

It sounds quite complex to cover all devices and also if some wall plugs allow dimming and should continue to be lights then there are no common base for the device type and then it might be better to just keep them as light

@Kane610
Copy link
Owner

Kane610 commented Jul 29, 2018

I've been thinking about this a bit more and the best way for this is just to have a list of types that will be created as switches instead of lights in hass. So Im not changing anything in pydeconz. Gonna get this done within a few weeks

@Kane610
Copy link
Owner

Kane610 commented Jul 30, 2018

Will be solved by home-assistant/core#15752

@timbru31
Copy link
Author

Awesome 🎉

@Kane610
Copy link
Owner

Kane610 commented Jul 30, 2018

@timbru31 if you have the time, it would be great if you could try it out since I don't have any power plugs

@timbru31
Copy link
Author

Sure, will do!

@Kane610
Copy link
Owner

Kane610 commented Aug 1, 2018

The PR is done and awaiting review so this issue can be closed.

@Kane610 Kane610 closed this as completed Aug 1, 2018
@sieren
Copy link

sieren commented Dec 7, 2019

@ebaauw I was coming across this issue while doing research on why the SP120 (via Deconz) shows as a Lightbulb instead of a switch. From what I’ve read there has been a fix for this, but somehow this doesn’t show up on my end. Any chance there’s a regression? I’ll see if I can find out why, but I’m not too familar with the homebridge-hue codebase.

@Kane610
Copy link
Owner

Kane610 commented Dec 7, 2019

@ebaauw I was coming across this issue while doing research on why the SP120 (via Deconz) shows as a Lightbulb instead of a switch. From what I’ve read there has been a fix for this, but somehow this doesn’t show up on my end. Any chance there’s a regression? I’ll see if I can find out why, but I’m not too familar with the homebridge-hue codebase.

I use them myself and they work as expected. You would need to enable debug and look at its type

@sieren
Copy link

sieren commented Dec 7, 2019

Actually I just solved it myself by running the ph command and getting the updated resourcelinks. Thanks :) (I was under the impression this was only neccessary with the hue bridge, not deconz)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants