dresden-elektronik / deconz-rest-plugin

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

Woox R7052 Smart SOS Button #4323

Closed EarlOfBurton closed 1 year ago

EarlOfBurton commented 3 years ago

Device

Product page: https://wooxhome.com/new-c8/woox-r7052-smart-sos-button-p50

Screenshots

cluster info node_info power_info

Smanar commented 1 year ago

Your DDF seem fine, the binding is good for me. Can try with a more brutal version with replacing


        {
          "name": "config/battery",
         }

by


        {
          "name": "config/battery",
          "awake": true,
          "refresh.interval": 3600,
          "read": {
            "at": "0x0021",
            "cl": "0x0001",
            "ep": 1,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0021",
            "cl": "0x0001",
            "ep": 1,
             "eval": "Item.val = Attr.val / 2",
            "fn": "zcl"
          },
          "default": 0
        },

but remember you need some time for battery report.

EarlOfBurton commented 1 year ago

@Smanar, a battery value seems to have arrived - it took ~ 1,5 days ;) - Can it be that the percent calculation is not correct? woox

This is what deCONZ says about the battery: battery

Unfortunately there still is no trigger to select in HA as it is with other deCONZ-bound switches. Any idea how to fix this?

Kind regards.

Mimiix commented 1 year ago

@Smanar, a battery value seems to have arrived - it took ~ 1,5 days ;) - Can it be that the percent calculation is not correct? woox

This is what deCONZ says about the battery: battery

Unfortunately there still is no trigger to select in HA as it is with other deCONZ-bound switches. Any idea how to fix this?

Kind regards.

Do the events come through?

EarlOfBurton commented 1 year ago

H @Mimiix, I guess so, there are Logbook-entries that pop up when I click the button:

woox_r7052_smart_sos_button1 fired event '1002'
22:20:18 - Now
woox_r7052_smart_sos_button1 fired event '1002'
22:20:17 - Now
woox_r7052_smart_sos_button1 fired event '1002'
22:19:10 - 1 minute ago
woox_r7052_smart_sos_button1 fired event '1002'
22:19:06 - 1 minute ago

I'm not sure if the "declaration" or how you call this is right. It seems the event is a string? Maybe it should be an integer? Well, just an uneducated guess from my side...

See screenshot on the right side: woox

Mimiix commented 1 year ago

In that case , you need to ask @kane610 to add support for it on home assistant. You can already use the event though by making an automation that triggers on the event.

EarlOfBurton commented 1 year ago

Hi @Kane610 - would it be possible to add this device so that the button trigger can be used an on any other switch in automations in home assistant? Kind regards.

Mimiix commented 1 year ago

Hi @Kane610 - would it be possible to add this device so that the button trigger can be used an on any other switch in automations in home assistant? Kind regards.

You can already so this by using a event as a trigger in ha.

Nomeboj commented 1 year ago

In that case , you need to ask @Kane610 to add support for it on home assistant. You can already use the event though by making an automation that triggers on the event.

Do we need to open new request or we can ask on discord maybe? I tried with deconz event in HA to trigger and it is working fine, but maybe it would be better to have entity :-)

Regards

Smanar commented 1 year ago

Can it be that the percent calculation is not correct?

I m reading the value (so 200 on your capture) and dividing it by 2, so you can't have 0, there is something wrong You are using this modification ? https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4323#issuecomment-1284352270

On the other woox device we are using for report

      {
         "bind":"unicast",
         "src.ep":1,
         "cl":"0x0001",
         "report":[
            {
               "at":"0x0021",
               "dt":"0x20",
               "min":300,
               "max":43200,
               "change":"0x00000001"
            }
         ]
      },

Something you can try. Read the value in deconz, the attribute 0x0021. If the value is updated in the API > Bind issue Else DDF issue.

Kane610 commented 1 year ago

In that case , you need to ask @Kane610 to add support for it on home assistant. You can already use the event though by making an automation that triggers on the event.

Do we need to open new request or we can ask on discord maybe? I tried with deconz event in HA to trigger and it is working fine, but maybe it would be better to have entity :-)

Regards

