the action will be activated on any of 2 separate triggers (i.e when the slider was moved OR state of the humidity sensor has changed) AND the condition evaluates to True, i.e humidity > slider_value.
Blockquote[quote=āAhmadK, post:21, topic:126604ā]
the action will be activated on any of 2 separate triggers (i.e when the slider was moved OR state of the humidity sensor has changed) AND the condition evaluates to True, i.e humidity > slider_value.
[/quote]
Just arrived home so can test it.
But from what you are saying the following code will work for me
trigger:
- platform: state
entitiy_id: sensor.test_humidity
condition:
- platform: template
value_template: "{{ states('sensor.test_humidity') | float > states('input_number.ensuitefanhum') | float }}"
action:
- service: fan.turn_on
entity_id: fan.ensuite_fan
Just removed the slider from the trigger as I only want it to trigger on the humidity state change.
if you remove the slider from triggers and decide to change the value, guess what happens?
I am assuming it will constanly trigger, but the condition will stop it.
Kind of a bit like my work around method where I have it triggering every 15 seconds but the condtion stops it.
Test it. And read docs, seriously.
WIll do and I have been.
Appears I miss read the orginal statement.
Removing the slider from the trigger and chaning the slider value will still work but only once the humidity state changes which will trigger the automation again with the new value.
Exactly. So remove the slider if youāre happy with it and donāt want to guess what difference it makes
doing this now.
The time_pattern method was just a dirty way and I clearly did not see the most practical method even tho it was staring me directly in the face. I knew it was there but tried to over complicate it
I have problem regarding automation with time use āforā with slider optionā¦
Automation (not working):
# Prižgi SCHRACK ventilacijo - KABINET: Äe je temperaturni senzor veÄ kot 25 stopinj
- id: '3001'
alias: SCHRACK - prižgi VENTILATOR
trigger:
# platform: numeric_state
# entity_id: sensor.schrack_t
# above: '25'
platform: template
value_template: "{{ is_state('binary_sensor.schrack_prizgi_ventilator_boolean', 'on') }}"
for:
# hours: 0
minutes: "{{ states('input_number.variable_kabinet_prizgi_schrack_ventilator_minuta') | int }}"
# seconds: 0
platform: state
to: 'on'
condition:
- condition: state
entity_id: switch.schrack_fan
state: 'off'
- condition: state
entity_id: binary_sensor.schrack_ugasni_ventilator_boolean
state: 'off'
action:
service: switch.turn_on
entity_id: switch.schrack_fan # Use the actual name of your switch here
Input_number:
# SCHRACK - Äasovni prag - prižgi
variable_kabinet_prizgi_schrack_ventilator_minuta:
name: Äasovni prag
min: 0
max: 60
step: 1
icon: mdi:timer-sand
unit_of_measurement: "min"
So what Iām doing wrong?
I also tried withouth
platform: state
to: āonā
but the result is the same (configuration test OK), but automation is not working. If I write instead of input_number static number, like 15 (for: minutes: 15), then itās working fine.
You definitely need to remove that. Assuming you did, and restarted, it should work. Are you sure input_number.variable_kabinet_prizgi_schrack_ventilator_minuta
has a valid (numeric) value?
EDIT: The configuration checker seems to be complaining about the value_template
at line 196. Assuming thatās what you showed in your post, I donāt see anything wrong with it. Are you sure itās not complaining about a different automation?
So, the input_number.variable_kabinet_prizgi_schrack_ventilator_minuta probably has correct valueā¦
Itās defined as:
# SCHRACK - Äasovni prag - prižgi
variable_kabinet_prizgi_schrack_ventilator_minuta:
name: Äasovni prag
min: 0
max: 60
step: 1
icon: mdi:timer-sand
unit_of_measurement: "min"
Also, if I comment the āminutesā sensor under for function everything is working fine.
Also, the configuration error is out if I comment platform to on stateā¦
# Prižgi SCHRACK ventilacijo - KABINET: Äe je temperaturni senzor veÄ kot 25 stopinj
- id: '3001'
alias: SCHRACK - prižgi VENTILATOR
trigger:
# platform: numeric_state
# entity_id: sensor.schrack_t
# above: '25'
platform: template
value_template: "{{ is_state('binary_sensor.schrack_prizgi_ventilator_boolean', 'on') }}"
for:
hours: 0
minutes: 15 #"{{ states('input_number.variable_kabinet_prizgi_schrack_ventilator_minuta') | int }}"
seconds: 0
# platform: state
# to: 'on'
condition:
- condition: state
entity_id: switch.schrack_fan
state: 'off'
- condition: state
entity_id: binary_sensor.schrack_ugasni_ventilator_boolean
state: 'off'
action:
service: switch.turn_on
entity_id: switch.schrack_fan # Use the actual name of your switch here
But if I use automation as this:
# Prižgi SCHRACK ventilacijo - KABINET: Äe je temperaturni senzor veÄ kot 25 stopinj
- id: '3001'
alias: SCHRACK - prižgi VENTILATOR
trigger:
# platform: numeric_state
# entity_id: sensor.schrack_t
# above: '25'
platform: template
value_template: "{{ is_state('binary_sensor.schrack_prizgi_ventilator_boolean', 'on') }}"
for:
hours: 0
minutes: "{{ states('input_number.variable_kabinet_prizgi_schrack_ventilator_minuta') | int }}"
seconds: 0
# platform: state
# to: 'on'
condition:
- condition: state
entity_id: switch.schrack_fan
state: 'off'
- condition: state
entity_id: binary_sensor.schrack_ugasni_ventilator_boolean
state: 'off'
action:
service: switch.turn_on
entity_id: switch.schrack_fan # Use the actual name of your switch here
then automation do not work (but withouth any configuration error) - trigger is not workingā¦
So probably the problem is in minutes formating, but donāt know where I make mistake?
What version of HA are you using?
Is binary_sensor.schrack_prizgi_ventilator_boolean
changing from 'off'
to 'on'
, and then staying 'on'
for the full 15 minutes?
Although what you have looks ok, and you can use a template trigger, I wonder why you donāt use a state trigger instead. E.g.:
trigger:
platform: state
entity_id: binary_sensor.schrack_prizgi_ventilator_boolean
to: 'on'
for:
minutes: "{{ states('input_number.variable_kabinet_prizgi_schrack_ventilator_minuta') | int }}"
Yes, binary_sensor is ON for 15 minutes - because automation is working with static 15 minutesā¦
Iām testing now with your code if there will be some differencesā¦ I will report in 20 minutesā¦
What do you get if you put this in the Template Editor:
{{ states('input_number.variable_kabinet_prizgi_schrack_ventilator_minuta') | int }}
Ok, thanks. Well, I canāt explain why things werenāt working for you in the first place. Thereās got to be some detail that is missing.
and WOWā¦
Now itās working with your codeā¦ GREAT JOB!
Thank you many timesā¦
Again, what you had originally (well, without the conflicting platform
entries) should have worked, too. But as long as itās working nowā¦