Hi all,
Im trying to setup automation to read the today weather (sunny, rainy, etc) every morning. I got it to read “The weather for today is” then unable to read the states from the entity and would eventually like it to read the current temperature too. I assume once I got this figure out I can figure out the last part.
I’m new to HA, hope someone can point me to the right syntax.
- id: '1588920169520'
alias: Test Weather Report
trigger:
- at: 08:00:00
platform: time
action:
- data:
volume_level: 0.2
entity_id: media_player.bose_soundtouch
service: media_player.volume_set
- data:
entity_id: media_player.bose_soundtouch
message: The weather for today is {{ states(weather.test_home) }}
service: tts.google_translate_say
- data_template:
entity_id: media_player.bose_soundtouch
message: "The weather for today is {{ states('weather.test_home') }}"
service: tts.google_translate_say
No worries. Some services are picky about where they require the entity_id to be. There seems to be no consistency on whether it is inside or outside the data_template. See:
I didn’t read the whole topic (although I’ve heard bits of this discussion about this issue before), but I think I understand that this doesn’t work (i.e., entity_id inside data_template):
- data_template:
entity_id: media_player.bose_soundtouch
message: "The weather for today is {{ states('weather.test_home') }}"
service: tts.google_translate_say
But this works (i.e., entity_id outside data_template):
- service: tts.google_translate_say
entity_id: media_player.bose_soundtouch
data_template:
message: "The weather for today is {{ states('weather.test_home') }}"
Do you think this would also work (i.e., entity_id inside data_template, but its value as a list instead of a single string):
- data_template:
entity_id:
- media_player.bose_soundtouch
message: "The weather for today is {{ states('weather.test_home') }}"
service: tts.google_translate_say