mdeweerd / zha-toolkit

🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant
GNU General Public License v3.0
202 stars 31 forks source link

Setting a different report interval to my thermostat via ZHA toolkit didn’t work #204

Closed ars4l4n closed 1 year ago

ars4l4n commented 1 year ago

I tried setting a different report interval via using a ZHA toolkit service I copied what the guy in a forum thread did except changing the IEEE to the entity ID of my own temperature sensor and put my thermostat to pairing mode next to my coordinator right after

service: zha_toolkit.execute
data:
  ieee: sensor.principal_temperature
  command: conf_report
  endpoint: 1
  cluster: 0x402
  attribute: 0
  min_interval: 5
  max_interval: 300
  reportable_change: 10
  tries: 20
  event_done: zha_done

I'm getting the error

This error originated from a custom integration.

Logger: zigpy_deconz.api
Source: custom_components/zha_toolkit/zcl_attr.py:275
Integration: 🧰 ZHA Toolkit (documentation, issues)
First occurred: 4:41:35 PM (4 occurrences)
Last logged: 4:43:25 PM

No response to 'Command.aps_data_request' command with seq id '0x2f'
No response to 'Command.aps_data_request' command with seq id '0x5d'
No response to 'Command.aps_data_request' command with seq id '0x93'
No response to 'Command.aps_data_request' command with seq id '0xb6'

The zha_done event looks like this:

event_type: zha_done
data:
  zha_toolkit_version: v1.0.0
  zigpy_version: 0.57.1
  zigpy_rf_version: 0.21.1
  ieee_org: sensor.ewelink_th01_2d256b22_temperature
  ieee: 00:12:4b:00:22:6b:25:2d
  command: conf_report
  command_data: null
  start_time: "2023-09-29T10:30:21.195407+00:00"
  errors: []
  params:
    endpoint_id: 1
    cluster_id: 1026
    attr_id: 0
    min_interval: 60
    max_interval: 600
    reportable_change: 10
    dir: 0
    tries: 20
    expect_reply: true
    args: []
    event_done: zha_done
    read_before_write: true
    read_after_write: true
  success: false
origin: LOCAL
time_fired: "2023-09-29T10:33:44.946902+00:00"
context:
  id: 01HBG80RQJE4VPQ42P9YHTY8V1
  parent_id: null
  user_id: null

and the reporting interval doesn't change

What should I do now?

MattWestb commented 1 year ago

Is it one "real zigbee" thermostat or one tuya MCU one ?

ars4l4n commented 1 year ago

I don't know what Tuya MCU is but my thermostat (actually the SONOFF SNZB-02 temperature sensor https://sonoff.tech/product/gateway-and-sensors/snzb-02/ which I falsely called thermostat) supports Zigbee, I've paired it with ZHA before that as well Hope that answered your question

mdeweerd commented 1 year ago

The TH01 is a temperature sensor, not a thermostat but it can be integrated as the temperature source in a generic thermostat. I use them with electrical heaters and zigbee relays like that.

The TH01 easily requires over 100 retries. Pressing the button to wake them up is not solution because the button disconnects them from the zigbee network.

So I set the number of retries to 250, leave it running and at some point the temperature will be reported and then the command will likely pass.

Also you could heat the sensor after initiating the procedure so that it would report temperatures more often which makes it more likely to also set the report configuration.

ars4l4n commented 1 year ago

The TH01 is a temperature sensor, not a thermostat but it can be integrated as the temperature source in a generic thermostat. I use them with electrical heaters and zigbee relays like that.

The TH01 easily requires over 100 retries. Pressing the button to wake them up is not solution because the button disconnects them from the zigbee network.

So I set the number of retries to 250, leave it running and at some point the temperature will be reported and then the command will likely pass.

Also you could heat the sensor after initiating the procedure so that it would report temperatures more often which makes it more likely to also set the report configuration.

okay I'll try I put it into pairing mode because the ZHA Toolkit documentation told me to do so and it's how the same operation worked on z2m But perhaps it was a misunderstanding and you just meant a short press?

