Sonoff SNZB-02 Temp Sensor Reporting Interval

So I figured out how to fix this issue in ZHA, though it’s kind of not recommended since it involves sshing into the core and changing a line in the code.

The problem is the following line in the zha component of core:

Here we se that in the config for temperature Measurement a value of 50, or 0.5 degrees, is hardcoded into zha.

I have sshed into the core and changed this line by hand, afterwards you have to reconfigure or reconnect the device in ZHA, then you can enjoy the interval however you like.

I set it to 20 since it seems to give me messages when temp changes 0.1-0.2 degrees.

However this is not recommended since:

  1. don’t ever ssh into the core if you don’t know what you are doing
  2. this will probably break with every update to core.

Now what would be the next steps ?

Well imho, ZHA should do 2 Things:

  1. Add the Option to set those global Variables in configuration.yaml
  2. Add the option to set those values for each device individually inside of the zha GUI.

If someone can explain to me how to access data from configuration.yaml inside of the core code I might be able to build a PR for 1.

Can someone maybe tell me how to contact zha devs most efficently so this can be fixed asap ?

I think I understand how to pull values out of configurtion.yaml and might be able to add a PR.

2 Likes

Thanks @mikihacia! A funny thing I discovered is that my sensors seem to disable reporting for attributes whose reporting configuration is NOT updated during the same pairing cycle.

For example, if I updated the reporting configuration for temperature but not humidity I would gain reporting on temperature but lose reporting on humidity. My current workaround is to update all four attributes during the same cycle by pressing the Apply-button for each attribute in Zigbee2Mqtt and observe the response status in the gui.

Hi, i have a failure when trying to apply setting, even when device is still appairing.

Any clue?

You can submit a request at the Github site here:

Please do as I’m also interested in this being fixed properly.

1 Like

how does one even figure shit like this out

1 Like

“The secret to success is constancy to purpose” (Benjamin Disraeli).

In this case that means learning a minimum about zigbee, zigpy and/or zha-device-handlers quirks, examine existing code, test, retest, … .

Another way to configure the sensor is using zha-toolkit as I described here:

The report configuration of the sensor is only done when the device joins the network or when you ask for it. So when you configure it using the zha-toolkit it will keep the configuration (unless you repair or reinitialise (which fails in general because the device is sleepy)).
I have three sensors configured this way and they have been running for quite a while like that using the Generic thermostat.
I had to increase the minimum change on some sensors to 0.15°C because there was much noise at 0.10°C. The zigbee command had to be sent around 50 times before succeeding because the device is sleepy, but with the method described on the link above that’s not a problem.

2 Likes

Are you using with ZHA?

Yes, I am using this with ZHA (I do not know whom you adressed the question to).
‘zha-toolkit’ only works when you use zha because it relies on zigpy.

1 Like

I’m not good wth HA, how can i install zha-toolkit and how can i add my sonoff sensors like this? Because my sensor is updating sometimes each 1 hours. It’s really not good. ı want to change this.

@GroupPolicy You best install HACS first which gives you access to other components. Once that is installed, zha-toolkit is amongst the default components.

The setup instructions: GitHub - mdeweerd/zha-toolkit: 🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant .

Prerequisites | HACS may be sufficient, the documentation references a Tutorial to install HACS), and there are a few videos on how to install HACS.

Once you have HACS it is not so hard to add zha-toolkit using hacs (but you’ll need to edit configuration.yaml).

I agree that that can be a bit complex when you’re not familiar with HA and or not very technical.

1 Like

Does someone know how to adjust the sensitivity / reporting when using deconz (hardware + software)? This is what the sensor looks like via REST request:

"32": {
    "config": {
      "battery": 100,
      "offset": 0,
      "on": true,
      "reachable": true
    },
    "ep": 1,
    "etag": "some-random-number",
    "lastannounced": "2022-05-06T08:40:52Z",
    "lastseen": "2022-05-13T09:13Z",
    "manufacturername": "eWeLink",
    "modelid": "TH01",
    "name": "MH3",
    "state": {
      "lastupdated": "2022-05-13T09:11:55.011",
      "temperature": 2032
    },
    "swversion": "20211103",
    "type": "ZHATemperature",
    "uniqueid": "some-random-uid"
  },
  "33": {
    "config": {
      "battery": 100,
      "offset": 0,
      "on": true,
      "reachable": true
    },
    "ep": 1,
    "etag": "some-random-number",
    "lastannounced": "2022-05-06T08:40:52Z",
    "lastseen": "2022-05-13T09:13Z",
    "manufacturername": "eWeLink",
    "modelid": "TH01",
    "name": "MH3",
    "state": {
      "humidity": 4283,
      "lastupdated": "2022-05-13T09:13:39.783"
    },
    "swversion": "20211103",
    "type": "ZHAHumidity",
    "uniqueid": "some-random-uid"
  },

Your approach works great, thank you @mikihacia!
Regarding Min rep change I’ve found following to be true

  • temperature: 10 → 0.1C, 20 → 0.2C and so on
  • humidity: 100 → 1%, 200 → 2% and so on
  • batteryVoltage - no idea
  • batteryPercentageRemaining - no idea

I’ve spent ages looking for this data yesterday so hopefully having it here will help overs :slight_smile:

I’m getting extreme temperatur reports of ±200° occasionally since I’ve been using a reporting interval of 1m. Does anyone else get this problem too?
And do you know a possible fix? It’s messing up my homeassistant graphs

I have three of these connected via ZHA. I’ve not seen the spikes with them.

I have had occasional error spikes with other unrelated integrations. In the Developer section the Statistics tab allows you to clean up erroneous values which works ok if the errors are rare. Find the sensor name and click on the chart icon on the right of the sensor row. You need to note the approximate date and time of the figure you want to correct in order to locate it.

If the errors are only occasional this may be good enough to make your charts readable.

Dear,
I have SNZB-02 and SNZB-02D
The problem is that the battery capacity decreases very quick and I want to increase the reporting to 10 minutes.
SNZB-02 :

I have configured the SNZB-02 device as follow : 10 minutes reporting


We can see in HA, it is working as expected
image

SNZB-02D :

I have configured the SNZB-02D the same way, but reporting doesn’t respect the timing.


In HA, I can see period is not respected :

Also in M2Z Logs :

I found a faster method. Just wake up the sensor, for example by blowing into it, and then accept the changes in the Reporting tab. No need to re-pair, it works for me every time.

1 Like

Hi,

I’ve managed to change the refresh times, but only the last reporting parameter is updated, either temperature or humidity, not both.

Do you have any idea how to fix this?

See my experience here : SONOFF SNZB-02D - Binding and Reporting setting · Koenkk/zigbee2mqtt · Discussion #24229 · GitHub

I is weird, because I canno update reporting parameteres…
When I updae numbers, duplicate is created… when I want delete original … if dupliacte exist, duplicate is deleted…
if is there only original … nothing deleted…

What a nice hack!!!