Fridge Alarms

I’m completely new to HA, please be gentle!

My project monitors a number of fridges and I wish to have some alerts when any gets too warm.

I’m using ESPHome - each ESP has two DS18B20 sensors attached, and another ESP has digital inputs and outputs for a control panel. Here, there’s an Alarm LED, an audible buzzer and a Mute button.

All ESPs and their sensors are up and running and visible on the HA dashboard.

The idea is that if any fridge gets too warm for say >30 minutes then the LED lights up and the buzzer sounds. When the Mute button is pressed, the light stays on but the buzzer stops. More than one fridge might get too warm, but the buzzer doesn’t re-sound once muted. Only once all fridges are cold enough does the light go out and the buzzer is ready for the next alarm.

I achieved this once before in C++ using Blynk and so am approaching this with a “linear programming” mindset. I know this is not appropriate here.

My thinking has been to have an automation for each sensor to create an alarm condition for that sensor, and then another automation to poll the sensor automations to work the lights and buzzer, but I’m just not getting it.

What I would need would be some sort of “variable” that could store the state of each sensor’s alarm automation, for polling into the display automation. I have tried using the “last triggered” attribute without success.

I have fried my brain trying to get this working and could do with some helpful pointers. I’m not asking for free code, just a hint of the way forward…!

TIA

V

Post the ESPHome configurations so we can see what we’re working with.

Drew, thank you for your interest in my query.

The whole project consists of five - near identical - NodeMCUs (ESP8266) and one configured to drive the indicator panel. There are 6 fridges and 4 freezers, all configured the same way, though I’ll use different temperature setpoints for alarms. Fridges have one LED and freezers another, though there’s one buzzer, and one mute. Irrelevant for the moment are the call button and healthy LED.

HA is installed on a new 64GB RaspberryPi 4 with A2 class micro SD: installed via Raspberry Pi imager.

All items are on the same subnet, and, with the exception of browsing devices, have static IPs.

Below (hopefully correctly formatted) are the YAMLs for Indicator and one of the “outstations”

esphome:
  name: indicator-panel
  friendly_name: Indicator Panel

esp8266:
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "KCbypjCzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:
  password: "1894xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.68.109
    gateway: 192.168.68.1
    subnet: 255.255.255.0  

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Indicator-Panel Fallback Hotspot"
    password: "BNUwDxxxxxxxxx"


# Digital Inputs
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO 4
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Mute Button"
    filters:
      - delayed_on: 10ms

  - platform: gpio
    pin:
      number: GPIO 5
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Call Button" 
    filters:
      - delayed_on: 10ms  

# Digital Outputs
switch:
  - platform: gpio
    pin: GPIO 12
    inverted: false
    name: "Fridges LED"

  - platform: gpio
    pin: GPIO 13
    inverted: false
    name: "Freezers LED"

  - platform: gpio
    pin: GPIO 14
    inverted: false
    name: "Healthy LED"

  - platform: gpio
    pin: GPIO 15
    inverted: false
    name: "Buzzer"

captive_portal:
    446xxxxxxxxx
esphome:
  name: big-kitchen
  friendly_name: Big Kitchen

esp8266:
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "OtxcCxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:
  password: "65fexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.68.125
    gateway: 192.168.68.1
    subnet: 255.255.255.0  
  

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Big-Kitchen Fallback Hotspot"
    password: "Bgxxxxxxxxxxxx"

# Temperature Sensor Configuration
dallas:
  - pin: GPIO5

sensor:
  - platform: dallas
    address: 0x93000004BD11F428
    name: "Meat Fridge"
  - platform: dallas
    address: 0x41000004BCA34D28
    name: "Big Kitchen Fridge"


captive_portal:

Just realised that the I/O handling blocks are badly placed. I’ll fix that, but I don’t think that’s my issue.

Perhaps you have your own motivations for doing it in such a fashion, but it sounds overly complex for the goal. My application is residential, but I use aqara temperature sensors in all my fridges and freezers, and have push notifications sent (could just as easily be a tts or buzzer or whatever).

As for your goal of sound the alarm once and then reset once they are all cold again, I’d use a binary threshold sensor that is on if 1 or more alarms, and off if 0 alarms.

The you have only a single automation controlled by a single sensor, rather than trying to keep track of all your different automations.

Look into the Alert entity. Is does what you want, can notify in various ways, and can be snoozed while remaining on. I am using one exactly for the same purpose you want.