Goal is to have HA to announce which window has been opened.
With the below automation (without ‘states’ stuff in the message) I can when ‘opening’ a window, to get my sonos to announce that a window has been opened. So fare so good.
But next step. The goal is to get all my windows listed as triggers, and to have the text to contain the windows that is being opened. I do believe it should be possible to ‘grab’ the ‘friendly_name’ from ‘something’ when the automation is being kick off.
But I’m stuck…
How to get the ‘friendly_name’ of the ‘binary_sensor’. I have tried a lot of things…
please come with a hint.
This is my very advanced automation ;-)) :
alias: Test Automation 2
trigger:
entity_id: binary_sensor.neo_coolcam_door_window_detector_sensor
from: ‘off’
platform: state
to: ‘on’
condition: []
action:
data_template:
entity_id: media_player.kitchen
message: " {{ states(’???’) }} has been opened"
service: tts.google_say
try and use that blue bar on top of the page to format your code.
You need to use data_template instead of data if you’re not sending plain text but want to use templated data.
Next step is to lower the volume on the ‘media_player’ (which is a Sonos speaker).
I have googled and tried a few things, but without success.
So, I would love to get that solved…
but even more. Where do I find information about how to do this ? I do believe I have read most of the ‘manuels/instructions’ I can find, about HA data models, object models, not much, and it didn’t enlighten me… It could be that i’m the problem ;-)…
But where do I find the instructions, so I would be able to read/understand, that would teach me ‘how to handle the objects’ - like turning down the volume…
Hope some can point me in a direction.
Thanks.
And thanks to all the help full spirits in here…
This is the code that I have tried with, in order to set the volume:
- alias: Test Automation 2
trigger:
- platform: state
entity_id:
- binary_sensor.neo_coolcam_door_window_detector_sensor
- binary_sensor.neo_coolcam_doorwindow_detector_sensor
- binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor
- binary_sensor.neo_coolcam_window4_detector_sensor
- binary_sensor.neo_coolcam_window5_detector_sensor
to: 'on'
condition: []
action:
- data_template:
entity_id: media_player.kitchen
#volume_level: '{{states.media_player.kitchen.attributes.volume_level = 0.2}}'
#volume_level: 0.1
message: '{{trigger.to_state.attributes.friendly_name}} window has been opened'
service: tts.google_say