-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test variable in automation action condition #12
Comments
Sorry for the non-formatted code. Below the formatted code.
|
Does |
Yes, this line works. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I try to do a conditional action within an automation based on the (integer) value of a variable. This is the code:
- alias: sensor2 initial_state: 'on' trigger: - platform: state entity_id: binary_sensor.stair2 action: - service: automation.turn_off entity_id: automation.sensor2 - service: automation.turn_on entity_id: automation.sensorTimeout - service: variable.set_variable data: variable: stair_state value_template: '{{ 3 if (variable.state | int) == 1 else 2 }}' - condition: template value_template: '{{ (states.variable.stair_state.state | int) == 3 }}' - service: script.turn_on entity_id: script.stair_up
I'm sure the variable stair_state = 3 but the script 'stair_up' isn't called. What can be wrong?
The text was updated successfully, but these errors were encountered: