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
74.09k stars 31.1k forks source link

shutter recognized as light #123189

Open zeev-mindali opened 3 months ago

zeev-mindali commented 3 months ago

The problem

i have glass9 which have 2 shutters 2 button and 3 virtual switch i checked the zwave network and the shutters recognized as c class motor. but in home assistant, it's show as light without the option to change it. how can i change it?

Screenshot 2024-08-05 at 16 39 23

What version of Home Assistant Core has the issue?

core-2024.7.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

zwave

Link to integration documentation on our website

zwave js

Diagnostics information

i using zwave js handling zwave devices. the shutter is shown as light with no option to change it

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 months ago

Hey there @home-assistant/z-wave, mind taking a look at this issue as it has been labeled with an integration (zwave_js) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zwave_js` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zwave_js` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zwave_js documentation zwave_js source (message by IssueLinks)

kpine commented 3 months ago

Please provide the diagnostic file that was asked for when you created the issue:

image

https://www.home-assistant.io/integrations/zwave_js/#network-devices -> Download diagnostics

zeev-mindali commented 3 months ago

config_entry-zwave_js-01J4GRKFXZDKNDWCNE0ZWKH65M.json

here is the diagnostic file

kpine commented 3 months ago

Sorry, I was not specific enough. Please upload the Device diagnostic. Follow the link I posted to the documentation to see how to do that.

zeev-mindali commented 3 months ago

zwave_js-01J4GRKFXZDKNDWCNE0ZWKH65M-gp9-42455c5a5e8cdd8dd166aa271dad75cf.json

is this is the file? the documantion is confusing

zeev-mindali commented 3 months ago

as i looked into both files, there are two devices gp9 and wallwand. on gp9 it recognized the shutter as : Motor Control Class C on wallwand it recognized the shutter as : Multiposition Motor

in both cases to my opnion it should be a shutter and not a dimmer

kpine commented 3 months ago

HA already assigns cover to both Motor Control Class C and Multiposition Motor devices, see for yourself at https://github.com/home-assistant/core/blob/d530137bec3e23a194841e56d32246d8a6e741fa/homeassistant/components/zwave_js/discovery.py#L1058-L1073

The highlighted code detects those device classes and if found treats the multilevel switch value as a cover entity. For some reason this isn't occurring for your devices, I haven't found the reason yet. A light entity is only assigned if it doesn't match the above.

For example, in the device diagnostic we see that endpoint 8 has device classes:

        "8": {
          "nodeId": 46,
          "index": 8,
          "installerIcon": 2048,
          "userIcon": 2048,
          "deviceClass": {
            "basic": {
              "key": 4,
              "label": "Routing End Node"
            },
            "generic": {
              "key": 17,
              "label": "Multilevel Switch"
            },
            "specific": {
              "key": 7,
              "label": "Motor Control Class C"
            }
          },

Which should match the schema along with the primary value which is:

        "46-38-8-currentValue": {
          "endpoint": 8,
          "commandClass": 38,
          "commandClassName": "Multilevel Switch",
          "property": "currentValue",
          "propertyName": "currentValue",
          "ccVersion": 4,
          "metadata": {
            "type": "number",
            "readable": true,
            "writeable": false,
            "label": "Current value",
            "min": 0,
            "max": 99,
            "stateful": true,
            "secret": false
          },
          "value": 0
        },

So with those two properties it should be matching the cover discovery schema. There must be something very minor that is tripping it up, it will just take some time to find.

zeev-mindali commented 3 months ago

o.k. waiting for your inspection. if there any thing i can do from my side, i can try to found out and share the result

zeev-mindali commented 3 months ago

any news?

kpine commented 3 months ago

No, I won't be spending any time in this at the moment, sorry. Other things have priority. Anyone is welcome to look.

kpine commented 3 months ago

I had a chance to look. The problem is that HA's discovery process is broken for multi-endpoint devices. The code I linked to above,

https://github.com/home-assistant/core/blob/d530137bec3e23a194841e56d32246d8a6e741fa/homeassistant/components/zwave_js/discovery.py#L1058-L1073

is attempting to match on the Node's device class values:

https://github.com/home-assistant/core/blob/d530137bec3e23a194841e56d32246d8a6e741fa/homeassistant/components/zwave_js/discovery.py#L1275-L1293

The above check is failing because your node's device class looks like this:

      "zwavePlusNodeType": 0,
      "zwavePlusRoleType": 5,
      "deviceClass": {
        "basic": {
          "key": 4,
          "label": "Routing End Node"
        },
        "generic": {
          "key": 16,
          "label": "Binary Switch"
        },
        "specific": {
          "key": 0,
          "label": "Unused"
        }
      },

Notice it doesn't match the motor control class, and so it fails to match the cover schema and ends up as a light. HA should be looking at the endpoint information instead. Here's an example of the information for endpoint 8:

        "8": {
          "nodeId": 46,
          "index": 8,
          "installerIcon": 2048,
          "userIcon": 2048,
          "deviceClass": {
            "basic": {
              "key": 4,
              "label": "Routing End Node"
            },
            "generic": {
              "key": 17,
              "label": "Multilevel Switch"
            },
            "specific": {
              "key": 7,
              "label": "Motor Control Class C"
            }
          },

This correctly matches the discovery schema. I don't have a fix in mind, it could be as simple as switching to look at endpoint classes. Or it could be a difficult change. Hopefully one of the main developers will be able to address it with this information.

MartinHjelmare commented 3 months ago

I think it would be possible to use the corresponding endpoint when matching device class attributes. If there's an issue with that our existing tests should catch that.

zeev-mindali commented 3 months ago

i will look into it today, hoping to find the problem. it's a dynamic multi end point rather then fixed type for endpoint.

zeev-mindali commented 3 months ago

after check, every device that as multi endpoins, that have shutters , like wallwand , mco Home glass 9, and other, will not work. i check with zwave js ui, it's reflect the correct motor and i can control up/down/stop but in HA integration is doesn't work.

kpine commented 3 months ago

I explained the cause in comment https://github.com/home-assistant/core/issues/123189#issuecomment-2277245517 and potential fix. Someone just needs to implement it (e.g. https://github.com/home-assistant/core/issues/123189#issuecomment-2277660479).

The light entities should still allow you to control the shades, they just appear as lights instead of covers. They will set the position of the shade to the brightness value. You should be able to do open/close with 100% or 0%.

If you want to control the shades in HA the exact same way as in ZUI using the value IDs you can use the zwave_js.set_value action, e.g. set 46-38-9-Up and 46-38-9-Down.

zeev-mindali commented 3 months ago

dear @kpine

when it's shutter as should be, there is up / stop / down , like a normal shutter. but when it's light, it's act as dimmer, so there is no stop

zeev-mindali commented 3 months ago

dear @kpine

where in the code, it's fall back to light dimmer? tried to find with no success

zeev-mindali commented 3 months ago

can any one help with the issue? i not familer with python, and i stuck with my curtion and shutter :(

MartinHjelmare commented 3 months ago

I'll look at it when I'm back from vacation.

zeev-mindali commented 2 months ago

@MartinHjelmare any news?

MartinHjelmare commented 2 months ago

No, I'll update here when there is.

zeev-mindali commented 2 months ago

@MartinHjelmare ,

i talked withh ppl in zwave-js-ui, which i use in ha, they fixed on thier side, i can see in thier panel it's cover (c class motor) in ha, it's still shown as light

zeev-mindali commented 2 months ago

@MartinHjelmare any news?

MartinHjelmare commented 2 months ago

Please don't ping me for news. I said above that I'll update here when there is news. Please respect that.