itavero / homebridge-z2m

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

[Bug] TS0601: Duplicate service handler #79

Closed mcruscher closed 3 years ago

mcruscher commented 3 years ago

I'm very happy with this plugin. Very helpful en useful. Currently I'm using several radiator valves (like Tuya TS0601) with are reporting errors in the Homebridge Log.

Like:

[2/26/2021, 11:28:52 AM] [zigbee2mqtt] Restoring accessory: radiator Lieke (0x847127fffe11dc50)
[2/26/2021, 11:28:52 AM] [zigbee2mqtt] DUPLICATE SERVICE HANDLER with identifier 00000049-0000-1000-8000-0026BB765291 for accessory radiator Lieke. New one will not stored.
[2/26/2021, 11:28:52 AM] [zigbee2mqtt] DUPLICATE SERVICE HANDLER with identifier 00000049-0000-1000-8000-0026BB765291 for accessory radiator Lieke. New one will not stored.
[2/26/2021, 11:28:52 AM] [zigbee2mqtt] DUPLICATE SERVICE HANDLER with identifier 00000049-0000-1000-8000-0026BB765291 for accessory radiator Lieke. New one will not stored.
[2/26/2021, 11:28:52 AM] [zigbee2mqtt] Failed to setup switch for accessory radiator Lieke 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.

Can anyone help how to resolve this 'DUPLICATE SERVICE HANDLER'? Where do I need to look?

Thanks!

itavero commented 3 years ago

Somehow it's trying to create multiple instances of the Switch service.

Can you add the device entry from the zigbee2mqtt/bridge/devices MQTT topic to this issue?

Is the valve still behaving as expected via HomeKit, or are there specific things you can't do right now?

mcruscher commented 3 years ago

Thank you!

I need to do some further testing to see if the valve working like expected. Setting temp is working ok also setting heating state. But the switch (window open detection?) is not tested yet.

Device entry:

[
   {
      "dateCode":"20190608",
      "friendly_name":"Coordinator",
      "ieeeAddr":"0x00124b0014da4069",
      "lastSeen":1614338169504,
      "networkAddress":0,
      "softwareBuildID":"zStack12",
      "type":"Coordinator"
   },
   {
      "dateCode":"09-06-2019",
      "description":"Mi power plug ZigBee EU",
      "friendly_name":"schakelaar boekenkast",
      "hardwareVersion":1,
      "ieeeAddr":"0x04cf8cdf3c7e520c",
      "lastSeen":1614337951751,
      "manufacturerID":4447,
      "manufacturerName":"LUMI",
      "model":"ZNCZ04LM",
      "modelID":"lumi.plug.mmeu01",
      "networkAddress":60035,
      "powerSource":"Mains (single phase)",
      "type":"Router",
      "vendor":"Xiaomi"
   },
   {
      "description":"MiJia human body movement sensor",
      "friendly_name":"beweging studeerkamer",
      "ieeeAddr":"0x00158d000155e560",
      "lastSeen":1614338140824,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"RTCGQ01LM",
      "modelID":"lumi.sensor_motion",
      "networkAddress":39600,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"09-06-2019",
      "description":"Mi power plug ZigBee EU",
      "friendly_name":"schakelaar kachel",
      "hardwareVersion":1,
      "ieeeAddr":"0x04cf8cdf3c7c233d",
      "lastSeen":1614338126802,
      "manufacturerID":4447,
      "manufacturerName":"LUMI",
      "model":"ZNCZ04LM",
      "modelID":"lumi.plug.mmeu01",
      "networkAddress":28442,
      "powerSource":"Mains (single phase)",
      "type":"Router",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"09-06-2019",
      "description":"Mi power plug ZigBee EU",
      "friendly_name":"schakelaar ventilator",
      "hardwareVersion":1,
      "ieeeAddr":"0x04cf8cdf3c7c1c45",
      "lastSeen":1614337802813,
      "manufacturerID":4447,
      "manufacturerName":"LUMI",
      "model":"ZNCZ04LM",
      "modelID":"lumi.plug.mmeu01",
      "networkAddress":8632,
      "powerSource":"Mains (single phase)",
      "type":"Router",
      "vendor":"Xiaomi"
   },
   {
      "description":"MiJia door & window contact sensor",
      "friendly_name":"garagedeur",
      "ieeeAddr":"0x00158d0001875e25",
      "lastSeen":1614336034311,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"MCCGQ01LM",
      "modelID":"lumi.sensor_magnet",
      "networkAddress":47395,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20170314",
      "description":"MiJia Honeywell smoke detector",
      "friendly_name":"rookmelder garage",
      "hardwareVersion":16,
      "ieeeAddr":"0x00158d0005413331",
      "lastSeen":1614335452185,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"JTYJ-GD-01LM/BW",
      "modelID":"lumi.sensor_smoke",
      "networkAddress":64748,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "description":"MiJia door & window contact sensor",
      "friendly_name":"achterdeur",
      "ieeeAddr":"0x00158d000130c626",
      "lastSeen":1614336356672,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"MCCGQ01LM",
      "modelID":"lumi.sensor_magnet",
      "networkAddress":53726,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20170314",
      "description":"MiJia Honeywell smoke detector",
      "friendly_name":"rookmelder bijkeuken",
      "hardwareVersion":16,
      "ieeeAddr":"0x00158d000485bc5d",
      "lastSeen":1614337092447,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"JTYJ-GD-01LM/BW",
      "modelID":"lumi.sensor_smoke",
      "networkAddress":47338,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20170314",
      "description":"MiJia Honeywell smoke detector",
      "friendly_name":"rookmelder woonkamer",
      "hardwareVersion":16,
      "ieeeAddr":"0x00158d000488d008",
      "lastSeen":1614335314358,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"JTYJ-GD-01LM/BW",
      "modelID":"lumi.sensor_smoke",
      "networkAddress":34239,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "description":"MiJia door & window contact sensor",
      "friendly_name":"voordeur",
      "ieeeAddr":"0x00158d000130e26e",
      "lastSeen":1614335695002,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"MCCGQ01LM",
      "modelID":"lumi.sensor_magnet",
      "networkAddress":327,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20170314",
      "description":"MiJia Honeywell smoke detector",
      "friendly_name":"rookmelder Anna",
      "hardwareVersion":16,
      "ieeeAddr":"0x00158d000488b1da",
      "lastSeen":1614337707510,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"JTYJ-GD-01LM/BW",
      "modelID":"lumi.sensor_smoke",
      "networkAddress":22532,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20170314",
      "description":"MiJia Honeywell smoke detector",
      "friendly_name":"rookmelder overloop",
      "hardwareVersion":16,
      "ieeeAddr":"0x00158d00046140ee",
      "lastSeen":1614336763916,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"JTYJ-GD-01LM/BW",
      "modelID":"lumi.sensor_smoke",
      "networkAddress":40747,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20170314",
      "description":"MiJia Honeywell smoke detector",
      "friendly_name":"rookmelder Lieke",
      "hardwareVersion":16,
      "ieeeAddr":"0x00158d00053e9dae",
      "lastSeen":1614338120459,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"JTYJ-GD-01LM/BW",
      "modelID":"lumi.sensor_smoke",
      "networkAddress":48395,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20170314",
      "description":"MiJia Honeywell smoke detector",
      "friendly_name":"rookmelder slaapkamer",
      "hardwareVersion":16,
      "ieeeAddr":"0x00158d000488d01e",
      "lastSeen":1614336400439,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"JTYJ-GD-01LM/BW",
      "modelID":"lumi.sensor_smoke",
      "networkAddress":24496,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20170314",
      "description":"MiJia Honeywell smoke detector",
      "friendly_name":"rookmelder studeerkamer",
      "hardwareVersion":16,
      "ieeeAddr":"0x00158d00053eb860",
      "lastSeen":1614335746940,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"JTYJ-GD-01LM/BW",
      "modelID":"lumi.sensor_smoke",
      "networkAddress":63184,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "description":"MiJia human body movement sensor",
      "friendly_name":"beweging overloop",
      "ieeeAddr":"0x00158d00011c32a5",
      "lastSeen":1614338025179,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"RTCGQ01LM",
      "modelID":"lumi.sensor_motion",
      "networkAddress":15261,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20160516",
      "description":"MiJia temperature & humidity sensor",
      "friendly_name":"klimaat badkamer",
      "hardwareVersion":30,
      "ieeeAddr":"0x00158d0001530191",
      "lastSeen":1614335626065,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"WSDCGQ01LM",
      "modelID":"lumi.sensor_ht",
      "networkAddress":10108,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20160516",
      "description":"MiJia temperature & humidity sensor",
      "friendly_name":"klimaat serverkast",
      "hardwareVersion":30,
      "ieeeAddr":"0x00158d00040e69cd",
      "lastSeen":1614334920010,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"WSDCGQ01LM",
      "modelID":"lumi.sensor_ht",
      "networkAddress":6655,
      "powerSource":"Battery",
      "softwareBuildID":"3000-0001",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20190723",
      "description":"TRADFRI ON/OFF switch",
      "friendly_name":"knop ventilator",
      "hardwareVersion":1,
      "ieeeAddr":"0xec1bbdfffeb7e5d3",
      "lastSeen":1614335522120,
      "manufacturerID":4476,
      "manufacturerName":"IKEA of Sweden",
      "model":"E1743",
      "modelID":"TRADFRI on/off switch",
      "networkAddress":50820,
      "powerSource":"Battery",
      "softwareBuildID":"2.2.010",
      "type":"EndDevice",
      "vendor":"IKEA"
   },
   {
      "description":"MiJia door & window contact sensor",
      "friendly_name":"tuinhuisjedeur",
      "ieeeAddr":"0x00158d00018760c8",
      "lastSeen":1614335562119,
      "manufacturerID":4151,
      "manufacturerName":"LUMI",
      "model":"MCCGQ01LM",
      "modelID":"lumi.sensor_magnet",
      "networkAddress":38878,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"Xiaomi"
   },
   {
      "dateCode":"20200927",
      "description":"Zigbee two way smart switch",
      "friendly_name":"lamp wc",
      "ieeeAddr":"0x847127fffe280b9e",
      "lastSeen":1610804960502,
      "manufacturerID":4098,
      "manufacturerName":"SONOFF",
      "model":"ZBMINI",
      "modelID":"01MINIZB",
      "networkAddress":25075,
      "powerSource":"Mains (single phase)",
      "type":"Router",
      "vendor":"SONOFF"
   },
   {
      "dateCode":"",
      "description":"Thermostatic radiator valve",
      "friendly_name":"radiator studeerkamer",
      "hardwareVersion":1,
      "ieeeAddr":"0x5c0272fffec4ee50",
      "lastSeen":1614335322962,
      "manufacturerID":4098,
      "manufacturerName":"_TZE200_c88teujp",
      "model":"SEA801-Zigbee/SEA802-Zigbee",
      "modelID":"TS0601",
      "networkAddress":37267,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"Saswell"
   },
   {
      "dateCode":"",
      "description":"Thermostatic radiator valve",
      "friendly_name":"radiator bijkeuken",
      "hardwareVersion":1,
      "ieeeAddr":"0x5c0272fffec36221",
      "lastSeen":1614337368184,
      "manufacturerID":4098,
      "manufacturerName":"_TZE200_c88teujp",
      "model":"SEA801-Zigbee/SEA802-Zigbee",
      "modelID":"TS0601",
      "networkAddress":3050,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"Saswell"
   },
   {
      "dateCode":"",
      "description":"Radiator valve with thermostat",
      "friendly_name":"radiator Anna",
      "hardwareVersion":1,
      "ieeeAddr":"0x847127fffe17ca48",
      "lastSeen":1614335994371,
      "manufacturerID":4098,
      "manufacturerName":"_TZE200_ckud7u2l",
      "model":"TS0601_thermostat",
      "modelID":"TS0601",
      "networkAddress":8862,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"TuYa"
   },
   {
      "dateCode":"",
      "description":"Radiator valve with thermostat",
      "friendly_name":"radiator Lieke",
      "hardwareVersion":1,
      "ieeeAddr":"0x847127fffe11dc50",
      "lastSeen":1614337121638,
      "manufacturerID":4098,
      "manufacturerName":"_TZE200_ckud7u2l",
      "model":"TS0601_thermostat",
      "modelID":"TS0601",
      "networkAddress":11042,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"TuYa"
   },
   {
      "dateCode":"",
      "description":"Radiator valve with thermostat",
      "friendly_name":"radiator badkamer",
      "hardwareVersion":1,
      "ieeeAddr":"0x5c0272fffedac2ce",
      "lastSeen":1614337204163,
      "manufacturerID":4098,
      "manufacturerName":"_TZE200_ckud7u2l",
      "model":"TS0601_thermostat",
      "modelID":"TS0601",
      "networkAddress":16541,
      "powerSource":"Battery",
      "type":"EndDevice",
      "vendor":"TuYa"
   }
]
itavero commented 3 years ago