Sorry this will not be possible, the events are momentary interactions not suitable for being exposed as an entity (this is why it's exposed as an event in the first place). You can probably create a template entity to achieve what you want.

EarlOfBurton commented 1 year ago

Initially I thought that DDF was for enthusiast users with some coding skills so that there is a lot of work off the deCONZ/Phoscon developers. But getting a simple device with one button not working in 60 comments, well, is very disencouriging. If dresden electronics wants us end-users to contribute, we needed a rather extensive explanation on one device. I know that one webpage about DDF, this is not enough. I think we needed a maybe ~ 1 hour video that goes through all the parameters, which formats they can have and how to save and load successfully a DDF. From "unknown" device to "fully working and implemented". Maybe DDF was meant that way and still is in Kindergarden - I don't know. Maybe someone from the developers could tell is the idea how/who DDF should be used. Still, I appreciate a lot your stamina supporting us enthusiast-users that extensive. It's a hacking project more or less, how I see it today. Since you often don't get a direct access to the manufacturers but have to reverse-engineer a lot of things, I guess?

Kind regards.

Smanar commented 1 year ago

But getting a simple device with one button not working in 60 comments

But it still not working ?

EarlOfBurton commented 1 year ago

@Smanar, yes, unfortunately it is not working for me.

I tried to go the 'event trigger' route, which would be another hack that I don't like, but since the event trigger options are extremely bad documented in Home Assistant (none of your business, I know) and lacking of examples, I can't get it working. All my other switches (Xiaomi, IKEA remote, IKEA switch, Philips Hue remote) work as expected with 'button press' triggers.

Kind regards.

Mimiix commented 1 year ago

@Kane610 Can you provide a sample perhaps?

Smanar commented 1 year ago

You mean it's possible on HA for an ikea remote but not this switch ? But they are working same on deconz side, why there is difference on HA ? I don't think it's from the plugin.

EarlOfBurton commented 1 year ago

True. I have five IKEA remotes, seven IKEA switches, one Philips hue dimmer/switch, one Xiaomi Switch and the one Woox switch. All except the Woox switch have "Trigger on buttonpress" options. I made screenshots for all "events" in Home Assistant under devices in deCONZ: ikea1 ikea2 philips aqara woox

Kind regards

Mimiix commented 1 year ago

Hi,

But it does provide events right? If that's the case deconz support is finished and correctly.

Ha is not managed in this repository. @kane610 is the developer of the integration in HA. If he says it isnt possible, it isn't.

EarlOfBurton commented 1 year ago

No happy end on this thread for a one button device after 1,8 years and ~60 comments. I liked this button beacuse of its nice SOS label which I wanted to set an alarm to emergency authorities via Internet. Getting a DDF working - until the end, which is Home Assistant in this case - has some room for improvement, it seems.

Thanks for trying, though. Kind regards & have a nice sunday.

Nomeboj commented 1 year ago

Hi.

I am adding happy end on this then :-)

Add to configuration.yaml

template:

This will create binary sensor SOS with auto off 5 seconds. So when you press SOS button, it will trigger deconz event and binary sensor will change state to on and will go to off after 5 seconds.

Regards.

Kane610 commented 1 year ago

Hi,

But it does provide events right? If that's the case deconz support is finished and correctly.

Ha is not managed in this repository. @Kane610 is the developer of the integration in HA. If he says it isnt possible, it isn't.

Sorry. I said entity is not possible. What's talked about now are device registry support which is a different thing and can be done here

Kane610 commented 1 year ago

No happy end on this thread for a one button device after 1,8 years and ~60 comments. I liked this button beacuse of its nice SOS label which I wanted to set an alarm to emergency authorities via Internet. Getting a DDF working - until the end, which is Home Assistant in this case - has some room for improvement, it seems.

Thanks for trying, though. Kind regards & have a nice sunday.

Certain aspects of the home assistant integration are specific per device and can thus not be automatically supported. I intend to start looking at the devices endpoint to start automatically generate device triggers for new devices

EarlOfBurton commented 1 year ago

@Kane610 That's great news. I finally could implement it in an automation without generating a template binary sensor like that:

- id: '1663952665245'
  alias: 'SOS-Button: Toggle Siren'
  trigger:
  - platform: event
    event_type: deconz_event
    event_data:
      id: woox_r7052_smart_sos_button1
      event: 1002
  action:
  - service: siren.turn_on
    entity_id: siren.woox_r7051_sirene1
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: siren.turn_off
    entity_id: siren.woox_r7051_sirene1
  mode: single

