Morning Weather Announcement TTS

Hi there

I'd like to create a text to speech automation, ideally using Rule Machine to play my Sonos. One part of this announcement is the current and forecast weather for my local area, perhaps similar to what happens when asking Google "what's the weather today" etc.

Does anyone know of an external site or service that I can point a rule to that will pull back the statement I need to announce? With an example as I am novice?

I've experimented with trying to integrate into different weather apps/sites before but not seen a Web service that returns a Tts string in such a way.

Maybe there is a way to convert the Google result to play on the sonos somehow?

1 Like

My suggestion would be to look at what weather service(s) you have available in HE, in particular with weather results as attributes (Current States) for a device, then look at how you can construct a string that includes those details (attributes) mixed together to form a coherrent message. Once you have a message (STRING), then I expect it will be a simple exercise to play this on the speaker (famous last words)

2 Likes

@user4286

I just made this, took about 2 mins, Works fine. I used the Wunderground driver. Simply use any attributes in the announcement you want. Even multiple ones.

5 Likes

Pbs Nature Gorilla GIF by Nature on PBS

1 Like

I feel this could be a common response for me... it is a nice GIF....

1 Like

Thanks for the support.

I've explored setting up a Wunderground account and creating an Api having added the virtual driver from the Package Manager. A Google search suggested that if I add a device to the site (which I don't actually have) it doesn't matter and I can still use the credentials.

Ive added them to the virtual driver but get no other response

Is anyone able to confirm if I am required to pay a subscription?

look at wunderground and find a local personal weather station near you, use that for the reference...

Your device page should look like this

1 Like

Thanks

Have changed the station code from the one it gave me initially to one I found locally which is online

I've checked the other settings and they look the same.

I've added the extra logging in and get this.

that doesn't look like a proper API key, mine at least is like 15 characters or so, yours is 8. Do you have a legitimate API key?

1 Like

Thank you, yes you were correct. For some reason the site didn't display on my phone. I've created the key and put it in and I get a full list of variables and states.

Amazing!

Thanks so much!

1 Like

Glad to hear it. Now you can use what ever attributes you want to populate the variables you will use in your announcement(s)

1 Like

So it's funny. I made the rule above as an example for you and I forgot to delete it when I was done posting. So now it announces today's weather and my wife loves it... WAF for the win! :rofl:

5 Likes

Get the WAF whenever you can!

I got home from holiday yesterday having set up a very extended set of messages in a single long rule that include the forecast element of this chat (current, UV and also forecast for tomorrow) but I also extended it to include some information from Hub Information Driver such as CPU temp, Free Memory and if an update was available. Its been fun learning how to pull through the different values and setting up Hub variables in some cases.

I was so smug - seeing the messages to my phone when it ran, but I got up this morning and it played it for the first time for me out loud through the Sonos and it didnt work. It cut off or didnt play certain parts of the messages or when I put them into single shorter messages in the rule to try and simplify it it skips through them all too quickly and doesnt finish each one. I then realised I've only ever ran single announcements in a rule before and hadnt realised I might need to add in wait steps to account for the length of the message.

Does anyone know how to add an artifical pause within a single TTS statement or add a wait/pause between seperate statements/rules that can handle TTS messages that might handle messages of slightly different lengths? Also setting this up is really tricky, each time I change a wait for x seconds I have to go down the rest of the rule and modify their waits by the same amount?

If I have to split up the messages into different lines in the rule (because I have to manage the audio experience) that it means they will also be sent in different messages to my phone which is rubbish - I will probably have to have a copy of this that runs independently so the messages are all sent in one go?

I feel like I am missing an obvious/easy way of doing this and making it hard for myself

honestly i would just keep each announcement to its own rule. KISS principal

You could lean into it and include a "... and if you want to hear more, press the Kitchen Button....". :slight_smile:

I keep chipping away at this when I have some free time.

My latest attempt at some functionality is to try to announce the time since someone came to our front door or came onto our drive.

I have a few different cameras that indicate human presence, Reolink and Google, the reolink (which is local via Home Assistant) brings in this device/entity.

Can someone help me with an elegant/simple way to do this?

My starting point is to have started a rule in RM that goes along the lines of

Speak "The last time someone arrived the door was %inserthubstringvariablehere%"

How do I set a Hub Variable so that it is the timestamp of when a device state last changed or became "on"?

Thanks

add %time% to your notification line... So...trigger=doorbell/cam pushed/person detected and notification is "Person detected at %time%

Thanks for your suggestion. Just so I understand, I am looking to store the time that the status changed (when presence was detected) in the variable so that when the rule is ran, at a later time, it reads it out.

Wouldn't the proposed solution above assume that the announcement occurs at the same time the status changes?

Sorry yes, I thought you meant at the time the event happened. But yes, you can create any variable you want and send the time the event and send %whatevervariableyounamed% how ever you want.