So a few days ago I noticed that some piece of packaging was stuck in the freezer door which prevented it from fully closing. It would usually beep in that case but it was only a tiny bit open.
Just want to share how that looked like, YFMV (your freezer may vary).
I have a Shelly Plug-S on that fridge to measure the energy consumption so I checked the history:
Pretty easy to see when the problem started! So an automation to the rescue which alerts my mobile if that happens again, something like that:
alias: kitchen_fridge_open
description: "Notify if power-consumption is high for too long"
trigger:
- platform: numeric_state
entity_id: sensor.kitchen_shelly_plug_fridge_current_consumption
for:
hours: 2
minutes: 0
seconds: 0
above: 50
condition: []
action:
- service: notify.mobile_app_oneplus
data:
message: The fridge or freezer in the kitchen is probably open!
mode: single
You should know that the for option, in your automationās Numeric State Trigger, is reset whenever you restart Home Assistant or merely execute Reload Automations (which occurs transparently whenever you click the Automation Editorās āSaveā button).
Your for option is set to 2 hours. Letās say it has already triggered when the temperature increased above 50 and 1 hour has already elapsed ā¦ and then Reload Automations is executed. Its countdown will be reset (i.e. the 1 hour that elapsed is lost).
This may change in the future. Thereās a pending improvement that will make Reload Automations only reload new/modified automations, not existing/unmodified automations. Until itās implemented, you should be aware of this potential vulnerability.
Is there any way around this?
It would mostly still be useful as I donāt reload the config 24x7 so it would still catch the open door, only a bit later maybe. But itās not very niceā¦
You donāt have to āreload the configā to make it happen. All you need to do is make one change in an automation with the Automation Editor and click Save. Thatās sufficient to terminate all automations that are in-progress (like a for option that is in the process of counting down the time).
Currently, thereās no simple workaround to protect the for option from this vulnerability other than to minimize the amount of time it counts (if feasible). For example, if you reduced it from 2 hours to 30 minutes, you have reduced its chance of it being terminated by a reload.
I would use a timer helper with restore set to true. I have a similar automation based on temperature though. I had a conversation within the last week about this scenario(leaving a fridge or freezer open) and an alert is definitely a worthwhile addition. The person I was talking to lost a LOT of food.
I noticed you arenāt doing an alert in case it ISNāT running for a prolonged period. You may regret that choice if the compressor motor goes out. Consider that as an improvement.
A timer helper could work. But probably with a set of shorter timers: if I set a timer to 2 hrs as soon as the generator starts it might as well have stopped and started again after 2 hrs and give a false alarm. Itās not regular enough.
But I could use multiple steps with e.g. 15 minute timers that increase a counter each time they find the compressor is running. If it hits 8 that would be the trigger to notify. Just a thought, not sure if this would be feasibleā¦
And thanks for the suggestions to notify on āisnāt runningā. I forgot about that
Probably a good idea. I have a few things implemented as a python-script as it proved too complicated to do in jinja so that shouldnāt be a problem. Thx!
I put one of those cheap BLE temperature + humidity sensors in both my freezer and my fridge and set alarms on HA for when the temperature is outside an expected rangeā¦ I could find a couple of times where the door was left openā¦
And the Bluetooth signal can go thru the metal walls pretty fine in my case.
Those are used frequently by others I know. I believe inkbird and Govee. Some people are even flashing custom firmware on them. I opted for outdoor weather sensors. The important thing is getting a sensor that can handle the cold. Iāve found the ones that use coin cells are far less reliable. I believe the coin cells themselves are the weak point so I only get AAA or AA sensors for freezers.
Iām using Govee sensors. Iāve two different models just because when I bought those I wanna play with the different models, but both are working just fine, with the one purely BLE having a bit more stable connection compared to the one Wi-Fi + BLE.
The freezer and the fridge are side by side, with the freezer in the far side (1m more) compared to my RPi where Home Assistant is running, with a couple of rooms in the between.
Iām messing around with power monitoring on ours in addition to temperature monitoring. I was able to catch unusual activity. The freezer was running for much longer then usual even though I didnāt get a temperature alert. Possibly a faulty seal.
Is there any particular reason why you chose to pause instead of cancel the timer?
Looking at the for optionās behavior:
If the temperature were to decrease below 0 it would serve to stop (and reset) the for optionās countdown. It wouldnāt pause it because it never resumes its previous countdown.
alias: kitchen_fridge_open
description: "Notify if power-consumption is high for too long"
trigger:
- id: above
platform: numeric_state
entity_id: sensor.kitchen_shelly_plug_fridge_current_consumption
above: 50
- id: below
platform: numeric_state
entity_id: sensor.kitchen_shelly_plug_fridge_current_consumption
below: 50
- id: finished
platform: event
event_type: timer.finished
event_data:
entity_id: timer.kitchen_fridge
condition: []
action:
- choose:
- conditions: '{{ trigger.id == 'finished' }}'
sequence:
- service: notify.mobile_app_oneplus
data:
message: The fridge or freezer in the kitchen is probably open!
- conditions: '{{ trigger.id == 'above' }}'
sequence:
- service: timer.start
target:
entity_id: timer.kitchen_fridge
data:
duration: "02:00:00"
- conditions: '{{ trigger.id == 'below' }}'
sequence:
- service: timer.cancel
target:
entity_id: timer.kitchen_fridge
default: []
mode: single
I believe thereās a pending enhancement to Home Assistant that will ensure a Reload Automations only acts on new/modified automations and not unmodified/in-progress automations. That means an automation with a trigger employing for will not be reset by Reload Automations (but it will continue to be reset by a restart).
EDIT
The PR is implemented in the next release: 2022.11.0. Therefore the for option will be immune to Reload Automations (but not a restart). Use the timer-based example only if you want to also make the automation immune to restarts.
You could also put the temperature sensor near the outside radiator. This way you avoid all the environmental problems and lack of power supply and you are still able to tell very accurately if the compressor is running or not.
The freezer was doing a great job keeping the temperature steady but the compressor was running constantly. Iāve been considering the possibility there is a bubble in the coolant. Itās back to normal.