@mcruscher Pretty sure the data you've added is from zigbee2mqtt/bridge/config/devices and not from zigbee2mqtt/bridge/devices as requested. I also only need the entry of the devices causing the problems, so you don't have to add it all (it's gonna be a large list otherwise, I'm afraid 😉 )

mcruscher commented 3 years ago

@itavero I'm sorry ... this ain't my core business (yet ... ;-) ). I hope this is what you're asking for. This is off the earlier mentioned valve (radiator Lieke):

{
   "auto_lock":"MANUAL",
   "away_mode":"OFF",
   "away_preset_days":1,
   "away_preset_temperature":5,
   "battery_low":false,
   "boost_time":300,
   "child_lock":"UNLOCKED",
   "comfort_temperature":5,
   "current_heating_setpoint":15,
   "eco_temperature":15,
   "elapsed":3612432,
   "force":"normal",
   "holidays":[
      {
         "hour":6,
         "minute":0,
         "temperature":5
      },
      {
         "hour":8,
         "minute":0,
         "temperature":5
      },
      {
         "hour":11,
         "minute":30,
         "temperature":5
      },
      {
         "hour":12,
         "minute":30,
         "temperature":5
      },
      {
         "hour":17,
         "minute":30,
         "temperature":5
      },
      {
         "hour":22,
         "minute":0,
         "temperature":5
      }
   ],
   "last_seen":"2021-02-26T17:08:46+00:00",
   "linkquality":78,
   "local_temperature":15,
   "max_temperature":35,
   "min_temperature":5,
   "position":0,
   "preset":"manual",
   "system_mode":"auto",
   "week":"7",
   "window_detection":"OFF",
   "window_detection_params":{
      "minutes":0,
      "temperature":53
   },
   "workdays":[
      {
         "hour":6,
         "minute":0,
         "temperature":5
      },
      {
         "hour":8,
         "minute":0,
         "temperature":5
      },
      {
         "hour":11,
         "minute":30,
         "temperature":5
      },
      {
         "hour":12,
         "minute":30,
         "temperature":5
      },
      {
         "hour":17,
         "minute":30,
         "temperature":5
      },
      {
         "hour":22,
         "minute":0,
         "temperature":5
      }
   ]
}
mcruscher commented 3 years ago

