Calendar announcement

I’m not a developer but having fun with learning HA and the great integrations I’ve added. One of them seems simple and I don’t know where to start and would appreciate some help?

I added the Jewish calendar to my config and see many sensor entities. How can I announce a sensor state with the play media action?

sensor.jewish_calendar_parshat_hashavua

Specifically for example I want to announce this sensor every Friday at 10am, what would I need to write and where?

Create an automation with a Time Trigger set to 10:00. Add a Time Condition that restricts it to Fridays. In the automation’s action you will add a service call to … well, this part is unclear because I would need to know what the sensor’s value contains and how you want to render it on whatever media_player you have. Do you want the media_player to say the value?

Yes, the media player to say the value exactly. So something like good morning the value is xxx

Do you have any sort of Text to Speech integration set up already? For example:

What kind of media_player do you have?

Yes, I have Google tts and a Google home device and use it for automations where I specify the exact tts to announce.

OK, if can already do all of that then the part you want is where it combines some phrase like “Good morning the value is” with the current value of the sensor.

To do that you will need to use a template like this:

Good morning the value is {{ states('sensor.jewish_calendar_parshat_hashavua') }}

Everything between the paired set of double-braces will be replaced by the sensor’s current state value.

Ok so I create that template and name it template1 then what? Actually I see scripts where and how do I create a template? I just ran the template editor and see the response value using your syntax

I selected template as an action in an automation and added your syntax and when choose test it returns an error? I’m guessing I’m still missing some steps.

Your automation’s action should contain a service call to a Text-to-Speech service. For example:

action:
  - service: tts.google_translate_say
    data:
      entity_id: media_player.your_player
      message: "Good morning the value is {{ states('sensor.jewish_calendar_parshat_hashavua')"

Ok so I added a call service action, edit yaml and pasted in and changed to actual target names and got an invalid error when running the action:

Unable to determine action @ data[0]

Post the automation you created (its YAML code).

service: tts.google_translate_say
data:{}
target:
entity_id: media_player.entryway_wifi

message: “Good morning the value is {{ states(‘sensor.jewish_calendar_parshat_hashavua’)”

Post the entire automation and ensure it is formatted (what you posted is unformatted).

FAQ guideline 11, Format it properly.

That is the entire code of edit yaml for the action. See screenshot for correct format

You are missing closing curly brackets }} on your template.

That’s not what I requested but it’ll do for now.

It should look like this:

service: tts.google_translate_say
target:
  entity_id: media_player.entryway_wifi
data:
  message: "Good morning the value is {{ states('sensor.jewish_calendar_parshat_hashavua') }}"
1 Like

Awesome :+1: that worked tyvm for the assist :slightly_smiling_face: I’ll try a bunch more now.

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.