My automation isn't triggering and I dont know why

I created the below package but it has never resulted in the TTS being read out. Any ideas what could be wrong here?

input_boolean:
  dog_feeding_reminder:
    name: Dog Feeding Reminder
    icon: mdi:dog-side
    initial: on


automation:
  - alias: Feed Dog TTS
    initial_state: 'on'
    trigger:
      - platform: time
        at: '05:00:00'
      - platform: time
        at: '17:00:00'
    condition:
      - condition: state
        entity_id: input_boolean.dog_feeding_reminder
        state: 'on'
    action:
      - wait_template: "{{ is_state('binary_sensor.kitchen_multi_sensor_sensor', 'on') }}"
        timeout: '04:00:00'
        continue_on_timeout: 'false'
      - service: tts.google_say
        entity_id: media_player.kitchen
        data:
          message: "Yo, Bella is looking hungry"

Nothing in the log relating to it at all.

I don’t see an id for the automation, I don’t know if its required now but you could try, you also could change the action to something simple like switching a light. This way you could troubleshoot where the automation stops working.

You could also trigger the automation via the services tab.

I don’t have ID’s for any of my automations. Everything else seems to work

You only need an ID to use the GUI automation editor.

Try wrapping ‘on’ in your input_boolean

I already have it wrapped in the condition section, but as per the docs, the coma’s are not used for the initial_state. The input boolean is definitely ‘on’ whebn checked on the dev page

Do you have any other that use TTS and are they working?

I do have a couple although I no longer use them so haven’t tried lately…

Is your automation activated in Dev Tools/states?
If not, i assume the problem is the initial_state: 'on' in the automation.
Should be True or maybe on

the automation is activated in the dev state page-

This is interesting. I also have an automation that doesn’t fire even though it has the same trigger as others that do. See here - [Templating question in automation using trigger.event] for further reading :wink:

EDIT: I’ve done some more looking and something seems a bit off to me…

image

have you tried to trigger it manually to see if it’s the trigger/condition or the action that’s not working?

I did try but as no one was home I’m not sure if it just sat and waited at the wait_template or not. I need to wait until I’m back home later in the week. I guess if no one see’s any issue in my code then surely it should work… but it has never actually produced the TTS audio

Hi. Can you see that it was triggered in logs, if you trigger it manually? And you do not see it was triggered automatically, don’t you?

So, just to start at the basics, do normal time-based automations work as expected? I.E. do they trigger at times that are specified.

2nd thing i’d look at is your wait template. Verify that the wait template is actually waiting. I’ve seen weirdness with those.

Also, there is an alternative to this automation if you can’t get it working. You could build 2 counters, and fire once based on the movement between the 5am to 9am and 5pm to 9pm. It’s much more overhead though so I’d try to get this method working.

EDIT: Now that I think about it, you aren’t even trying to only fire the message once. You could just do the automation this way:

automation:
  - alias: Feed Dog TTS
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id: binary_sensor.kitchen_multi_sensor_sensor
        to: 'on'
    condition:
      - condition: or
        conditions:
          - condition: time
            before: "09:00:00" 
            after: "05:00:00"
          - condition: time
            before: "21:00:00" 
            after: "17:00:00"
      - condition: state
        entity_id: input_boolean.dog_feeding_reminder
        state: 'on'
    action:
      - service: tts.google_say
        entity_id: media_player.kitchen
        data:
          message: "Yo, Bella is looking hungry"

and if you don’t mind templates:

automation:
  - alias: Feed Dog TTS
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id: binary_sensor.kitchen_multi_sensor_sensor
        to: 'on'
    condition:
      - condition: template
        value_template: >
          {% if is_state('input_boolean.dog_feeding_reminder','on') %}
            {{ 5 <= now().hour < 9 or 17 <= now().hour < 21 }}
          {% else %}
            False
          {% endif %}
    action:
      - service: tts.google_say
        entity_id: media_player.kitchen
        data:
          message: "Yo, Bella is looking hungry"

My nornal time based automatinos do work. I have tested this automation by clicking ‘trigger’ and absolutely nothing happens… I would expect it to start the wait_template, which makes me think that is the problem. ie: if i click ‘trigger’ then walk in front of the motion sensor, I get no TTS audio. Nothing in the log.

Your option will work although it would produce TTS audio every time I go in front of the motion sensor between those times. I would need to include an input_boolean to shut it off, which isnt a problem. I’m happy to change the automation to work this way but I really want to see the wait_template work, it’s annoying me!

I finally got around to looking into this and found an issue with the media_player that I was sending the TTS to. A small entity_id code change and it is now working