@itavero I'm sorry ... this ain't my core business (yet ... ;-) ). I hope this is what you're asking for. This is off the earlier mentioned valve (radiator Lieke):

{"auto_lock":"MANUAL","away_mode":"OFF","away_preset_days":1,"away_preset_temperature":5,"battery_low":false,"boost_time":300,"child_lock":"UNLOCKED","comfort_temperature":5,"current_heating_setpoint":15,"eco_temperature":15,"elapsed":3612432,"force":"normal","holidays":[{"hour":6,"minute":0,"temperature":5},{"hour":8,"minute":0,"temperature":5},{"hour":11,"minute":30,"temperature":5},{"hour":12,"minute":30,"temperature":5},{"hour":17,"minute":30,"temperature":5},{"hour":22,"minute":0,"temperature":5}],"last_seen":"2021-02-26T17:08:46+00:00","linkquality":78,"local_temperature":15,"max_temperature":35,"min_temperature":5,"position":0,"preset":"manual","system_mode":"auto","week":"7","window_detection":"OFF","window_detection_params":{"minutes":0,"temperature":53},"workdays":[{"hour":6,"minute":0,"temperature":5},{"hour":8,"minute":0,"temperature":5},{"hour":11,"minute":30,"temperature":5},{"hour":12,"minute":30,"temperature":5},{"hour":17,"minute":30,"temperature":5},{"hour":22,"minute":0,"temperature":5}]}

Hmmmm .... somewhere I got the idea that the above is not the thing you're looking for. But when I try to send zigbee2mqtt/bridge/devices I get the following error from Homebridge log.

Version homebridge: 1.3.1 Version Z2M: 1.1.1 Version zigbee2mqtt: 1.17.1 commit: 99274c7 Version Mosquitto: 2.0.7

