Hello. Very new to Home Assistant and this is my first time posting. I hope I tagged the code properly with the back-ticks. If not, Please tell me where to find the procedure and I’ll update.
I’m trying to send an email when my temp sensor is above a certain temperature. Below is
the code which generates a “Invalid config for [notify]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 12).” error when I check it with the Configuartion
Validator. I copied the code from the SMTP integrations page. What am I missing? Thanks.
This looks like an automation. But its under notify. You need to move it to automations.yaml or add automation other: right above it so HA knows that’s the config of an automation. Feel free to change other in that to any word you want, doesn’t have to be other.
I moved that part to the Automation file which cleared up my error. Thank you for that.
My temp sensor is sitting at 76 which is above my threshold but I’m not receiving any email alerts.
I checked the Automations section in Settings and this automation is enabled. Still not receiving any emails though. When I test my email notify, I do receive an email. Thoughts? Thanks
That automation will trigger when the temperature passes through that threshold. So if it was 69 and went to 72 that would trigger it. Since it’s 76 already there is no trigger. To work around that I usually create a binary sensor to be the trigger {{ states(‘sensor.temp’)|int > 70 }}
Couple of additional considerations:
occasionally I get bad sensor readings, and getting an alarm on a bad reading is a hassle. So I’ll typically run it through the Filter - Home Assistant to remove outliers.
it may be useful the change the threshold, enable and disable from dashboard.
To make a new one for a different sensor. I just run this file though sed.
sed 's/bedroom_thermostat_temperature/studio_thermostat_temperature/g' temperature_template_package.yaml > /mnt/c/github/ha/packages/temperature_template_studio_thermostat_temperature_package.yaml
A numeric state trigger only fires when the value crosses your threshold. So in your case in order to receive an email sensor.testing_outdoor_temperature would have to be <= 70 and then go above 70. Then you wouldn’t receive another email until the sensor dropped back below 70 and crossed it again.
If you want to receive continuous notifications any time your value is above a threshold the easiest option is to use an alert rather then an automation. Create a threshold binary sensor with your sensor and your theshold and then create an alert that sends you a notification any time your binary sensor is on. See the doc for you can customize the resend interval and the message.
Another benefit is alerts can be turned off with alert.turn_off if its been on for a while and getting annoying (like if its above 70 all day and you’re tired of receive emails about it). This will stop notifiying you until the binary sensor goes off and back on again (or until you restart HA).