Hi, I have the followig action in one script that doesn't work as I want.
I want to test if the weekday of 'input_datetime.prato_next_time' is monday, wednesday or friday and in this case add one day to the same variable.
What is wrong?
Thanks in advance
It attempts to use the state value of input_datetime.prato_next_time without using the states() function. tom_l has identified this mistake and offered a corrected version.
It defines a variable named new_wday but makes the mistake of wrapping it in quotes 'new_wday' in the is_state() function. This makes it a string and will cause the is_state() function to fail.
The input_datetime.set_datetime action will fail with an error message if new_wday is not 1, 3, or 5. That's because the template does not produce a value for datetime if new_day is 2, 4, 6, or 7.