andreytse
(Andreytse)
1
Is it possible to use for initial state state of binary sensor (or switch state) or only true or false is accepteble?
alias: Togle switch Automation
description: ''
initial_state: binary_sensor.my_sensor_state2 # or switch.my_switch or only true
trigger:
- platform: state
entity_id: binary_sensor.my_sensor_state
condition: []
action:
- service: switch.toggle
target:
entity_id: switch.my_switch
mode: single
tom_l
2
Welcome to the forum. Good job on formatting your first post
No, sorry that is not possible. true
or false
only.
EDIT:
You can use the sate of binary_sensor.my_sensor_state2
in a condition to determine if the actions run or not.
andreytse
(Andreytse)
3
Sorry for that. I am newbie
But how its possible in automation to switch on or off depending of switch state? something like this:
alias: notTogle switch Automation
description: ''
trigger:
- platform: state
entity_id: binary_sensor.my_sensor_state
condition: []
action:
- service: switch.turn_on
target:
entity_id: switch.my_switch
- service: switch.turn_off
target:
entity_id: switch.my_switch
mode: single
tom_l
4
No need to apologise. I was complimenting you on a job well done (I saw the intitial attempt with the asterisks, that was creative ).
Something like this:
alias: notTogle switch Automation
description: ''
trigger:
- platform: state
entity_id: binary_sensor.my_sensor_state
condition: []
action:
- service: >
switch.turn_{{ trigger.to_state.state }}
target:
entity_id: switch.my_switch
mode: single
andreytse
(Andreytse)
5
Its works!
Thank you very much!!!