Automation takes looooong time to restart

I have 2 automations:

  1. turn off if was on for 1:30 or reached +23C.
  2. turn on if below +20C
    Implemented by SonoffTH with AM2301, mqtt, “Setoption19 1”.

Now I start the system when it is +15C. 1) starts, works for 1:30, reaches +17C and stops which is fine as 1:30 kicked in. But now I expect 2) to start again as it is still below +20C but this step takes minutes and minutes, why is that, is there a timeout of some kind which I am not aware of?

Please paste your automations here. Assuming you’ve written #2 the “normal” way, it will only trigger when the temperature drops from above to below 20°C.

A way to fix this would be to trigger on sensor.time, and have the temperature comparison as a condition.

Is this “normal” way? I guess temperature as a condition makes sense.

- id: '1590626709877'                              
  alias: On when below +20C        
  trigger:                                         
  - below: '20'                                    
    entity_id: sensor.tempmaster_am2301_temperature
    platform: numeric_state                        
  condition: []                                    
  action:                                          
  - data: {}                                       
    entity_id: switch.tempmaster_tempmaster        
    service: switch.turn_on                        
- id: '1590626844451'                               
  alias: Off after 1:30 or 22C      
  trigger:                                          
  - above: '22'                                     
    entity_id: sensor.tempmaster_am2301_temperature 
    platform: numeric_state                         
  - entity_id: switch.tempmaster_tempmaster         
    for: 00:01:30                                   
    from: 'off'                                     
    platform: state                                 
    to: 'on'                                        
  condition: []                                     
  action:                                           
  - data: {}                                        
    entity_id: switch.tempmaster_tempmaster         
    service: switch.turn_off                        

you are asking for a numeric_state

platform: numeric_state   

but you trying to check ‘20’ which not a numeric_state

try

below: 20  

also looking at you Trigger

I write it as (think as this)

what am i checking for
whats the entity_id
what does it =

these are my logic steps

trigger:
  - platform: state
    entity_id: switch.tempmaster_tempmaster
    to: 'on'
    for:
        hour: 1
        minutes: 30
  - platform: numeric_state
    entity_id: sensor.tempmaster_am2301_temperature
    above: 20

as we have - which means more than one thing could happen (in trigger)
now I do the action
do the action the same way

    action:
      - data:
          entity_id: switch.mame_screen
        service: switch.turn_off

again added - saying I want more than one action to happen now

if you keep to the same format you like after about a month your stop getting those funny errors.
and you see in your head beater.

note the spacing could … up off top of head.

do the condition the same way.

BUT these are what I call should I be passing go as I have the trigger

then are AND it OR it NOT it

condition:   # frist one we doing it
    condition: and   # what are we doing in this case and  ing
    conditions:  # start the conditions  note the s
    - condition: template
      value_template: '{{some bla bla}} '
    - condition: state
      entity_id: sensor.rain_sensor
      state: dry

NOW the template

I think these as do some MATHS on the fly

note they all have the

what am i checking for
whats the entity_id
what does it =

next lesson

NOW if we dont put a “what does it =” in the trigger it will just do it when the platform changes

so

  trigger:
  - platform: state
    entity_id: 
    - binary_sensor.garage_side_door
    - binary_sensor.garage_door
    - binary_sensor.front_door
    - binary_sensor.cupboard_door
    - binary_sensor.linen_door
    - binary_sensor.washing_door
    - binary_sensor.dryer_door

so this is saying when any of these states change
note: - after the entity_id adn the indent saying again I have more to come

now the action

  action:
  - data_template:   # want some maths on the fly done
      title: "Home Assistant"
      message: "{{ trigger.to_state.attributes.friendly_name }} was {% if trigger.to_state.state == 'on' %} Open {% else %} Closed {% endif %}"
    service: notify.stephan_phone

the - has a name never read that far in the manual just wing it and read other automation/ scripts

I don’t see anything wrong with your automations, other than the time you specified in the “for” option – you had 00:01:30, which is one minute and thirty seconds. If you meant one hour and thirty minutes, then it should be 01:30:00.

Note that the triggers will only “fire” when the entity it is monitoring changes. Further, the numeric_state trigger will only fire a second, third, etc. time when the condition goes from true, to false, and then back to true again. So, the first time the temperature changes after HA starts to a value below 20 will trigger the automation. But then it has to go to 20 or above, and then back to below 20 for it to fire again.

If you want it to stay on if, after an hour and a half, it’s still below 20, then you could do it this way:

- id: '1590626844451'                               
  alias: Off after 1:30 (if not still below 20C) or 22C      
  trigger:                                          
  - above: '22'                                     
    entity_id: sensor.tempmaster_am2301_temperature 
    platform: numeric_state                         
  - entity_id: switch.tempmaster_tempmaster         
    for: 01:30:00                                   
    from: 'off'                                     
    platform: state                                 
    to: 'on'                                        
  condition:
  - condition: not
    conditions:
    - condition: numeric_state
      entity_id: sensor.tempmaster_am2301_temperature
      below: 20
  action:                                           
  - data: {}                                        
    entity_id: switch.tempmaster_tempmaster         
    service: switch.turn_off                        

That will prevent it from being turned off if it’s still below 20 an hour and a half after turning on. It will then only turn off after it goes above 22, no matter how long that takes.

You probably don’t want to turn it off and then right back on. HVAC systems tend not to like that. :smile:

That’s not true. A string value will be converted to a number, so '20' works just as well as 20.

Yes you are right but thats not a good habit to get into

if you are asking for a numeric_state why not give it a numeric_state to check.

I entered “20” without quotes in the UI so I assume it is totally fine if it ends up quoted in the yaml.

I think pnbruckner had it right. One, the automation trigger remains true while below 20… either needs a repeated execution below 20, or a way for the previous automation (manual timer) to reset the state of the second automation when it finishes. Also, his comment about not turning on/off heaters and AC’s fast is important. Your automation idea as is would turn off then back on in milliseconds… your heater will likely reject that and wait a few minutes before running again. My central heat and air does the same thing… has a minimum cycle time hard coded that the thermostat cannot override (nor would I want to override it for safety/reliability reasons). This could be an ‘outside’ reason for what you are seeing here. If this is the case, you have to code around that so it won’t turn off after it hits 1:30 if below 20c.

It actually looks like the Tasmota’s telemetry period plays big role in this, it is set by default to 300sec which means HA will notice it quite late. After changing it to 30sec or so, things get better.