Google_say automation help needed

I have a cover set up to open and close my chicken coop door at sunrise and sunset. All works well, i want to have a message sent when the sensor confirms that the door is closed, not from the close automation command…

The following is from the console of the sonoff when i toggle the sensor.

13:17:59 MQT: cmnd/coopstate/POWER2 = OFF (retained)
13:18:00 MQT: cmnd/coopstate/POWER2 = ON (retained)
13:21:02 MQT: tele/sonoffcoop/STATE = {"Time":"2019-08-06T13:21:02","Uptime":"3T21:47:59","Vcc":3.178,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"ON","POWER2":"OFF","Wifi":{"AP":1,"SSId":"Keith","BSSId":"A0:F3:C1:E4:7D:FD","Channel":11,"RSSI":76,"LinkCount":3,"Downtime":"0T00:00:18"}}

This is my cover setup.

cover:
  - platform: mqtt
    name: "Sonoff Coop"
    state_topic: "cmnd/coopstate/POWER2"
    command_topic: "cmnd/sonoffcoop/power1"
    payload_open: "ON"
    payload_close: "OFF"
    payload_stop: "ON"
    state_open: "ON"
    state_closed: "OFF"
    retain: true

This is the automation, but I am unsure of what entity_id to use or state?

- alias: Announce Coop door closed
  trigger:
    platform: state
    entity_id: ????
    ???
  action:
    service: tts.google_say
    data:
      entity_id: media_player.living_room_speaker 
      message: "The coop door is closed"

Any advice would be appreciated.

look at the States tab in Developer tools.
If you search for “sonoff_coop” you’ll probably find an entity called cover.sonoff_coop
That’s what goes to the entity_id in your trigger
You then need to add a line:
to: "off" (assuming “off” means closed. Depends on your sensor.
Trigger would therefore be something like:

- alias: Announce Coop door closed
  trigger:
    platform: state
    entity_id: cover.sonoff_coop
    to: "off"

Thanks for your help, I tried everything except to: and so we learn.
Thanks for your help, hopefully it triggers tomorrow evening.

1 Like