My first automation. Light works, but no google say

I’ve made my first automation. It will only work, hopefully, at sunset. So I need to wait a few hours. However, I can trigger it.

I want a light to come on, and a google home mini to say something.

The light comes on, but the mini is silent.

Examples have quotes aroud the message. In the UI, I add the quotes… save the automation… but when I reopen it, the quotes are gone. do I need the quotes?

Can anyone see a problem as to why my speaker isn’t speaking?

Why is your entity_id saying “all” where was that example?. Seems that the entity is incorrect and so is your indentation.

Edit: the entity needs to point to your google mini such as “media_player.living_room_speaker”. Else it doesnt know which entity to control

See example below (This is from the back-end yaml, not from GUI editor)

  - data:
      language: en
      message: Plant needs water
    entity_id: media_player.living_room_speaker
    service: tts.google_translate_say

I think yours should be

  data:
    language: en
    message: <your message>
  entity_id: <your entityid>
1 Like

You can use entity_id: all in an service call to target all relevant entities. In this case, it would make all media players say the message. I also don’t see an indentation problem (remember that OP is using the UI editor). But yes, if OP only wants to target a single speaker (which they indeed did say in the post), then the entity ID of that speaker is needed.

@Cralis check your logs for anything related to the automation when you manually trigger it. You could also post the automation code from automations.yaml, it’s possible the UI editor is doing something weird.

1 Like

I don’t think you should have message indented under data. I.e., I think you should have the following under “Service data”:

message: The sun has set. Switching on the lounge light
entity_id: all
2 Likes

Ah good point, the UI editor probably doesn’t need data: for service data since it would add it already. That’s part of why I asked to see the YAML itself since I don’t use the UI editor :stuck_out_tongue:

1 Like

Thanks very much, guys! I’m going to remove the ‘data:’, and make sure my indentation is right. I wasn’t aware that whitespace was actually a think in yaml. Thanks for the headsup!

And sorry, initially I intended to target one speaker (I till do) but when posting the code, it was at the stage I was hunting for example, and came across ‘all’. I’ll change it back to the speaker in the room with the light. I also want to switch on 2 lights. Would IO just do two actions? Or can I switch on more than one in a single action?

I’ll try this:

message: The sun has set. Switching on the lounge light
entity_id: media_player.living_room_speaker

So, no indentation.

The easy way to check is by using the dev tools and try it there…