Trying to get HA to have Alexa announce during an automation. I have alexa media player installed.
The automation defined in automations.yaml as:
id: announce_middle_garage_moving
alias: announce middle garage door moving
trigger:
platform: state
entity_id: cover.garage_middle_door
to: OPEN
for: 00:00:01
from: CLOSED
condition: []
action:
service: notify.alexa_media
data:
type: tts
method: all
target: media_player.computer_room_dot
message: Middle garage door movement detected
mode: single
To test the “Action” portion of it I use CONFIGURATION -> AUTOMATIONS -> EXECUTE
I also tried removing the line ‘type: all’ but either way I get same error message below in Log Viewer.
File “/usr/src/homeassistant/homeassistant/components/notify/init.py”, line 149, in _async_notify_message_service
await self.async_send_message(**kwargs)
File “/config/custom_components/alexa_media/notify.py”, line 216, in async_send_message
if data[“type”] == “tts”:
TypeError: ‘NoneType’ object is not subscriptable
Here’s mine that does the same thing but works. The only difference I see is the lack of “method: all”. Check your formatting closely. An improper indent can cause all kinds of issues.
Hello, I’m doing something similar. What would I include to prevent the message from reoccurring while the mailbox is open and only message one time - in say 10 minutes?
Since this was setup as a trigger only when it goes from ‘off’ to ‘on’ then it should only go once while the door remains open. Unless someone keeps opening and closing.
EDIT: I suppose since this is a vibration sense, that is not exactly the case. I would be concerned about wind/critters/etc causing the vibration sensor also causing false positives. I had originally thought that there was a magnetic door sensor in use.
In the case of the Vibration sensor, you could create an input value that gets set to ON when the automation gets triggered. Then create a second automation that gets triggered when the new input gets set to ON that will sleep for 10 minutes, and then set itself to OFF. You would also have to add a condition to the original automation to verify that the new input is OFF prior to triggering.