itavero / homebridge-z2m

Expose your Zigbee devices to HomeKit with ease, by integrating 🐝 Zigbee2MQTT with 🏠 Homebridge.
https://z2m.dev
Apache License 2.0
308 stars 49 forks source link

[Bug] - SEA801-Zigbee/SEA802-Zigbee failed to setup switch #360

Closed gbsingh1993 closed 2 years ago

gbsingh1993 commented 2 years ago

Please use the template and fill in all the data requested below!

Describe the bug I have recently started getting this error in the logs on Homebridge and therefore the "off, heat, and auto" switch will not show up when using the Home app to set the temperature. Another thing that I have noticed is that for some reason the thermostats will set themselves back to heat at 16 degrees without doing anything. When I look at the logs in Homebridge no message has been set so unsure why it resets. If there is any more information that anybody would like then please let me know and I can get that for you. Thank you all in advance for helping me on this.

Failed to setup switch for accessory Study Radiator from expose "{"features":[{"access":3,"description":"Enables/disables physical input on the device","name":"state","property":"child_lock","type":"binary","value_off":"UNLOCK","value_on":"LOCK"}],"type":"lock"}": Error: Required "lock_state" property not found for Lock.

Related devices Manufacture - Saswell Model - SEA801-Zigbee/SEA802-Zigbee Type - Thermostatic Radiator valve

To Reproduce Steps to reproduce the behavior, for example:

  1. Pair the device
  2. Restart home bridge and see the errors in the logs
  3. In the Home app there is no system mode switch

Expected behavior In the Home app there should be a mode switch on the temperature setting screen which allows me to change the state of the thermostat from "off, heat and auto"

Versions used Please provide the version of the following pieces of software:

itavero commented 2 years ago

Can you also share the exposes information for this device? This is published to zigbee2mqtt/bridge/devices and can be read with an MQTT client.

Also, please fill in the actual version, instead of just saying "latest". In a week from now that information might be outdated, so mentioning an absolute version is better.

gbsingh1993 commented 2 years ago

Can you also share the exposes information for this device?

Sure

"exposes": [
{
"access": 1,
"description": "Indicates if the battery of this device is almost empty",
"name": "battery_low",
"property": "battery_low",
"type": "binary",
"value_off": false,
"value_on": true
},
{
"features": [
{
"access": 3,
"description": "Enables/disables window detection on the device",
"name": "state",
"property": "window_detection",
"type": "binary",
"value_off": "OFF",
"value_on": "ON",
"value_toggle": "TOGGLE"
}
],
"type": "switch"
},
{
"features": [
{
"access": 3,
"description": "Enables/disables physical input on the device",
"name": "state",
"property": "child_lock",
"type": "binary",
"value_off": "UNLOCK",
"value_on": "LOCK"
}
],
"type": "lock"
},
{
"access": 1,
"description": "Device valve is open or closed (heating or not)",
"name": "heating",
"property": "heating",
"type": "binary",
"value_off": "OFF",
"value_on": "ON"
},
{
"features": [
{
"access": 3,
"description": "Temperature setpoint",
"name": "current_heating_setpoint",
"property": "current_heating_setpoint",
"type": "numeric",
"unit": "°C",
"value_max": 30,
"value_min": 5,
"value_step": 0.5
},
{
"access": 1,
"description": "Current temperature measured on the device",
"name": "local_temperature",
"property": "local_temperature",
"type": "numeric",
"unit": "°C"
},
{
"access": 3,
"description": "Mode of this device",
"name": "system_mode",
"property": "system_mode",
"type": "enum",
"values": ["off", "heat", "auto"]
},
{
"access": 3,
"description": "Offset to be used in the local_temperature",
"name": "local_temperature_calibration",
"property": "local_temperature_calibration",
"type": "numeric",
"unit": "°C",
"value_max": 30,
"value_min": -30,
"value_step": 0.1
},
{
"access": 3,
"description": "Away mode",
"name": "away_mode",
"property": "away_mode",
"type": "binary",
"value_off": "OFF",
"value_on": "ON"
}
],
"type": "climate"
},
{
"access": 1,
"description": "Link quality (signal strength)",
"name": "linkquality",
"property": "linkquality",
"type": "numeric",
"unit": "lqi",
"value_max": 255,
"value_min": 0
}
]

Also, please fill in the actual version, instead of just saying "latest". In a week from now that information might be outdated, so mentioning an absolute version is better.

sure will update the main issue.

gbsingh1993 commented 2 years ago

So small update. I have been looking around trying to figure out if the issue is with this plugin or with zigbee2mqtt that I'm running and I think it might be this plugin (sorry if I'm misunderstanding something). I have changed the converters file on my instance to stop exposing the switches that were causing the error to see if now this plugin would see the 'off, heat and auto' options but still not showing anything. Below is the new expose information from zigbee2mqtt that I have. Any help would be appreciated. Thank you :)

