Delay some automation and value to avoid trigger upon restart

Hi all,

In some cases for example my device tracker automation always triggers every time my HA being restart. Is there a way to not trigger it during a restart?

Furthermore, my thermometer (BLE) information is using ESP Home and in most cases during the first restart of HA will not sent and data causing error logs being written. It will however work as it should be after. Is there a way to make it right? So every time HA restart it will search for the last information and get updated after?

Does anyone have a dumb washing machine that works (I’m using SonOff to get the current information)? I still have got the right ones that are working.

Thanks

For your first problem I have a binary template sensor, that is “on” for x seconds after reboot:

        value_template: "{{ ((as_timestamp(now())-as_timestamp(states('sensor.sys_uptime')))/60)|int <= states('input_number.sys_delay_automation_after_reboot')|int }}"

I use this as a condition in my automations.

Can you show an example of the trigger that is causing the issue?

Hi @tom_l

Here is the code

  - alias: Tracking Device Tracker
    mode: single
    id: 34204e88-b259
    description: Tracks our device Via G Nest
    trigger:
      - platform: state
        entity_id:
          - person.person1
          - person.person2
    condition:
      - condition: time
        after: '08:30:00'
        before: '23:59:00'
      - condition: template
        value_template: '{{  trigger.from_state.state != trigger.to_state.state }}'
    action:
      - wait_template: >-
          {{ not is_state('media_player.google_home', 'playing') }}
      - service: tts.google_translate_say
        entity_id: media_player.google_home
        data:
          message: >-
            {{ trigger.to_state.attributes.friendly_name }} 
            {% if trigger.to_state.state == 'not_home' %} 
              has left {{ trigger.from_state.state }}
            {% endif %}
            {% if trigger.from_state.state == 'not_home' %} 
              arrived at {{ trigger.to_state.state }}
            {% endif %}

For the 2nd problem, this is the error message receive upon startup

Unable to update from temperature sensor: could not convert string to float: 'unavailable'

Try these conditions and see if it helps:

    condition:
      - condition: time
        after: '08:30:00'
        before: '23:59:00'
      - "{{ trigger.from_state.state not in ['unknown', 'unavailable', 'none'] }}"
      - "{{ trigger.to_state.state not in ['unknown', 'unavailable', 'none'] }}"
      - "{{ trigger.from_state.state != trigger.to_state.state}}"

(they are written using the shorthand format for template conditions).

1 Like

Thank you… it work…