Alexa can get notifications from Vera - UPDATED 01/23

Very nice. I was dreading writing a date to tts conversion script for this service as I didn’t realize you could get similar results with os.date(‘*t’). Thx for this. It’s a great help.

And for those who want to know exactly when your vera reboots–via Alexa notification, add a subsequent function call in the startup lua (next line down)
AlexaMessage(“”) with your warning text in between the quotes.

[quote=“robie, post:20, topic:200378”]This is great and many thanks! Is there a way to do this (time stamp) without editing the startup lua? (for the ff reasons - i will use it on several scenes, less software changes to the vera system and confined scripting to the scenes)

[quote=“ZW-Tom, post:19, topic:200378”]I posted a new update with my original post on page 1. Let’s you send notifications from any scene by just using the following as an example:

AlexaMessage(“Someone is hiding behind the curtain.”)

Tom[/quote][/quote]

If you put it in your startup Lua, you never need to run the scene again. You only use the call … example ie:
AlexaMessage(“ZW-Tom sure is a helpful old dude. Just ask him. I think he will agree.”)

When you create a scene in Vera, it does not activate until it is called, so unless the scene is run one time, the call does not work. After it is run with Lua startup, any call from another function using AlexaMessage(“Say this”) will work as long as the scene has run one time. This is an easy way of doing Lua code without all the other lua junk.

However:
If you want the use the code confined to a particular group of scenes, paste the AlexaMessage code into your desired scene and put the AlexaMessage(“Say this”) at the bottom of the code which will call the function every time that scene is triggered. (This process adds alot of code every time you send a message. Not very desiriable.)

Tom

Outstanding. +1. I just wonder when I’ll get the time to implement this with a high WAF.

I’d second that out standing. I am already using it.

I’m trying to incorporate some of these features here

Specially as a test this one

I’m trying this
AlexaMessage(‘Hello’…‘’…‘World’)

the command executes ok in Vera but a notification is never received.
I’m way over my head here but I’d like to know if what I am trying to do is possible or not!

Thanks for sharing this … works for me also.

I hope I can get alexa to speak out the notification some day directly without me asking it to “read my notifications”. If I have understood correctly that is not possible at the moment due to alexa api limitations.

[quote=“mbaker171, post:24, topic:200378”]I’d second that out standing. I am already using it.

I’m trying to incorporate some of these features here

Specially as a test this one

I’m trying this
AlexaMessage(‘Hello’…‘’…‘World’)

the command executes ok in Vera but a notification is never received.
I’m way over my head here but I’d like to know if what I am trying to do is possible or not![/quote]

Just add a comma after the word(s) you want to pause …
AlexaMessage(“Hello, world”)

Tom

[quote=“ZW-Tom, post:26, topic:200378”][quote=“mbaker171, post:24, topic:200378”]I’d second that out standing. I am already using it.

I’m trying to incorporate some of these features here

Specially as a test this one

I’m trying this
AlexaMessage(‘Hello’…‘’…‘World’)

the command executes ok in Vera but a notification is never received.
I’m way over my head here but I’d like to know if what I am trying to do is possible or not![/quote]

Just add a comma after the word(s) you want to pause …
AlexaMessage(“Hello, world”)

Tom[/quote]

This rather misses the point of my post which is to figure out how to use those new speech features. The speech delay was just a simple one to try first.

Mick

[quote=“mbaker171, post:27, topic:200378”][quote=“ZW-Tom, post:26, topic:200378”][quote=“mbaker171, post:24, topic:200378”]I’d second that out standing. I am already using it.

I’m trying to incorporate some of these features here

Specially as a test this one

I’m trying this
AlexaMessage(‘Hello’…‘’…‘World’)

the command executes ok in Vera but a notification is never received.
I’m way over my head here but I’d like to know if what I am trying to do is possible or not![/quote]

Just add a comma after the word(s) you want to pause …
AlexaMessage(“Hello, world”)

Tom[/quote]

This rather misses the point of my post which is to figure out how to use those new speech features. The speech delay was just a simple one to try first.

Mick[/quote]

This post is intended to help others use an Alexa “Notify Me” “skill” with Vera using the code I developed. Discussion regarding “SSML Tags” would be best discussed in another subject post, as it (and voice announce) do not appy here.

Tom

[quote=“ZW-Tom, post:22, topic:200378”]If you put it in your startup Lua, you never need to run the scene again. You only use the call … example ie:
AlexaMessage(“ZW-Tom sure is a helpful old dude. Just ask him. I think he will agree.”)

When you create a scene in Vera, it does not activate until it is called, so unless the scene is run one time, the call does not work. After it is run with Lua startup, any call from another function using AlexaMessage(“Say this”) will work as long as the scene has run one time. This is an easy way of doing Lua code without all the other lua junk.

However:
If you want the use the code confined to a particular group of scenes, paste the AlexaMessage code into your desired scene and put the AlexaMessage(“Say this”) at the bottom of the code which will call the function every time that scene is triggered. (This process adds alot of code every time you send a message. Not very desiriable.)

Tom[/quote]

Okies, many thanks for the additional explanations. i’ll copy paste and stop asking, haha! cheers to you :slight_smile:

Hi,
Just come across this, looking for a way to use Alexa for notification of my solar panel status. based on this I’ve got it working, but have a couple of changes:
1 - I was getting errors from Vera of unsafe code… note that you have to enable “Potentially unsafe code” in the “User & Account info” > “Security” tab to use wget with external web calls
2 - I have simplified the date/ time announcement to a couple of lines. The timestamp is optional, just put os.time() as the second parameter to get eg “Notification At ten fiftysix on Wednesday”. Just change the format parameters if you want a different layout eg full date or 24 hour clock. Early days so I may play with this a bit more :slight_smile:
3 - I was getting a 502 error, have taken out the “!..” in the string which seems to have fixed that.
4 - I have put the function in the lua startup code, to avoid hassle with a scene, and to make it global to call from other scenes

    function AlexaNotify(sNotify, NotifyTime)
      if NotifyTime then
           sNotify = sNotify .. os.date("At %I %M %p, on %A", NotifyTime)  -- append timestamp to notice
      end
      sNotify = string.gsub(sNotify, " ", "%%20")  -- get rid of any spaces and use %20 instead
      local StatusCode, content, httpStatusCode = luup.inet.wget('https://api.notifymyecho.com/v1/NotifyMe?notification='..sNotify..'&accessCode=<Your AccessCode>')
luup.log("Notify: " .. sNotify .. ", " .. StatusCode .. ", " .. content)
end

I have included a call to this in the startup code as an example:
AlexaNotify("Vera restarted", os.time())

Hope this is useful, and thanks for the work Tom

Regards
Octo

Hello, is there an existing script to copy that will allow alexa notifications to report temperature from 5 different temperature monitoring devices inside the house?

Hi Tom,

Do you have the 2 attachments? Is this still working?

Thanks