{
    "date_code": "",
    "definition": {
      "description": "Thermostatic radiator valve",
      "exposes": [
        {
          "access": 1,
          "description": "Indicates if the battery of this device is almost empty",
          "name": "battery_low",
          "property": "battery_low",
          "type": "binary",
          "value_off": false,
          "value_on": true
        },
        {
          "access": 1,
          "description": "Device valve is open or closed (heating or not)",
          "name": "heating",
          "property": "heating",
          "type": "binary",
          "value_off": "OFF",
          "value_on": "ON"
        },
        {
          "features": [
            {
              "access": 3,
              "description": "Temperature setpoint",
              "name": "current_heating_setpoint",
              "property": "current_heating_setpoint",
              "type": "numeric",
              "unit": "°C",
              "value_max": 30,
              "value_min": 5,
              "value_step": 0.5
            },
            {
              "access": 1,
              "description": "Current temperature measured on the device",
              "name": "local_temperature",
              "property": "local_temperature",
              "type": "numeric",
              "unit": "°C"
            },
            {
              "access": 3,
              "description": "Mode of this device",
              "name": "system_mode",
              "property": "system_mode",
              "type": "enum",
              "values": ["off", "heat", "auto"]
            },
            {
              "access": 3,
              "description": "Offset to be used in the local_temperature",
              "name": "local_temperature_calibration",
              "property": "local_temperature_calibration",
              "type": "numeric",
              "unit": "°C",
              "value_max": 30,
              "value_min": -30,
              "value_step": 0.1
            },
            {
              "access": 3,
              "description": "Away mode",
              "name": "away_mode",
              "property": "away_mode",
              "type": "binary",
              "value_off": "OFF",
              "value_on": "ON"
            }
          ],
          "type": "climate"
        },
        {
          "access": 1,
          "description": "Link quality (signal strength)",
          "name": "linkquality",
          "property": "linkquality",
          "type": "numeric",
          "unit": "lqi",
          "value_max": 255,
          "value_min": 0
        }
      ],
      "model": "SEA801-Zigbee/SEA802-Zigbee",
      "options": [
        {
          "access": 2,
          "description": "Set to false to disable the legacy integration (highly recommended), will change structure of the published payload (default true).",
          "name": "legacy",
          "property": "legacy",
          "type": "binary",
          "value_off": false,
          "value_on": true
        }
      ],
      "supports_ota": false,
      "vendor": "Saswell"
    },
    "endpoints": {
      "1": {
        "bindings": [
          {
            "cluster": "genBasic",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0018e334cc",
              "type": "endpoint"
            }
          }
        ],
        "clusters": {
          "input": ["genBasic", "genGroups", "genScenes", "manuSpecificTuya"],
          "output": ["genOta", "genTime"]
        },
        "configured_reportings": [],
        "scenes": []
      }
    },
    "friendly_name": "Study Radiator",
    "ieee_address": "0x5c0272fffec4e1f4",
    "interview_completed": true,
    "interviewing": false,
    "manufacturer": "_TZE200_c88teujp",
    "model_id": "TS0601",
    "network_address": 4976,
    "power_source": "Battery",
    "supported": true,
    "type": "EndDevice"
  }
gbsingh1993 commented 2 years ago

Sorry another update. Turned on debug logs in home bridge and for every TRV I get Study Radiator: ignore system_mode; no current state exposed., so looks like something isn't right. I have tried to look at the code but got a little confused so if anybody can shed some light on this I would appreciate it :)

itavero commented 2 years ago

Sounds similar to #79

gbsingh1993 commented 2 years ago

Sounds similar to #79

Yeah so while I've been looking around the code and things I don't think it exactly the issue with the switches being exposed. The system_mode is the actual issue that I'm having so would you like me to open a new bug for that or can we just use this. I can't fully figure out if it's a issue with the plug-in (don't think it is), or zigbee2mqtt.

itavero commented 2 years ago

If I remember correctly, the converter (src/converters/climate.ts) will not expose the target mode, if the device does not expose a running_state. I'm not 100% sure why I made it this way, so I would have to look into that.

Does the log (on startup) contain something like ignore system_mode; no current state exposed?

Unfortunately I don't own any Zigbee thermostat-like devices myself, so I can't easily verify backwards compatibility if I make changes here.

mikicof commented 2 years ago

Hi! I'm having the same "Failed to setup..." error with my thermostat but in my case it doesn't show up on homebridge.

I'm using an external converter here as mine is not in the list of supported devices, I added it on the configuration of the moes bht thermostat as it's the same model but it was giving me temperatures 1/10 of actual, so I found some code for this model and works fine in z2m.

Funny thing is that if I set it as moes then it shows up on homebridge, and changing it back to an external converter keeps it working perfectly, temperature and controls, on both z2m and homebridge/homekit... until I reboot the Raspberry where there are the homebridge an z2m instances, then it throws the error and stops showing on homebridge and homekit.

Here it is the code I'm using as an external converter: https://github.com/Koenkk/zigbee2mqtt/discussions/9024#discussioncomment-1768482

Here it is the code for the moes model that was working for me adding the manufacturer in the list: https://github.com/Koenkk/zigbee-herdsman-converters/blob/242e2fc8e2a97d49b71cc987925cba273b4caabf/devices/moes.js#L100

Thank you!

stale[bot] commented 2 years ago

It appears that this issue did not have an update in quite some time. Please check if you can provide any additional information to help resolve this issue. If there isn't any activity in the next two weeks, this issue will be closed automatically. Thank you for your contributions!

Z18Aplha commented 2 years ago

Some updates here? I recently tried to get the "on/off-switch" of my valve (same as in headline) in my homekit. Sadly that doesnt work. Instead the switch, which appears in homekit (and pretends to be the "on/off-switch") is just the _childlock switch. That's weird. Is it possible to use the "system_mode" of the valve instead to configure the "on/off- switch" in homekit?

Would be great. Otherwise the radiator valves appear "heating" all the time.

Greetings Z18

itavero commented 2 years ago

No updates from my side. Can you maybe create a new feature Request for this and describe the wanted behavior in more detail? I would not quite follow your comment unfortunately.