I would like to create at an automation with a trigger of 32 degrees for my local city, to where it will send me an alert every 30 minutes until the temp goes above 32 degrees.
I think I can figure out a way to do the latter but how can I create a trigger that pulls the local temp for my area and set it to 32 degrees?
template:
trigger:
- platform: state
entity_id: weather.home
attribute: temperature
sensor:
- name: Current Temperature
state: "{{ state_attr('weather.home','temperature')|float(0) }}"
unit_of_measurement: "°F"
state_class: measurement
device_class: temperature
unique_id: my-temp-415f1b49-886b-4455-a579-e28deb46335a
Something like that.
You should be aware, that to create a notification that repeats every X minutes, instead of an automation, you should look at the alerts integration. It exists for this very use case -
You would set a binary sensor so your template sensor would now be:
template:
trigger:
- platform: state
entity_id: weather.home
attribute: temperature
sensor:
- name: Current Temperature
state: "{{ state_attr('weather.home','temperature')|float(0) }}"
unit_of_measurement: "°F"
state_class: measurement
device_class: temperature
unique_id: my-temp-415f1b49-886b-4455-a579-e28deb46335a
binary_sensor:
- name: Low Temperature
state: "{{ states('sensor.current_temperature')|float(0) <= 32 }}"
device_class: cold
unique_id: cold-alert-75053340-9aa6-45ba-b67c-a439d3c84f3f
Where do I insert this code? Do I create a new automation and then past it into the automation’s YAML?
Which of these fields do I need to customize, if any? For example, I am assuming the unique_id will need edited? Where do I input what city/state I am in so that it polls my local temp?