Hi all. I’m new to the Vera world (and home automation in general) and have just been playing around with a new Vera Lite while I’m waiting for my house to be built. I’ve rigged up some IP cameras, Fibaro switch modules, Fibaro Universal Sensor (hooked up to the camera motion alarm IO relay and 4 x temperature sensors) on a benchtop to do some testing before investing in a houselot.
As part of my testing I’ve been learning about scenes, triggers, LUUP, etc. I wanted to get Push Notifications coming through to my iPhone and found the Push Notification Plugin (can’t post link). It works great and I don’t have any complaints, other than I don’t know how I could configure multiple instances of a notification “device” so I can have notifications for other family members.
I started digging around with the Pushover API and found that it’s actually quite easy to trigger a notification directly from LUUP code. So I simply did the following:
[ul][li]Purchased the Pushover iPhone app from the App Store[/li]
[li]Created an account on Pushover (you’ll need the user key below)[/li]
[li]Registered an “Application” at pushover.net (you’ll need the app token below)[/li]
[li]Created a scene in Vera with a trigger (motion detection event from a camera)[/li]
[li]While adding/editing the scene, select the LUUP tab and enter the code below:[/li]
[li]Save scene and run it once everything has updated[/li][/ul]
local http = require("socket.http")
http.TIMEOUT = 5
(note that there is a space after the https:// because I am not allowed to post external links)
This code does a simple HTTP POST directly to the pushover.net API with your own details (check out the API documentation on pushover.net). It’s documented in the Wiki under the page name Luup_Scenes_Events (again, can’t post links).
Take from this what you want, but for me I find this approach much easier than relying on someone else’s plugin that may or may not work correctly in the future, especially if their application token (which is hard-wired into the plugin) is ever de-registered for whatever reason.
I believe you can create another version of the plugin to include the push notification key for the other family member. If you go to the “Apps” tab, click on the push notification plugin link and in the window there should be a button called “Create another”.
Ahhhhhh, so THAT’s how you do it… thanks! I think I’m just going to stick with calling the API directly as I’m still concerned about the api token being hard-coded in the plugin http://forum.micasaverde.com/index.php/topic,11520.0.html. I’ll raise it with Massalia and see if they can make that configurable too.
As you seem to know how this is supposed to work… why is it that when I click on the delete icon for a second Push Notification device instance it uninstalls the whole plugin? This also seems to happen for IP cameras when I use the Foscam or WintopZcam plugins.
Click it once and it says “are you sure you want to delete this device?”, click OK and it says “Remove this plugin and any devices this plugin created?”. Clicking cancel on the second one doesn’t just stop the plugin being removed, it also stops the device being removed. Click OK and the whole damn lot disappear… I’m confused
That appears to be a bug. It was talked about here. (I think the intended behavior is that you only get the first question when you’re deleting a device; the second question is when you delete the plug-in. It doesn’t seem to happen for all plug-ins.)
You can use the Vera Alerts plugin to send message to IOS or Android. There are many profiles options available …
To send additional information you would use the Template Options supported by the plugin.
i.e. Message String like:
The house temperature is {device([8].TemperatureSensor.CurrentTemperature)
The Front Door is {device([9].Lock.Status) | Choose({LockOptions})}
Here 8 is the device ID for a thermostat or temperature sensing device and 9 is the device ID for a Lock or a Garage Door Plugin.
NOTE: You can use the device NAME instead of the ID if it’s unique!
[hr]
After downloading Vera Alerts … Download the following files from your Vera (Apps → Develop Apps → Luup Files) to see examples of what you can do.
veraTemplateTest.lua
veraTemplateDefinitions.lua
Thank you very much! But what about pushover? Is it possible to do the same there?
If I will use code from this topic, how may I include sensor information?
Yes, thank you!
But it is really important for me to understand how to do it in luup, it will be the part of bigger notification system.
I want to send status updates of all my sensors periodically.
Please help.
Vera Alerts raises the level of abstraction …
i.e. you deal with Message Strings, Templates, and Profiles
vs
lua, luup … luup.variable_get … http requests, Sockets, which are different for different protocols.
Or you can do it with a combination of both …
With LUA you can do anything you want.
[hr]
Also note … many of the notification protocols do NOT support a formatted message … I.e. it’s difficult to create a table.
You can send an EMAIL with a formatted message (i.e. a carriage return is honored).
Best Home Automation shopping experience. Shop at Ezlo!