Hi
I’m new on Home Assistant and I tried by myself to learn how to make automation.
But now I have an issue that I can’t solve.
I have programme the shelly switch to fire on when the sensor temperature is below 19°C on a scheduled way.
But nothing happens when the condition is fulfilled.
Can you help ?
alias: Rika Allumage
description: ''
trigger:
- platform: template
value_template: "{% if states('sensor.temperature_XXXXXXX') | float < 19 %} true {% endif %}"
condition:
- condition: time
after: 06:00
before: 07:30
weekday:
- mon
- thu
- fri
- condition: or
conditions:
- condition: time
after: 06:00
before: '12:00'
weekday:
- tue
- condition: or
conditions:
- condition: time
after: 06:00
before: '19:30'
weekday:
- wed
- condition: or
conditions:
- condition: time
after: 08:30
before: '19:30'
weekday:
- sat
- sun
- condition: or
conditions:
- condition: time
after: '16:00'
before: '19:30'
weekday:
- mon
- tue
- thu
- fri
action:
- repeat:
sequence:
- service: switch.turn_on
target:
entity_id: switch.shelly1_XXXXXX
- delay: 00:00:02
until:
- condition: state
entity_id: switch.shelly1_XXXXXX
state: 'on'
mode: single
The conditions are messed up. All conditions on top-level are implicit AND junction. Your current definitions results in an unmatchable time slot.
Also AND and OR conditions require more than one sub-condition (makes no sense otherwise). Create a top-level OR condition and make all of your current conditions it‘s children.
Finally, user numeric_state trigger instead of template trigger, especially since your current template trigger is lacking the „false“ branch.
Hi, thanks for your help, but my sensor is a Aqara temperature sensor, and as I have checked, the temperature is on a string value, not a numeric value, that’s why I have to set a template.
At this moment (08:56), the temperature is 15.9°C and the heater is still off. The shelly is off.
I don’t understand why the switch is still off.
Another question about the trigger “time”, The trigger is set to a exact time ( ie at: 08:00) do you think the automation will be triggering after 08:00, if I modify the programmation after the trigger time ? Do I have to launch the automation manually?
Why does everyone try to make a complex script or automation for a basic thermostat when there’s a perfectly good component.
Just create a generic thermostat, then schedule the setpoint changes at given times.
Using climate entities means you can display them nicely in the frontend too, rather than an automation controlling a switch that’s hard to tell what is happening or to adjust.
just notice that you have 3 icon on your thermostat (off, fire, and schedule) what thermostat card did you set, because mine does not have the schedule icon