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
73.38k stars 30.64k forks source link

[Z-Wave JS] Build UI to let user choose domain for newly-discovered Z-Wave device #58254

Closed bhamiltoncx closed 2 years ago

bhamiltoncx commented 3 years ago

The problem

I've just migrated from Hubitat to Home Assistant. I'm using Z-Wave JS with a network of 38 devices, mainly GE/Jasco switches and outlets.

I'm a software developer with plenty of experience contributing to Hubitat, so I'm excited and happy to help contribute to HA (but I am a bit of an HA newbie, so please be patient with me if I get some terminology incorrect).

As I understand it, Home Assistant's Z-Wave JS integration should treat Z-Wave outlets as HA devices of type "Switch" and Z-Wave switches as HA devices of type "Light".

While my GE/Jasco dimmer switches are detected as HA devices of type "Light", the non-dimmer switches are treated as HA devices of type "Switch". That means I have to individually create and maintain Light Switch integrations for every single non-dimmer Z-Wave switch.

I took a peek and found that zwave_js/discovery.py requires Z-Wave command class CommandClass.SWITCH_MULTILEVEL before it returns platform="light" in discovery.

I see now that both Z-Wave switches and outlets report themselves as CommandClass.SWITCH_BINARY, so I know this isn't trivial, but I was surprised moving over from Hubitat that I had to set up extra devices to make my Z-Wave switches have light functionality (e.g. in Google Assistant).

Maybe we should introduce a list of known outlet device IDs which turn into Hubitat switches, and allow other CommandClass.SWITCH_BINARY devices to be lights?

Z-Wave JS dump: zwave_js_dump.json.txt

What is version of Home Assistant Core has the issue?

core-2021.10.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Z-Wave JS

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

switch documentation switch source (message by IssueLinks)

bhamiltoncx commented 3 years ago

After discussion in #devs_zwave, it's pretty clear this is a common new user issue — one possible solution would be a new UI to let users choose the domain for a newly-discovered Z-Wave device, rather than having the Z-Wave JS integration itself decide which domain the device should use.

It makes sense that there are Z-Wave devices with CommandClass CommandClass.SWITCH_BINARY which don't control lights, so the current setup is definitely not incorrect in any way. But I'd love to brainstorm how we can build a more friendly onboarding UI that lets the user decide which entity domain is correct for their device (especially since it can't be changed after the entity is created).