I’m very new to this and trying out my very first automation.
Unfortunately I cannot get it to work.
What I’m trying to achieve is, to switch on a GPIO pin on my RPi 3 B+, when the processor temperatur goes above 40c. GPIO pin will drive a npn transistor to power a small fan to cool the RPi heatsink.
This is what I have in my “automations.yaml” file for testing purposes to see at least if I get a message.
But nothing unless I manually run it.
- id: cpu_fan_on
alias: Turn of CPU fan when temp at 40c
trigger:
- platform: numeric_state
entity_id: sensor.processor_temperature
above: '40'
condition:
action:
- service: persistent_notification.create
data:
message: Your message goes here
title: Custom subject
mode: single
Btw, I do not know if this is correct or not, should above: '40' be above: 40 since platform: numeric_state ?
Those quotes are being automatedly added by the automation editor.
My RPi 3B+ processor temperature is always above 40c.
I have restarted the HS many times after automation changes.
Numeric state triggers only change when the threshold is crossed: in this case from below 40 to above 40. If you start it up already above 40, it will not trigger.
Thanks @Troon now I understand.
It worked after adding as below and cooling down the temp. below 45 and let it rise again pass 45.
- id: cpu_fan_on
alias: Turn of CPU fan when temp at 40c
trigger:
- platform: numeric_state
entity_id: sensor.processor_temperature
above: 45
below: 55
condition:
action:
- service: persistent_notification.create
data:
message: CPU fan is running
title: CPU Fan
mode: single
I now see that this way of implementing what I’m trying to achieve is not the correct way, because of the way it trigger → numeric-state works.
I need the fan to run if the temp. is above 45 at any given time. Like when I reboot the host, the cpu temp. is already around 48c (passed my range 45~55). So in this case, fan should run until it goes below 45.
Any thoughts how I could do this with HA OS?
I already tried with RPi OS and Debian buster with Supervisor installed, but those are very unstable and cpu temp. is always very high.
Any idea