Having had a lot of success with a Matter device project, I started thinking about my twin probe temperature sensor. I wondered if was possible to convert from my dodgy BLE mesh to Zigbee.

My BLE Mesh wasn’t behaving itself, so perhaps going to Zigbee would help improve my radiator temp capturing.

I was against the need for pairing etc. but the BLE mesh just doesn’t work well enough. My radiator sensors already use the Nordic nRF52810 and that supports Zigbee (and Thread). Matter/Thread is great, but Zigbee is just more prevalent.

Getting Started

I dug out my trusty Nordic NRF52840 Develoment Kit and set to work.

Following this guide, https://docs.nordicsemi.com/bundle/ncs-2.8.0/page/nrf/protocols/zigbee/adding_clusters.html, I soon had a device connected to Home Assistant.

My DK connected to Home Assistant (the light in the top right says so!)

I attempted to add a second Temperature endpoint, compilation failed with this cryptic error!!

G:/ncs/v2.8.0/nrfxlib/zboss/production/include/zboss_api_af.h:269:3: note: previous declaration of 'zb_af_simple_desc_3_1_t' with type 'zb_af_simple_desc_3_1_t' {aka 'struct zb_af_simple_desc_3_1_s'}
269 | zb_af_simple_desc_ ## in_clusters_count ## _ ## out_clusters_count ## _t
| ^~~~~~

After some searching, it turns out to be a common issue. The ZBOSS Zigbee stack doesn’t like two endpoints of the same type!

Go figure.

I found this forum https://devzone.nordicsemi.com/f/nordic-q-a/97450/adding-zcl-clusters-to-application—temperature—error-with-build

I added the proposed hack and bingo, the application compiled and ran. After pairing with Home Assistant, I even got some values!

Working!

I then tried a potentiometer to simulate the NTC thermistor I use with my sensor, but the values didn’t change in Home Assistant 😦

NTC is negative temperature coefficient

Logging from the device confirmed that when the analog-to-digital inputs where grounded e.g. 0 volts, they read correctly (-191.8 degree Celsius)

The code shows both attributes are set to -191.8 Celsius

Sadly, Home Assistant just didn’t show this value.

It turns out that Zigbee doesn’t *push* these changes automatically. I restarted the Zigbee integration in Home Assistant and presto!

After more investigation, I discovered that Home Assistant polls the device every 30 seconds! If I adjust the input, the value will eventually update. Only works for one of the readings though 😦

To “Push” the values from the sensor, I need to update something called Attribute Reporting, which is a Zigbee feature.

I tried to “Reconfigure” the device using ZHA. It showed success.

When I opened the details, there was an error against the measured_value under the reporting section. This mirrored what I was seeing. It was able to read the value, but changes weren’t being reported.

I found some posts about this, but nothing really shed any light on it 😦

https://devzone.nordicsemi.com/f/nordic-q-a/49156/zigbee-attribute-reporting-not-reporting-as-configured

Other had the same questions, but answers weren’t forthcoming!

https://devzone.nordicsemi.com/f/nordic-q-a/88937/question-about-the-reporting-of-the-multi-sensor

Advertisements

Sticking with default update times

After a few hours investigating this, I came to the conclusion that attribute reporting is set up by Home Assistant. I found confirmation that the 30/900/50 configuration is hard coded within the ZHA integration.

In an effort to unblock myself, I decided to leave this for now. For a temperature sensor, in reality an update every 30 seconds is sufficient!

I found information showing that it’s possible to change the reporting setup from HA. That’s a job for another day.

Getting Two Sensors Working

Freed from stress about reporting updates, I focused on getting both Temperature Measurements working.

One measurement was certainly working, but the second measure never changed.

Both measurements didn’t update despite having the same values

I guessed this was probably related to the hack to allow Temperature Measurement endpoints.

I posted a question to Nordichttps://devzone.nordicsemi.com/f/nordic-q-a/117145/compilation-error-when-adding-two-endpoints-with-temperature-measurement-clusters

I await their reply!

Read more in Part #2 – Switching my Temperature Sensor from BLE to Zigbee (Part #2)

UPDATE

Everything is now available on Github

https://github.com/tomasmcguinness/zigbee-nrf-flow-and-return-temperature-sensor

Be sure to check out my YouTube channel.

6 responses

  1. […] Part #1, I started trying to convert my simple two probe temperature sensor from BLE to Zigbee. I got off […]

  2. […] I want my Zigbee FART sensor to run for a few months on a battery. I’d love to box it up and hide away all the wires. My […]

  3. […] Whilst I waited for the arrival of my new PCBs from Aisler.net, I continued to work on the code for my Zigbee Sensor. […]

  4. […] I continue development of my Zigbee Flow and Return temperature sensor, I’m worried about the stability of my […]

  5. […] part of my efforts to port my Zigbee Dual Temperature Sensor (FART) over to Matter, I found myself hitting the same problems with power […]

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.