cgarwood / homeassistant-zwave_mqtt

Limited Pre-Release of the new OZW1.6 Z-Wave component. Currently has limited platform support. Check the README for more details.
72 stars 8 forks source link

Switch Entity is Missing #127

Closed achurak closed 4 years ago

achurak commented 4 years ago

Hello,

I'm trying to add HomeSeer HS-FLS100+ Z-Wave Plus Floodlight Sensor and for some reason the device is missing the switch entity. The binary_sensor motion is added correctly and so is the illuminance sensor, but the switch that actually controls the light on/off is missing. I do see this switch in the ozw admin panel and I do see commandClassId 37 in the MQTT explorer under this node.

I tried excluding/including it, but got the exact same result.

Here's what I see in the mqtt logs on hass:

hass                   | 2020-05-02 14:08:54 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on OpenZWave/1/node/28/instance/1/commandclass/37/: b'{\n    "Instance": 1,\n    "CommandClassId": 37,\n    "CommandClass": "COMMAND_CLASS_SWITCH_BINARY",\n    "TimeStamp": 1588442933\n}'
hass                   | 2020-05-02 14:08:54 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on OpenZWave/1/node/28/instance/1/commandclass/37/value/474562576/: b'{\n    "Label": "Switch",\n    "Value": false,\n    "Units": "",\n    "Min": 0,\n    "Max": 0,\n    "Type": "Bool",\n    "Instance": 1,\n    "CommandClass": "COMMAND_CLASS_SWITCH_BINARY",\n    "Index": 0,\n    "Node": 28,\n    "Genre": "User",\n    "Help": "Turn On/Off Device",\n    "ValueIDKey": 474562576,\n    "ReadOnly": false,\n    "WriteOnly": false,\n    "ValueSet": false,\n    "ValuePolled": false,\n    "ChangeVerified": false,\n    "Event": "valueAdded",\n    "TimeStamp": 1588442933\n}'
hass                   | 2020-05-02 14:08:54 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on OpenZWave/1/node/28/instance/1/commandclass/37/value/474562576/: b'{\n    "Label": "Switch",\n    "Value": true,\n    "Units": "",\n    "Min": 0,\n    "Max": 0,\n    "Type": "Bool",\n    "Instance": 1,\n    "CommandClass": "COMMAND_CLASS_SWITCH_BINARY",\n    "Index": 0,\n    "Node": 28,\n    "Genre": "User",\n    "Help": "Turn On/Off Device",\n    "ValueIDKey": 474562576,\n    "ReadOnly": false,\n    "WriteOnly": false,\n    "ValueSet": false,\n    "ValuePolled": false,\n    "ChangeVerified": false,\n    "Event": "valueChanged",\n    "TimeStamp": 1588442934\n}'
hass                   | 2020-05-02 14:09:31 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on OpenZWave/1/node/28/instance/1/commandclass/37/value/474562576/: b'{\n    "Label": "Switch",\n    "Value": false,\n    "Units": "",\n    "Min": 0,\n    "Max": 0,\n    "Type": "Bool",\n    "Instance": 1,\n    "CommandClass": "COMMAND_CLASS_SWITCH_BINARY",\n    "Index": 0,\n    "Node": 28,\n    "Genre": "User",\n    "Help": "Turn On/Off Device",\n    "ValueIDKey": 474562576,\n    "ReadOnly": false,\n    "WriteOnly": false,\n    "ValueSet": false,\n    "ValuePolled": false,\n    "ChangeVerified": false,\n    "Event": "valueChanged",\n    "TimeStamp": 1588442971\n}'
ghost commented 4 years ago

I have observed the same issue with my HomeSeer HS-FLS100+. Attached is an mqtt dump. Device is under the topic OpenZWave/1/node/34/

mqtt_dump_fls100.txt

kpine commented 4 years ago

@eyager1 Your dump is showing that ozwdaemon is not running.

OpenZWave/1/status/,{    "Status": "Offline"}

Probably want to get it running and get another dump.

ghost commented 4 years ago

Here is another dump with ozwdaemon running.

mqtt_dump.txt

kpine commented 4 years ago

It's a regression in the discovery schema. This device's "Generic" type is "NodeGeneric": 7, which is GENERIC_TYPE_SENSOR_NOTIFICATION. The discovery schema for "switch" entity is missing const.GENERIC_TYPE_SENSOR_NOTIFICATION, so it's not detected as a valid switch entity.

The entry was recently removed and should be reverted.

kpine commented 4 years ago

Admittedly I don't fully understand all of the discovery schema, so besides cover why does a node's device class matter when it comes to a switch?

marcelveldt commented 4 years ago

Most of the times it doesn't matter it's just there to make sure we make the correct matches but if make it too narrow, we miss stuff. Like happened here.

marcelveldt commented 4 years ago

We're already implementing stuff in core Home Assistant so this custom component will not receive updates anymore. We'll make sure this particular issue will be fixed in the new integration, thanks for reporting.

ghost commented 4 years ago

For those who can't wait and need to fix the issue, copy the attached file discovery.py.txt to .homeassistant/custom_components/zwave_mqtt/discovery.py

Thank you to @kpine for finding the offending missing sensor type. Right now the zwave_mqtt component in the dev branch of homeassistant is behind the version in this github repository so I can't open a pull request to fix the issue in homeassistant core.

marcelveldt commented 4 years ago

Fixed in the core implementation.