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

Ubisys S2 (also applies to S1) #117

Closed jhm47 closed 3 years ago

jhm47 commented 3 years ago

Device description I'd like to have the Ubisys S2 switch supported. It is a mains-powered, wall mounted, two-channel switch for loads, e.g. lights. Same goes for the S1 (difference: s2 is two channel, s1 is one channel, they produce the same error message) Manufacturer website

Supported in Zigbee2MQTT? The device is supported in Zigbee2MQTT. Same goes for S1. Interestingly the Ubisys D1 works flawlessly. I am on the latest dev version, but I assume support for these has been around a while.

Device model / Exposes information

{
    "date_code": "20191127-DE-FB0",
    "definition": {
      "description": "Power switch S2",
      "exposes": [
        {
          "endpoint": "l1",
          "features": [
            {
              "access": 7,
              "description": "On/off state of the switch",
              "endpoint": "l1",
              "name": "state",
              "property": "state_l1",
              "type": "binary",
              "value_off": "OFF",
              "value_on": "ON",
              "value_toggle": "TOGGLE"
            }
          ],
          "type": "switch"
        },
        {
          "endpoint": "l2",
          "features": [
            {
              "access": 7,
              "description": "On/off state of the switch",
              "endpoint": "l2",
              "name": "state",
              "property": "state_l2",
              "type": "binary",
              "value_off": "OFF",
              "value_on": "ON",
              "value_toggle": "TOGGLE"
            }
          ],
          "type": "switch"
        },
        {
          "access": 5,
          "description": "Instantaneous measured power",
          "endpoint": "meter",
          "name": "power",
          "property": "power",
          "type": "numeric",
          "unit": "W"
        },
        {
          "access": 1,
          "description": "Triggered action (e.g. a button click)",
          "name": "action",
          "property": "action",
          "type": "enum",
          "values": [
            "toggle_s1",
            "toggle_s2",
            "on_s1",
            "on_s2",
            "off_s1",
            "off_s2",
            "recall_*_s1",
            "recal_*_s2",
            "brightness_move_up_s1",
            "brightness_move_up_s2",
            "brightness_move_down_s1",
            "brightness_move_down_s2",
            "brightness_stop_s1",
            "brightness_stop_s2"
          ]
        },
        {
          "access": 1,
          "description": "Link quality (signal strength)",
          "name": "linkquality",
          "property": "linkquality",
          "type": "numeric",
          "unit": "lqi",
          "value_max": 255,
          "value_min": 0
        }
      ],
      "model": "S2",
      "supports_ota": true,
      "vendor": "Ubisys"
    },
    "endpoints": {
      "1": {
        "bindings": [
          {
            "cluster": "genOnOff",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b7788c",
              "type": "endpoint"
            }
          }
        ],
        "clusters": {
          "input": [
            "genBasic",
            "genIdentify",
            "genGroups",
            "genScenes",
            "genOnOff"
          ],
          "output": []
        },
        "configured_reportings": [
          {
            "attribute": "onOff",
            "cluster": "genOnOff",
            "maximum_report_interval": 300,
            "minimum_report_interval": 0,
            "reportable_change": 0
          }
        ]
      },
      "2": {
        "bindings": [
          {
            "cluster": "genOnOff",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b7788c",
              "type": "endpoint"
            }
          }
        ],
        "clusters": {
          "input": [
            "genBasic",
            "genIdentify",
            "genGroups",
            "genScenes",
            "genOnOff"
          ],
          "output": []
        },
        "configured_reportings": [
          {
            "attribute": "onOff",
            "cluster": "genOnOff",
            "maximum_report_interval": 300,
            "minimum_report_interval": 0,
            "reportable_change": 0
          }
        ]
      },
      "3": {
        "bindings": [
          {
            "cluster": "genOnOff",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x001fee00000058d9",
              "type": "endpoint"
            }
          }
        ],
        "clusters": {
          "input": [
            "genBasic",
            "genIdentify"
          ],
          "output": [
            "genScenes",
            "genOnOff",
            "genLevelCtrl"
          ]
        },
        "configured_reportings": []
      },
      "4": {
        "bindings": [
          {
            "cluster": "genOnOff",
            "target": {
              "endpoint": 2,
              "ieee_address": "0x001fee00000058d9",
              "type": "endpoint"
            }
          }
        ],
        "clusters": {
          "input": [
            "genBasic",
            "genIdentify"
          ],
          "output": [
            "genScenes",
            "genOnOff",
            "genLevelCtrl"
          ]
        },
        "configured_reportings": []
      },
      "5": {
        "bindings": [
          {
            "cluster": "seMetering",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b7788c",
              "type": "endpoint"
            }
          }
        ],
        "clusters": {
          "input": [
            "genBasic",
            "seMetering",
            "haElectricalMeasurement"
          ],
          "output": []
        },
        "configured_reportings": [
          {
            "attribute": "instantaneousDemand",
            "cluster": "seMetering",
            "maximum_report_interval": 3600,
            "minimum_report_interval": 5,
            "reportable_change": 1
          }
        ]
      },
      "200": {
        "bindings": [],
        "clusters": {
          "input": [],
          "output": []
        },
        "configured_reportings": []
      },
      "232": {
        "bindings": [],
        "clusters": {
          "input": [
            "genBasic",
            "genCommissioning",
            "manuSpecificUbisysDeviceSetup"
          ],
          "output": [
            "genIdentify",
            "genOta"
          ]
        },
        "configured_reportings": []
      },
      "242": {
        "bindings": [],
        "clusters": {
          "input": [
            "greenPower"
          ],
          "output": [
            "greenPower"
          ]
        },
        "configured_reportings": []
      }
    },
    "friendly_name": "KuecheWand",
    "ieee_address": "0x001fee00000058d9",
    "interview_completed": true,
    "interviewing": false,
    "model_id": "S2 (5502)",
    "network_address": 38227,
    "power_source": "Mains (single phase)",
    "supported": true,
    "type": "Router"
  }

Missing features/functionality This device is currently not exposed at all, as it throws an error at start up

[3/20/2021, 10:17:03 PM] [zigbee2mqtt] Failed to setup stateless programmable switch for accessory KuecheWand from expose "{"access":1,"description":"Triggered action (e.g. a button click)","name":"action","property":"action","type":"enum","values":["toggle_s1","toggle_s2","on_s1","on_s2","off_s1","off_s2","recall_*_s1","recal_*_s2","brightness_move_up_s1","brightness_move_up_s2","brightness_move_down_s1","brightness_move_down_s2","brightness_stop_s1","brightness_stop_s2"]}", error: Error: Device found with a wildcard in the exposed possible values for the action, which cannot be mapped: recall_*_s1

Expected functionality: a simple lamp on/off (homekit Lightbulb)

I guess the problem stems from the "recall_*_s1" attribute, which I dont think is needed and can be ignored

Suggested services and characteristics For end points l1 and l2, I would expect a homekit Lightbulb

itavero commented 3 years ago

As it's a switch, it should show up as a Switch in HomeKit (which is also what the plugin website indicates). This Switch service can be configured in HomeKit to be interpreted as a light, if that is what you have connected to it.

The error you are seeing is because it also exposes an action, but it contains wildcard values which the plugin can't handle. This should however not influence the creation of the Switch service, but only means that it will not have a Stateless Programmable Switch service to expose the action enum to HomeKit.

If you also want to stateless programmable switch to be present you can either add the wildcard values to the ignore list in the of the homebridge-z2m plugin (see this page for some more info), or you can figure out all the valid values and open a PR for Koenkk/zigbee-herdsman-converters to improve the exposes information.

I'll try to create a unit test from the information you've provided, if you are sure that the Switch services are not being exposed.

itavero commented 3 years ago

I've just added some automated tests and as far as I can tell, two Switch services are being created for this device, as I would expect based on the exposes information you've shared.

Can you please provide the entire log of the startup of Homebridge (with the debug option) enabled?

jhm47 commented 3 years ago

Thanks a lot!

I have now deleted all services in HomeKit and set it up again ... and now it shows the switch!

(I dont know what happened -- I don't think overlooked it the first time -- but no guarantee).

Thanks anyways ... it now works!