For the future it would be awesome to have automatically generated device triggers...

Kind regards.

Kane610 commented 1 year ago

@Kane610 That's great news. I finally could implement it in an automation without generating a template binary sensor like that:

- id: '1663952665245'
  alias: 'SOS-Button: Toggle Siren'
  trigger:
  - platform: event
    event_type: deconz_event
    event_data:
      id: woox_r7052_smart_sos_button1
      event: 1002
  action:
  - service: siren.turn_on
    entity_id: siren.woox_r7051_sirene1
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: siren.turn_off
    entity_id: siren.woox_r7051_sirene1
  mode: single

For the future it would be awesome to have automatically generated device triggers...

Kind regards.

Yes the event is really all you need. But device triggers simplifies it to the next level

EarlOfBurton commented 1 year ago

Hi! After updating to deCONZ 2.19.1 the DDF file was lost. Would it be possible to integrate the file into deCONZ? (See file attached, I had to rename it from .json to .txt because github does not allow .json)

woox_r7052_ts0215a.txt

Smanar commented 1 year ago

Oups, sorry , the PR was already submitted for me.

https://github.com/dresden-elektronik/deconz-rest-plugin/pull/6481

Nomeboj commented 1 year ago

Hi.

Can it be done for _TZ3000_zsh6uat3 also?

{ "schema": "devcap1.schema.json", "manufacturername": "_TZ3000_zsh6uat3", "modelid": "TS0215A", "vendor": "Woox", "product": "R7052 Smart SOS Button", "sleeper": true, "status": "Gold", "subdevices": [ { "type": "$TYPE_SWITCH", "restapi": "/sensors", "uuid": [ "$address.ext", "0x01", "0x0500" ], "fingerprint": { "profile": "0x0104", "device": "0x0401", "endpoint": "0x01", "in": [ "0x0000", "0x0500", "0x0501" ] }, "items": [ { "name": "attr/id" }, { "name": "attr/lastannounced" }, { "name": "attr/lastseen" }, { "name": "attr/manufacturername" }, { "name": "attr/modelid" }, { "name": "attr/name" }, { "name": "attr/swversion" }, { "name": "attr/type" }, { "name": "attr/uniqueid" }, { "name": "config/enrolled" }, { "name": "config/on" }, { "name": "config/pending" }, { "name": "config/battery", "awake": true, "refresh.interval": 3600, "read": { "at": "0x0021", "cl": "0x0001", "ep": 1, "fn": "zcl" }, "parse": { "at": "0x0021", "cl": "0x0001", "ep": 1, "eval": "Item.val = Attr.val / 2", "fn": "zcl" }, "default": 0 }, { "name": "config/reachable" }, { "name": "state/buttonevent", "awake": true, "parse": { "en" : 1, "cl": "0x0501", "cmd": "0x02", "fn": "zcl", "eval": "Item.val = 1234" } }, { "name": "state/lastupdated" }, { "name": "state/lowbattery" } ] } ], "bindings": [ { "bind": "unicast", "src.ep": 1, "cl": "0x0500" }, { "bind": "unicast", "src.ep": 1, "cl": "0x0501" }, { "bind":"unicast", "src.ep":1, "cl":"0x0001", "report":[ { "at":"0x0021", "dt":"0x20", "min":600, "max":6000, "change":"0x00000001" } ] } ] }

Smanar commented 1 year ago

It's the same device ? Just a clone ?

Take care you are using a debug value ^^ in your DDF

"eval": "Item.val = 1234"

Need to be 1002

Nomeboj commented 1 year ago

Hi

Sorry yes 1002 is correct one. I pasted tries that we performed during troubleshooting. So you can clone it.

Regards.

Smanar commented 1 year ago

Ok, have added it as clone

"manufacturername": ["_TZ3000_ssp0maqm", "_TZ3000_zsh6uat3"],
"modelid": ["TS0215A", "TS0215A"],
EarlOfBurton commented 1 year ago

Thanks a lot, @Smanar!

Nomeboj commented 1 year ago

Thanks!