[2/26/2021, 7:06:31 PM] [zigbee2mqtt] Failed to process MQTT message on 'zigbee2mqtt/bridge/devices'. (Maybe check the MQTT version?)
[2/26/2021, 7:06:31 PM] [zigbee2mqtt] TypeError: devices.filter is not a function
    at Zigbee2mqttPlatform.handleReceivedDevices (/homebridge/node_modules/homebridge-z2m/src/platform.ts:178:13)
    at Zigbee2mqttPlatform.onMessage (/homebridge/node_modules/homebridge-z2m/src/platform.ts:134:16)
    at MqttClient.emit (events.js:315:20)
    at MqttClient._handlePublish (/homebridge/node_modules/homebridge-z2m/node_modules/mqtt/lib/client.js:1277:12)
    at MqttClient._handlePacket (/homebridge/node_modules/homebridge-z2m/node_modules/mqtt/lib/client.js:410:12)
    at work (/homebridge/node_modules/homebridge-z2m/node_modules/mqtt/lib/client.js:321:12)
    at Writable.writable._write (/homebridge/node_modules/homebridge-z2m/node_modules/mqtt/lib/client.js:335:5)
    at doWrite (/homebridge/node_modules/homebridge-z2m/node_modules/readable-stream/lib/_stream_writable.js:409:139)
    at writeOrBuffer (/homebridge/node_modules/homebridge-z2m/node_modules/readable-stream/lib/_stream_writable.js:398:5)
    at Writable.write (/homebridge/node_modules/homebridge-z2m/node_modules/readable-stream/lib/_stream_writable.js:307:11)
itavero commented 3 years ago

@mcruscher You should not have to send a message to the topic. There should be a "persistent" message there from Zigbee2MQTT. If you don't see it, you can restart Zigbee2MQTT to make sure it is published again or you can probably get it from the Zigbee2MQTT logs.

The Zigbee2MQTT docs contain an example of the data I'm looking for, I'm particularly interested in the contents of the exposes array (within definition).

mcruscher commented 3 years ago

@itavero I think I finally got it ... sorry for the late response. In addition of further testing of the valves (I got 4 of them). Setting one up for heating on a specific temp with the Home-app at least two of them are also getting the same settings. But when I set the temp with Zigbee2MQTT web-interface behavior is as aspected.

