Hi! I have an automation setup to play a music track when the curtains in my office are opening (yes, definitely the song you’re thinking of) however the device trigger of “opening” is selected it wont trigger. Closing is the same. “opened” and “closed” function as “opening” and “closing” should, rather than at the end of the movement. Just wanted to bring this to someone’s attention. Thanks.
I’m just using the UI to make automations, don’t really get into the code at all, but here it is anyway for you.
alias: Curtains Epic
description: ""
trigger:
- platform: device
device_id: 84f892bcbe521ac971ec92c069158464
domain: cover
entity_id: 907faecba7a7fb39b86b31644b95c663
type: opening
condition: []
action:
- service: media_player.play_media
target:
entity_id:
- media_player.ytube_music_player
data:
media_content_id: _Cdu870lyPg
media_content_type: track
- service: media_player.media_stop
metadata: {}
data: {}
target:
entity_id: media_player.office_nest_mini
enabled: true
mode: single
Also, the track the speaker plays is repeated until I tell the mini to stop or run a media_player:stop command, and sometimes even then it wont stop first time, but that’s a separate problem. Hope that helps.
Also: 1 - Yes! I should have thought of that song!
2 - Damn you, damn you to heck…
Go to Developer Tools → States.
Find your cover.
Watch its state there when you open and close the cover. What do you see?
It may be that your cover only has the states open
and closed
without opening
and closing
.
Ah, yes. You are correct. Open and closed only. Thanks for your help, I didn’t know about the states in the Dev tools, I don’t Venture into the dark lands often
LOL. Well done. I was expecting Rick Ghastly.
Good to see you got it working.