MikaelUlvesjo / homeassistant

1 stars 1 forks source link

Conditional logic behaves unexpected #2

Open lenhoy opened 2 weeks ago

lenhoy commented 2 weeks ago

I had the problem with the automation that it would not turn on and off at the correct times

lenhoy commented 2 weeks ago

Further investigation showed two problems

  1. In the action sequence we had a longer wait for trigger block - which blocked the next instance of the automation from running the following hour
  2. The first logic expression of the seton variable did not make sense to me as it simply gives true in the trigger minute, leaving the remaining conditions to make no difference at all.
    {% set seton = ( m | int == start_minute_var | int and start_minute_var | int ) or price | float <= allways_on_var | float or ratio | int <= hour_ratio_var | int or rank | int <= hour_rank_var | int %}

Solution I have therefore removed that first start_minute_var related condition (in the parenthesis), and changed the run-mode of the automation to restart, so that the newly triggered instance of the automation may turn off devices every hour.

mode: restart

I made the mode change in the yaml of the automation, not the blueprint. I have not tested if this can be set in the blueprint

lenhoy commented 2 weeks ago

Working on this in PR #3