dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 498 forks source link

Moes YSR-ZSW not found in Phoscon (or the Domoticz DeCONZ plugin) #6724

Closed Sjonnie2018 closed 1 year ago

Sjonnie2018 commented 1 year ago

Let me start by stating I read the github recommendation and searched the issues/requests before I decided to post this topic!

Device

Screenshots

[url=https://postimg.cc/K35F18tD][img]https://i.postimg.cc/K35F18tD/Moes-YSR-ZSW-De-CONZ.jpg[/img][/url]

[url=https://postimg.cc/sMxy2yx5][img]https://i.postimg.cc/sMxy2yx5/2023-02-03-17-39.png[/img][/url]

Device is found in DeCONZ but not in Phoscon. Because of that it is not found in my DeCONZ-Domoticz plugin which I use to access the device in Domoticz.

I know it is not very polite to "link" another user in a thread but a would like to have @Smanar have a look at this.

Sorry if I broke the rules!

BabaIsYou commented 1 year ago

Hi,

As you don,t stick to the template it will be difficult, event to @Smanar to give some help.

Please stick to the templte by minimally add all the requested information and screenshots.

Sjonnie2018 commented 1 year ago

Tell me what I am missing then? I would like to honor the guidelines. I walked through the template but you obviously think I left something out. Please, enlighten me!

BabaIsYou commented 1 year ago

When you opened the issue, all was listed ... just follow the guidelines . Screenshots could been added with cut and paste directly in the issue. We need them for all clusters after the read button has been pressed.

Sjonnie2018 commented 1 year ago

image image image image image There!

BabaIsYou commented 1 year ago

Many thanks. Can you just add the screenshot that contains all the clusters (the one displayed when you click on the right grey dot) just to be sure we don't miss informations about endpoints or specifiic clusters ... Then we will certainly be in businessto help you ... ;-)

Sjonnie2018 commented 1 year ago

I assume you mean this one:

image

It is a 3 gang switch as you can see )

BabaIsYou commented 1 year ago

I assume you mean this one:

Exactly ! This adds the needed endpoint numbers.

BTW are you sure you click on "read" before this one ?

image

BabaIsYou commented 1 year ago

BTW could try with this DDF (adapted from other switches.

{
  "schema": "devcap1.schema.json",
  "manufacturername": ["_TZ3000_ygvf9xzp", "_TZ3000_ee8nrt2l", "_TZ3000_dziaict4", "_TZ3000_mh9px7cq","_TZ3000_w3c7ouru"],
  "modelid": ["TS0044", "TS0044", "TS0044", "TS0044","TS0043"],
 "product": "MOES Wireless Remote Switch",
  "sleeper": true,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_SWITCH",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0006"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "parse": {"fn": "zcl", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "awake": true,
          "parse": {
            "at": "0x0021",
            "cl": "0x0001",
            "ep": 1,
            "eval": "Item.val = Attr.val / 2;",
            "fn": "zcl"
          }
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/buttonevent"
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0021",
          "dt": "0x20",
          "min": 3600,
          "max": 86400,
          "change": "0x00000001"
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0006"
    },
    {
      "bind": "unicast",
      "src.ep": 2,
      "dst.ep": 1,
      "cl": "0x0006"
    },
    {
      "bind": "unicast",
      "src.ep": 3,
      "dst.ep": 1,
      "cl": "0x0006"
    },
    {
      "bind": "unicast",
      "src.ep": 4,
      "dst.ep": 1,
      "cl": "0x0006"
    }
  ]
}

for button_maps.json you need to change :

        "Tuya3gangMap": {
            "vendor": "Tuya",
            "doc": "3-gang remote",
            "modelids": ["_TZ3000_ee8nrt2l", "_TZ3000_ygvf9xzp", "_TZ3000_t8hzpgnd", "_TZ3000_wkai4ga5", "_TZ3000_bi6lpsew", "_TZ3400_keyjhapk", "_TYZB02_key8kk7r", "_TZ3400_keyjqthh", "_TZ3400_key8kk7r", "_TZ3000_vp6clf9d", "_TYZB02_keyjqthh", "_TZ3000_peszejy7", "_TZ3000_qzjcsmar", "_TZ3000_owgcnkrh", "_TZ3000_adkvzooy", "_TZ3000_arfwfgoa", "_TZ3000_a7ouggvs", "_TZ3000_rrjr1q0u", "_TZ3000_abci1hiu", "_TZ3000_dfgbtub0", "_TZ3000_rco1yzb1", "_TZ3000_gbm10jnj", "_TZ3000_5e235jpa", "_TZ3000_sj7jbgks", "_TZ3000_w8jwkczz", "_TZ3000_dziaict4", "_TZ3000_famkxci2", "_TZ3000_itb0omhv", "_TZ3000_tzvbimpq", "_TZ3000_mh9px7cq"],

to :

        "Tuya3gangMap": {
            "vendor": "Tuya",
            "doc": "3-gang remote",
            "modelids": ["_TZ3000_ee8nrt2l", "_TZ3000_ygvf9xzp", "_TZ3000_t8hzpgnd", "_TZ3000_wkai4ga5", "_TZ3000_bi6lpsew", "_TZ3400_keyjhapk", "_TYZB02_key8kk7r", "_TZ3400_keyjqthh", "_TZ3400_key8kk7r", "_TZ3000_vp6clf9d", "_TYZB02_keyjqthh", "_TZ3000_peszejy7", "_TZ3000_qzjcsmar", "_TZ3000_owgcnkrh", "_TZ3000_adkvzooy", "_TZ3000_arfwfgoa", "_TZ3000_a7ouggvs", "_TZ3000_rrjr1q0u", "_TZ3000_abci1hiu", "_TZ3000_dfgbtub0", "_TZ3000_rco1yzb1", "_TZ3000_gbm10jnj", "_TZ3000_5e235jpa", "_TZ3000_sj7jbgks", "_TZ3000_w8jwkczz", "_TZ3000_dziaict4", "_TZ3000_famkxci2", "_TZ3000_itb0omhv", "_TZ3000_tzvbimpq", "_TZ3000_mh9px7cq","_TZ3000_w3c7ouru"],
Sjonnie2018 commented 1 year ago

Exactly ! This adds the needed endpoint numbers.

BTW are you sure you click on "read" before this one ?

image

Yes, I pressed read before making the screenshot. ;)

I will try to see if I can get the DDF file working. I'll let you know.

Sjonnie2018 commented 1 year ago

Hmmmm.... not so simple :|

I have DeCONZ running in a container so I am not sure where to modify the DDF. I have a persistent volume in my home folder location but I can't find out where to place the DDF. I opened DeCONZ through VNC and found the DDF editor:

image

I "think" I can past the DDF code you provided in here and save. But I am not sure where I can change the button_maps.json (couldn't find it).

These are the DeCONZ folders I have in my home folder:

image

Guidance appreciated ;)

Smanar commented 1 year ago

I "think" I can past the DDF code you provided in here and save

Nope, paste don't work in the editor.

It's your persistent folder on the capture ? If yes can you take a look in the "devices" folder, you can find inside the buttonmap file and the DDF.

Sjonnie2018 commented 1 year ago

Hi Smanar, thanks for your reply!

Unfortunately the folder is empty:

image

I am using the community container:

`services: deconz: image: deconzcommunity/deconz:stable container_name: deconz restart: always privileged: true # This is important! Without it, the deCONZ image won't be able to connect to Conbee II. ports:

Smanar commented 1 year ago

Ok so first, good new, it's the good place for DDF https://github.com/deconz-community/deconz-docker/issues/163#issuecomment-1368255052

Now bad new, IDK if it will work for button_maps.json. And as you need to restart deconz for to use it, I think you need to restart the container, so lose the modifications ...

Try to see if you can use a new button_maps.json, else we will make the PR in blind mode. Your device don't seem to have something special.

Sjonnie2018 commented 1 year ago

I "think" the button_maps.json in the device folder is not working because I can find the switches in Phoscon now but they are identified as being a one gang switch: image In DeCONZ I can see the switches but they are indicating low battery. Which is strange since the batteries are brand new and have 3.14V left: image These are th files I created (showing the content, look at the address bar for location and name): button_maps.json as provided by @BabaIsYou : image moes-ddf.json also copied from @BabaIsYou : image

Wrong place for the button_maps.json maybe? I could try but my docker host is not the fastest and "rebuilding" the network takes some time. :-S

BabaIsYou commented 1 year ago

Hi,

normal that it’s visible as a single switch in DeConz. That’s what is described in the DDF. Only one switch type sensor with button event to track the pressed button. Not sure it’s the best approach but worked with other switch that looked similar. And then seemed to fastest way to have it working 😀

Perhaps another approach would have been to create a switch sensor for each EP based on the on/off state for each.

Regarding the battery that’s why I asked you earlier about the « read » button because as the battery level is null that’s normal that it reports low level. Seems that this device reports battery level differently.

Smanar commented 1 year ago

The code showed by @BabaIsYou is just an extract, with the part to edit ^^, the complete file is here https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/button_maps.json

I think the DDF was fine (if you select the node and make "edit DDF" you will see the same) but not possible to edit the button_maps.json, and I m not skilled enought to explain you how to use dockers.

Official docker is realy better than the HA docker, try to create a complete buttonmap file, it's possible it will work.

Sjonnie2018 commented 1 year ago

Found the original file and edited the part @BabaIsYou indicated. Uploaded it to the device folder. Restarted the container and will now have to wait until the Zigbee mesh is fully populated with all devices.

I'll report back when the mesh is complete.

Sjonnie2018 commented 1 year ago

No luck! The mesh is (almost) complete but the switches are still indicated as a 1 gang switch.

I can only hope someone is able to tell me where the button_maps.json is supposed to be.

Smanar commented 1 year ago

but the switches are still indicated as a 1 gang switch

It's indicated nowhere (that you can see in phoscon depend of phoscon dev, it have nothing to see with deconz). The only difference betwen a 1 gang and a 4 gang is the second one is able to report more values.

Have you tried to pressa button to see if the button_maps is working or not ? It's visible on the "state/buttonevent" value. On domoticz or phoscon/help/API Information/sensor Else you will have error message visible with "info_l2" in deconz logs

DBG_Printf(DBG_INFO_L2, "[INFO] - No button handler for: %s%s, endpoint: 0x%02X, cluster: %s, command: %s, payload: %s, zclSeq: %u\n",

DBG_Printf(DBG_INFO_L2, "[INFO] - No button map for: %s%s, endpoint: 0x%02X, cluster: %s, command: %s, payload: %s, zclSeq: %u\n",

Mimiix commented 1 year ago

I "think" the button_maps.json in the device folder is not working because I can find the switches in Phoscon now but they are identified as being a one gang switch: image In DeCONZ I can see the switches but they are indicating low battery. Which is strange since the batteries are brand new and have 3.14V left: image These are th files I created (showing the content, look at the address bar for location and name): button_maps.json as provided by @BabaIsYou : image moes-ddf.json also copied from @BabaIsYou : image

Wrong place for the button_maps.json maybe? I could try but my docker host is not the fastest and "rebuilding" the network takes some time. :-S

Ignore phoscon. That needs to add support on its own.

Sjonnie2018 commented 1 year ago

Ignore phoscon. That needs to add support on its own.

OK, understood. But that does not resolve my issue in DeCONZ (or Domoticz for that matter).

And do you know, by any chance, where I should put the button_maps.json file when using the "official" community container?

Smanar commented 1 year ago

And do you know, by any chance, where I should put the button_maps.json file when using the "official" community container?

And if you put it in the "devices" folder in the perisistent folder ? (Need to restart deconz after) Are you sure it don't work ? You still have "null" as value in "buttonevent" ?

If you can't test it, we can make the PR in blind mode but without garanty it will work.

Sjonnie2018 commented 1 year ago

I am not entirely sure what you mean by:

¨You still have "null" as value in "buttonevent" ?¨

Could you please explain what I have to do?

Thank you!

Smanar commented 1 year ago

Take a look in the state/buttonevent value in the sensors json. It's the value used by third app. You can see it in domoticz/custom/deconz/sensors or phoscon/help/API Information/sensors

I will be away for a week, but if you can't succed, like I have said before, we can make the PR in blind mode, it's a simple switch, it the wost situation it will just not working.

Smanar commented 1 year ago

Have made the PR https://github.com/dresden-elektronik/deconz-rest-plugin/pull/6728 But just by curiosity, if you can try on your side to know if it's possible to make a custom buttonmap on docker ?

Sjonnie2018 commented 1 year ago

Hi Smanar,

Sorry for my late reply!

Is this what you are looking for?

{ "config": { "battery": 0, "on": true, "reachable": true }, "etag": "cbf8d81c1c0c893318ec4be39aec8741", "lastannounced": null, "lastseen": "2023-02-06T16:58Z", "manufacturername": "_TZ3000_w3c7ouru", "mode": 1, "modelid": "TS0043", "name": "Schakelaar-Controlroom-Wand", "state": { "buttonevent": null, "lastupdated": "none" }, "type": "ZHASwitch", "uniqueid": "a4:c1:38:c5:97:d0:2a:66-01-0006", "id": "77", "deviceclass": "sensors" }

I don't know how to make a custom button map on Docker. I could create an extra "persistent" volume if I knew which folder inside the container I need to map. I have these folders in the root of the container: image

Thanks for your continued support (and PR :) )

BabaIsYou commented 1 year ago

Is this what you are looking for?

That's it, exactly. Can you put the modified button_maps.json in the same folder that you put the DDF file ?

if "state": { "buttonevent": null, "lastupdated": "none" } continues to have a null value when you press a switch then can you get error messages from deConz UI like @smanar asked for above

Smanar commented 1 year ago

Yep the file need to be edited. And from the comment from the docker github, it seem it's the good method and can work (but not sure it's something already tested)

Sjonnie2018 commented 1 year ago

I have rebuilt my server and placed the ddf and the complete json in persistent volume under devices. Restarted DeCONZ but no luck. Should I wait for PR 6728?

Smanar commented 1 year ago

Should I wait for PR 6728?

Yes, this will be fine, the PR is small, and even not tested, 99 % of tuya switch are same, so I think it will be ok.

I m sorry, but I don't think use a custom button_maps.json is possible on docker, even on the official one.

Sjonnie2018 commented 1 year ago

I would probably not need a button_maps.json file when the MOES has been added, wouldn't you think?

One more question: should I change my container to beta releases or is the change been made in the stable version?

Thanks!

Smanar commented 1 year ago

No the PR add the DDF and edit the button_maps.json, you will just need to re-include the device if you aren't using the DDF ATM, else you will have nothing to do.

One more question: should I change my container to beta releases or is the change been made in the stable version?

IDK, I think the change will be in the next one, as it s something realy light, but I can't guess if it will be a beta or a stable.

Sjonnie2018 commented 1 year ago

OK, so I'll wait for the next release (I will change my container to the tag Latest). For now I delete the two 3 gang switches and wait for an update.

Thanks as always for your invaluable support!

github-actions[bot] commented 1 year ago

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

Sjonnie2018 commented 1 year ago

Well I just saw a commit pass by so I hope that will be included.

Smanar commented 1 year ago

Not yet, this issue will be closed when the PR will be valided.

Sjonnie2018 commented 1 year ago

I finally had the opportunity to install the switches combined with the Moes Smart dimmer 105. The dimmer works but the switches will not give the proper "signals" to DeCONZ/Domoticz. It will only register the first button press (in this case button 3) and after that only the first button registers an event in Domoticz (using the DomoticzDeCONZ plugin from a famous programmer ;-) ).

The Domoticz log shows me this:

2023-03-14 18:42:53.110 ConBee2: ### WebSocket Data : {'attr': {'id': '79', 'lastannounced': None, 'lastseen': '2023-03-14T17:42Z', 'manufacturername': '_TZ3000_w3c7ouru', 'modelid': 'TS0043', 'name': 'Schakelaar-Controlroom-Wand', 'swversion': None, 'type': 'ZHASwitch', 'uniqueid': 'a4:c1:38:c5:97:d0:2a:66-01-0006'}, 'e': 'changed', 'id': '79', 'r': 'sensors', 't': 'event', 'uniqueid': 'a4:c1:38:c5:97:d0:2a:66-01-0006'} 2023-03-14 18:43:53.158 ConBee2: ### WebSocket Data : {'attr': {'id': '79', 'lastannounced': None, 'lastseen': '2023-03-14T17:43Z', 'manufacturername': '_TZ3000_w3c7ouru', 'modelid': 'TS0043', 'name': 'Schakelaar-Controlroom-Wand', 'swversion': None, 'type': 'ZHASwitch', 'uniqueid': 'a4:c1:38:c5:97:d0:2a:66-01-0006'}, 'e': 'changed', 'id': '79', 'r': 'sensors', 't': 'event', 'uniqueid': 'a4:c1:38:c5:97:d0:2a:66-01-0006'}

And this was using the following sequence: press third button for a short time, press first button for a short time and finally press first button for a long time. I can't tell the difference from the log entries.

Maybe you can help me getting the switch to work as a switch.

Note that the switch is identified in Domoticz with the following options: B1, B2, B3, D1, D2, D3 L1, L2 ,L3. Unfortunately these options aren't registered at all.

Any help appreciated!

Mimiix commented 1 year ago

I finally had the opportunity to install the switches combined with the Moes Smart dimmer 105. The dimmer works but the switches will not give the proper "signals" to DeCONZ/Domoticz. It will only register the first button press (in this case button 3) and after that only the first button registers an event in Domoticz (using the DomoticzDeCONZ plugin from a famous programmer ;-) ).

The Domoticz log shows me this:

2023-03-14 18:42:53.110 ConBee2: ### WebSocket Data : {'attr': {'id': '79', 'lastannounced': None, 'lastseen': '2023-03-14T17:42Z', 'manufacturername': '_TZ3000_w3c7ouru', 'modelid': 'TS0043', 'name': 'Schakelaar-Controlroom-Wand', 'swversion': None, 'type': 'ZHASwitch', 'uniqueid': 'a4:c1:38:c5:97:d0:2a:66-01-0006'}, 'e': 'changed', 'id': '79', 'r': 'sensors', 't': 'event', 'uniqueid': 'a4:c1:38:c5:97:d0:2a:66-01-0006'} 2023-03-14 18:43:53.158 ConBee2: ### WebSocket Data : {'attr': {'id': '79', 'lastannounced': None, 'lastseen': '2023-03-14T17:43Z', 'manufacturername': '_TZ3000_w3c7ouru', 'modelid': 'TS0043', 'name': 'Schakelaar-Controlroom-Wand', 'swversion': None, 'type': 'ZHASwitch', 'uniqueid': 'a4:c1:38:c5:97:d0:2a:66-01-0006'}, 'e': 'changed', 'id': '79', 'r': 'sensors', 't': 'event', 'uniqueid': 'a4:c1:38:c5:97:d0:2a:66-01-0006'}

And this was using the following sequence: press third button for a short time, press first button for a short time and finally press first button for a long time. I can't tell the difference from the log entries.

Maybe you can help me getting the switch to work as a switch.

Note that the switch is identified in Domoticz with the following options: B1, B2, B3, D1, D2, D3 L1, L2 ,L3. Unfortunately these options aren't registered at all.

Any help appreciated!

Are we talking 2 different devices? If that is the case, please stay on topic.

Sjonnie2018 commented 1 year ago

No, Dennis, We are not! Please re-read my post to conclude that I referenced the Moes dimmer 105 for clarity on this subject. Apparently clarity caused confusion.

To be absolutely clear: The 3 gang switch is not (fully) recognized despite the PR Smanar (I won't "call him with an @) has subjected. I can not discern the different buttons when pressed. As such the 3 gang switch is operating as a 1 gang switch. That's how it is recognized in Phoscon although that is totally irrelevant in regards to DeCONZ REST plugin.

Thank you for responding.

Smanar commented 1 year ago

Can be a problem in the domoticz plugin. Your log is not useful because there is not the important part, the websocket return with a "buttonevent" and the value. You need to have a different value for all action. Else it mean the DDF is not working at all.

You have too edited the button_maps.json file ? It's not something easy to do on docker. The "_TZ3000_w3c7ouru" is not yet natively in this file.

Sjonnie2018 commented 1 year ago

Hi Smanar,

I added the log from Domoticz to show there is no difference in result when pressing various buttons. ;)

I have not modified the DDF because that is rather cumbersome as I use DeCONZ in a Docker container. So it might be the plugin.

Hope you're able to help me on this!

Best regards,

Sjonnie

Smanar commented 1 year ago

Edit a DDF is easier as you are using the official docker, you just need to create a file in the shared/persistent folder /opt/deconz But as I can see on the issue you have opened on their github, it's not possible to do same for the button_maps.json file, and don't update this file can explain your incomplete logs.

And to update this file, to need to replace the file inside the docker, and it's not something easy, and it's the reason for I will never use docker.

And sorry for delay, IDK why this one is not valided. Have just pinged manup.

Do you want to try to edit the button_maps.json yourself ?

Sjonnie2018 commented 1 year ago

I found a new version of Deconz. Unfortunately the response from the switches is the same.

Editing the button_maps.json is indeed impossible (or I don't know how to do that) so I will patiently wait until the image is updated.

I have been thinking to buy other 3 gang switches but they are all rather unknown in the DeCONZ universe so buying other switches is a gamble. Do you perhaps know of a brand/model that is working with DeCONZ?

TIA

Smanar commented 1 year ago

Manup have set the milestone v2.22.0-beta on the PR.

I don't understand the logic for numeration, but it 's the next milestone, so I think the next version. When the PR will be valided, this PR will be closed automatically.

Do you perhaps know of a brand/model that is working with DeCONZ?

Tuya is a problem as it's not possible to know the model you will have. But you just need to edit 2 files if your model is a new one, unfortunately just edit a simple file is a nightmare on docker. It's the only brand on my mind that make clones (but different the first version) so fastly

have been thinking to buy other 3 gang switches but they are all rather unknown in the DeCONZ universe

Wich one you want to try ?

Sjonnie2018 commented 1 year ago

I was thinking of this one: but no type/model number is published. That's why it is such a gamble (and I haven't won the lottery ;) ). So I think it's better to focus on getting my current switches working.

Smanar commented 1 year ago

That's why it is such a gamble

Lol yes , I think it can have at least 5/6 different manufacture name. Sorry for delay, but I think now it s the last one

Sjonnie2018 commented 1 year ago

When the DDF or Button_maps for this switch are not going to work I just might change my original plan (3 gang switches) to a different one (Aqara 2 gang D1 wireless switch). I have a number of the Aqara 2 gang switches and they are fully supported. Not ideal but a solution as a last resort ;)

Smanar commented 1 year ago

Badly, there is ATM no project to make the Button_maps easier to edit. DDF will be soon easier to manage, even without the GUI, but I don't see something that will help you for the buttonmap file.

Sjonnie2018 commented 1 year ago

Received deCONZ version 2.21.2 yesterday afternoon. No changes to the behaviour of the 3 gang switch. So hopefully 2.22.0 will make the 3 gang switch fully functional. :)

BabaIsYou commented 1 year ago

You can follow pull request #6728 … current milestone is 2.22.0-beta