{
   "date_code":"",
   "definition":{
      "description":"Radiator valve with thermostat",
      "exposes":[
         {
            "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"
         },
         {
            "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"
         },
         {
            "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,
                  "name":"state",
                  "property":"valve_detection",
                  "type":"binary",
                  "value_off":"OFF",
                  "value_on":"ON",
                  "value_toggle":"TOGGLE"
               }
            ],
            "type":"switch"
         },
         {
            "access":1,
            "description":"Position",
            "name":"position",
            "property":"position",
            "type":"numeric",
            "unit":"%"
         },
         {
            "features":[
               {
                  "access":3,
                  "description":"Temperature setpoint",
                  "name":"current_heating_setpoint",
                  "property":"current_heating_setpoint",
                  "type":"numeric",
                  "unit":"°C",
                  "value_max":35,
                  "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":[
                     "heat",
                     "auto",
                     "off"
                  ]
               },
               {
                  "access":1,
                  "description":"The current running state",
                  "name":"running_state",
                  "property":"running_state",
                  "type":"enum",
                  "values":[
                     "idle",
                     "heat"
                  ]
               },
               {
                  "access":3,
                  "description":"Offset to be used in the local_temperature",
                  "name":"local_temperature_calibration",
                  "property":"local_temperature_calibration",
                  "type":"numeric",
                  "unit":"°C"
               },
               {
                  "access":3,
                  "description":"Away mode",
                  "name":"away_mode",
                  "property":"away_mode",
                  "type":"binary",
                  "value_off":"OFF",
                  "value_on":"ON"
               },
               {
                  "access":3,
                  "description":"Mode of this device (similar to system_mode)",
                  "name":"preset",
                  "property":"preset",
                  "type":"enum",
                  "values":[
                     "schedule",
                     "manual",
                     "boost",
                     "complex",
                     "comfort",
                     "eco"
                  ]
               }
            ],
            "type":"climate"
         },
         {
            "features":[
               {
                  "access":3,
                  "description":"Enable/disable auto lock",
                  "name":"state",
                  "property":"auto_lock",
                  "type":"binary",
                  "value_off":"MANUAL",
                  "value_on":"AUTO"
               }
            ],
            "type":"switch"
         },
         {
            "features":[
               {
                  "access":3,
                  "description":"Enable/disable away mode",
                  "name":"state",
                  "property":"away_mode",
                  "type":"binary",
                  "value_off":"OFF",
                  "value_on":"ON"
               }
            ],
            "type":"switch"
         },
         {
            "access":3,
            "description":"Away preset days",
            "name":"away_preset_days",
            "property":"away_preset_days",
            "type":"numeric"
         },
         {
            "access":3,
            "description":"Boost time",
            "name":"boost_time",
            "property":"boost_time",
            "type":"numeric",
            "unit":"s"
         },
         {
            "access":3,
            "description":"Comfort temperature",
            "name":"comfort_temperature",
            "property":"comfort_temperature",
            "type":"numeric",
            "unit":"°C"
         },
         {
            "access":3,
            "description":"Eco temperature",
            "name":"eco_temperature",
            "property":"eco_temperature",
            "type":"numeric",
            "unit":"°C"
         },
         {
            "access":3,
            "description":"Force the valve position",
            "name":"force",
            "property":"force",
            "type":"enum",
            "values":[
               "normal",
               "open",
               "close"
            ]
         },
         {
            "access":3,
            "description":"Maximum temperature",
            "name":"max_temperature",
            "property":"max_temperature",
            "type":"numeric",
            "unit":"°C"
         },
         {
            "access":3,
            "description":"Minimum temperature",
            "name":"min_temperature",
            "property":"min_temperature",
            "type":"numeric",
            "unit":"°C"
         },
         {
            "access":3,
            "description":"Week format user for schedule",
            "name":"week",
            "property":"week",
            "type":"enum",
            "values":[
               "5+2",
               "6+1",
               "7"
            ]
         },
         {
            "access":3,
            "description":"Away preset temperature",
            "name":"away_preset_temperature",
            "property":"away_preset_temperature",
            "type":"numeric",
            "unit":"°C"
         },
         {
            "access":1,
            "description":"Link quality (signal strength)",
            "name":"linkquality",
            "property":"linkquality",
            "type":"numeric",
            "unit":"lqi",
            "value_max":255,
            "value_min":0
         }
      ],
      "model":"TS0601_thermostat",
      "supports_ota":true,
      "vendor":"TuYa"
   },
   "endpoints":{
      "1":{
         "bindings":[

         ],
         "clusters":{
            "input":[
               "genBasic",
               "genGroups",
               "genScenes",
               "manuSpecificTuya"
            ],
            "output":[
               "genOta",
               "genTime"
            ]
         },
         "configured_reportings":[

         ]
      }
   },
   "friendly_name":"radiator Lieke",
   "ieee_address":"0x847127fffe11dc50",
   "interview_completed":true,
   "interviewing":false,
   "model_id":"TS0601",
   "network_address":11042,
   "power_source":"Battery",
   "supported":true,
   "type":"EndDevice"
}
itavero commented 3 years ago

Now I see what the issue is. The device has multiple "switches" to configure different parts of the devices. I would not expect it to expose these like this, as there isn't really anything unique about them (other than the property).

I have to think about how to map this without breaking the "real" switch devices (i.e. the smart outlets). Probably have to check if there are multiple switches within a single endpoint that would result into the same service identifier and then adjust the service identifier to take the property into account.

As a workaround until I have come up with a proper solution to deal with this, you can add these properties to the excluded_keys for the device in the configuration (check the docs on the website for an example). Something like:

{
   "platform": "zigbee2mqtt",
   "mqtt": {
        /* ... */
   },
   "devices": [
      {
         "id": "0x847127fffe11dc50",
         "excluded_keys": [
            "window_detection",
            "valve_detection",
            "away_mode",
            "auto_lock"
         ]
      }
   ]
}

That way they should not show up in HomeKit and these different "switches" should at least not mess with each other.

itavero commented 3 years ago

By the way: if I look at the Exposes docs of Zigbee2MQTT, I do wonder if this was implemented correctly.

stale[bot] commented 3 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!