Trying to have newflash and weather on sonos when motion detected between certain hours


(rob@upsononline.com) #1

Looking to setup a routine when I get up in the morning to automatically play the weather and news flash when motion is detected in the kitchen. I have serveral smartapps and devices installed that I believe can do this, however having some trouble figuring out how to put it all together. I have a Smarthub, Motion detector, Alexa, Sonos, AskAlexa, BigTalker2, etc. can someone help me get this going?

Thanks in advance


(Robin) #2

webCoRE could read out a weather briefing from weather underground… that’s easy enough as WU is built into webCoRE.

Getting a news briefing would be a bit more tricky… but if anyone knows a http request that can return the briefing text, webCoRE could call that address and pass the text to a speaker / big talker.


(rob@upsononline.com) #3

Thanks I havnt installed webCoRE yet, installing now. Any gotchas associated with the install?


(Robin) #4

(rob@upsononline.com) #5

Pretty simple install - i will have to play around as it appears to get a bit more complex from here.


(Robin) #6

Here is the documentation for the weather function:

https://wiki.webcore.co/Weather

Ask any questions you like on the community forum:

Typical piston:

IF
motion sensor IS active
THEN
with speaker device
Speak text {$weather.forecast.forecast.txt_forecast.forecastday[0].fcttext}

Would speak something allong the lines of:

Plentiful sunshine. High 89F. Winds ESE at 5 to 10 mph.

Making it only happen once per day would need a bit more work but we can guide you through that on the forum and here is a rough method:

define
Boolean readTodayAlready

IF
motion sensor IS active
AND
readTodayAlready is False
THEN
with speaker device
Speak text {$weather.forecast.forecast.txt_forecast.forecastday[0].fcttext}
set variable {readTodayAlready} = True
end if

Every day at 00:01
DO
set variable {readTodayAlready} = False


(rob@upsononline.com) #7

Awesome I will start working on this now. I was able to get BigTalker2 to say the weather "Good Morning! %weathercurrent% %weathertoday% and have it kick off via motion between hours 6am and 8am, however having it run just once per day, haven’t found a way to do that yet. Going to give webCoRE a go now.


(rob@upsononline.com) #8

Does this look right?
image


(rob@upsononline.com) #9

The logs look good however, no sound?


(Robin) #10

Is ‘living room’ an audio device?


(rob@upsononline.com) #11

Yes, I guess I should rename that - its a Sonos Playbar


(Alwas) #12

I would personally change the IF to “if motion changes to active”.
thanks for the pointer Robin, you are a fountain of knowledge, i just copied your idea…

.


(Robin) #13

I’ve never owned a speaker / used Big Talker etc. so I can’t help with problems passing the text to the speaker.

Maybe @Alwas or someone else with a working piston could provide an example?

I notice @Alwas is passing the text as an argument to another piston (which does the talking)… a copy of that other piston might help.


(Johnny Dang) #14

I configured Location Mode to switch from Night to Home when “Things started happening between x and y time” via a motion sensor. Big Talker is then configured to say Good morning followed by the weather report when Mode changed to Home (but not from Away).


(Brian S. Lowrance) #15

This is how I get my morning weather report as well. Speak only x times per day for an event has been a somewhat regular request for BigTalker. I plan to implement it soon.