Zigbee Freezer Monitor

I’m in the process of switching from using Xbees to esp32-C6s. So, this is the first project built on the esp platform.

The goal was to monitor 4 freezers that sit side by side and get alerts if one was to fail and to do this using Zigbee.

There were a few things that took a bit to get right. First, we can’t guarantee that the sensors are found in the same order on every boot, so we need to save the address and associated end point to flash. I am also giving one of these to my father, so I wanted to be able to swap out a ds18b20 if it failed without re-flashing the esp. The device accomplishes this by searching for available sensors, assigning them to endpoints and saving the results to flash. If a sensor is not found on boot, its record is erased and if there is a new sensor, replaced with that address.

Also, I wanted to ensure that if the circuit powering the freezers failed and since this is plugged into a phone charger and not battery powered, that I would get an alert before ZHA marked the device as unavailable. To that end, we have a binary heart beat sensor. The device flips the state every 30 seconds so that we can use the last changed in an automation.

Github Repo: prairiesnpr/esp_zha_freezer_mon (github.com)

Example Automation:

alias: Notify if freezer fails
id: 9650f049-dc99-43de-a3fb-e2c17ba2f96a
trigger:
  - platform: template
    value_template: >-
      {{ (now() -
      states.binary_sensor.isilentllc_freezer_monitor_binary_input_2.last_changed).seconds
      > 300 }}
    variables:
      reason: "no update in the last 5 minutes"
  - platform: numeric_state
    entity_id:
      - sensor.isilentllc_freezer_monitor_temperature_5
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: -5
    variables:
      reason: "temperature is {{state.state}} which is above -5° F"
action:
  - service: notify.all_ios_devices
    data_template:
      title: 'Garage Freezer Failed!'
      message: 'Garage Freezer Failed, {{reason}}.'
  - service: notify.all_android_devices
    data_template:
      title: 'Garage Freezer Failed!'
      message: 'Garage Freezer Failed, {{reason}}.'

In the ZHA UI, sorry, room temp for this screenshot.
Screenshot 2024-08-22 162339

Circuit, random minifig for scale, and yes, I ran out of 4.7kohm resistors:

2 Likes

Hi @PrairieSnpr

My experience of esp32 board has always used WiFi. As a result they can’t really be battery powered.

Can an esp32 board that uses ZigBee be battery powered?

Short answer, yes. But I obviously haven’t built one that is yet. It will depend on what you need to do, but if it’s wake up read a sensor, fire the value off and go back to deep sleep, that should be very doable. I’m researching how to build a sensor for my water meter and that may be the approach I go with. They have a pulse counter that will count while the ESP is asleep, then you can wake, read the count, send your update and then go back to sleep. Looks all pretty efficient, but will obviously take some extra work.

Please show us your water meter when you have done it.

1 Like

Could you share the bin file?

I think I still have it, you want the single or quad version?

I think I still have it, you want the single or quad version?

single please

Do you remember me?

If you can, post both versions. Maybe it will be useful someday.

Maybe someone else has the bin file for esp32c6 because the owner hasn’t responded :slight_smile:
I need to connect ds18b20 to gpio17 because I have esp32c6 seeed studio. In the project I see gpio set to “7” but in my case gpio is problematic because it is located in the middle of the module

I added the binaries here, esp_zha_freezer_mon/binaries at master · prairiesnpr/esp_zha_freezer_mon

Understand that these are built for the esp32c6 I have, yours may be different. It would be best if you set up your own dev environment.

Thank you very match. Very Very

Unfortunately, after uploading the esp does not work. Sometimes it is visible on the USB port and sometimes it is not.

Try the gpio7 version, barring that, time to set up a dev env.

Is it best to upload it to esp?
I upload through the browser but it goes very quickly

I’ve never tried it, I’d ask on the HA discord, maybe someone there has experience.

Well, if you haven’t tried it :slight_smile: you must have uploaded it to esp somehow

Of course, just uploaded it to test that it compiled correctly and would join. I use the esp vscode extension. There is a command line way, think it’s esptool.py, but pretty sure it has to be in docker or Linux.

Maybe these files are not factory files

Your repository is missing a CMakeLists file