"This example configures Temperature reporting on a SonOff SNZB-02 (eWeLink/TH01). Note that you (may) need to press the button on the thermometer just after requesting the command (it's a sleepy device and does not wake up often)."

worked quickly with a short press but it doesn't report faster yet. I expected reportings every 60s but it's still just every 5 minutes. What am I doing wrong? response:

event_type: zha_done
data:
  zha_toolkit_version: v1.0.0
  zigpy_version: 0.57.1
  zigpy_rf_version: 0.21.1
  ieee_org: sensor.schlafzimmer_temperatur_feuchtigkeit_temperature
  ieee: 00:12:4b:00:22:6b:25:2d
  command: conf_report
  command_data: null
  start_time: "2023-09-29T17:23:54.636858+00:00"
  errors: []
  params:
    endpoint_id: 1
    cluster_id: 1026
    attr_id: 0
    min_interval: 60
    max_interval: 600
    reportable_change: 10
    dir: 0
    tries: 250
    expect_reply: true
    args: []
    event_done: zha_done
    read_before_write: true
    read_after_write: true
  success: true
  result_conf:
    - - status: 0
        direction: null
        attrid: null
origin: LOCAL
time_fired: "2023-09-29T17:25:45.433323+00:00"
context:
  id: 01HBGZK5TS0WVRY5E70GZ27W3A
  parent_id: null
  user_id: null
mdeweerd commented 1 year ago

"This example configures Temperature reporting on a SonOff SNZB-02 (eWeLink/TH01). Note that you (may) need to press the button on the thermometer just after requesting the command (it's a sleepy device and does not wake up often)."

I see that this is incorrectly suggesting to press the button fo the TH01 because that sensor disconnects from the network in my experience when you press the button. Some sensors will report when you press the button.

For sensors that "wake up" on the press of the button, this will help, but when the button gets the device removed from the network it does not help and one should not press the button.

    min_interval: 60
    max_interval: 600
    reportable_change: 10

sets the maximum delay at 10 minutes and the minimum delay at 1 minute. It will report a change of 0.10°C between 1 and 10 minutes after the previous report, and report something 10 minutes at most after the last report.

Additionally you can use zha_toolkit.conf_report_read to read the actual report configuration to verify that the configuration did get programmed in the device.

In my experience the TH01 checks the temperature every 20s at the shortest delay.

As the Developer Tools>Services now give the response, it seems interestnig to report the number of tries that were actually needed.

This is what I got back from a conf_read request on one of my devices (my version is called 'dev', but it's the same as the released one - I selected the battery entity name, but that does not matter as the resulting IEEE address is important and the selected cluster):

zha_toolkit_version: dev
zigpy_version: 0.57.1
zigpy_rf_version: 0.36.3
ieee_org: sensor.ewelink_th01_battery
ieee: 00:12:4b:00:25:02:xx:xx
command: conf_report_read
command_data: null
start_time: "2023-09-29T20:13:13.390540+00:00"
errors: []
params:
  cluster_id: 1026
  attr_id: 0
  dir: 0
  tries: 250
  expect_reply: true
  args: []
  read_before_write: true
  read_after_write: true
success: true
result_conf:
  - cluster: Temperature Measurement
    cluster_id: "0x0402"
    ep: 1
    attr_id: "0x0000"
    direction: 0
    status: 0
    type: "0x29"
    min_interval:
      - 19
    max_interval:
      - 300
    attr: measured_value

Possibly I set the reportable change to 0, or it is missing from the report and then this would better be added to the response. But at least I get to verify the intervals.

ars4l4n commented 1 year ago

I need to correct myself The report intervals are as I intended between 1 and 10 minutes but when I checked on them by hovering my mouse on the small graph of the temperature sensor on the Z2M interface it (almost) only showed 5 minute increments. When I clicked "Show More" to see the large graph the increments were displayed correctly ty for your help

ars4l4n commented 1 year ago

solved