Using YR as weather platform. Want to trig car heater in the morning when degrees fall below 2 C and it’s not weekend.
The automation works perfect if I go for an OR statement instead of AND so the weekday condition seems to work. But the temp condition I just can’t get to function. Wrong entity_id?
Haven’t found any good example on this so I’m lost… Please advice. =)
# begin snippet - hass config
sensor weather:
- platform: yr
monitored_conditions:
- temperature
- symbol
- precipitation
- windSpeed
- cloudiness
automation:
- alias: 'Turn on car heater at 07:30'
initial_state: True
hide_entity: False
trigger:
platform: time
after: "07:30:00"
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: 'sensor.weather_temperature'
below: '2'
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
service: homeassistant.turn_on
entity_id: switch.r01_b1
Hmmm. What happens if you only use the numeric_state condition?
Are you sure about the entity_id (sensor.weather_temperature)? I use Dark Sky and all of the entity_id’s allude to that (sensor.dark_sky_temperature).
(You prob know, but you can click the “trigger” button on an automation in the HASS UI so that you don’t need to keep tweaking times. I suspect the issue here is diagnosing the condition, not the trigger)
(also - yeah, my first recommendation was rubbish. Just looked at the conditions page and quotes are fine)
Thanks for hinting at the trigger button in the hass ui. But that seems to trigger without taking the condition into account for me. Always fires the action.
Thanks for the code, using it for my car to by changing sensors and switches! How are you making it to turn off tough, would it be possible to use a “delay” action or should I make a second automation?
I use the following delay conf - not perfect but it works in most of my use cases. Simply listens for a change on a switch, sets a delay, and when the delay runs out turns the switch off.
- alias: 'Turn off car heater after 30 min'
initial_state: True
hide_entity: True
trigger:
platform: state
entity_id: switch.r01_b16
from: 'off'
to: 'on'
for:
minutes: 30
action:
service: homeassistant.turn_off
entity_id: switch.r01_b16
It’s just a 433 MHz RF controlled outlet. Nothing fancy. I pull temperature from an online source. Could have used a local - might complement the solution going forward.