Sending notifications to Pushalot

8 years 7 months ago #2186 by NightOne
Hi all, I thought I would share an automation script that allows notifications to windows phones and to windows computers, as windows phone users normally get left out of all the cool stuff.

Pushalot is a service that has an App for windows phones and windows computers (windows 8 and above) which pushs notifications when something happens.

You will need to create a pushalot account (free) and you will get an API key that will allow you to send notifications, and you will need to download and install the App onto your windows phone or your windows PC or both.

In my setup I have Door/Windows sensors on my Garage Roller door, as well as the side door to the garage, as well as my house front door and back door.... they all send status changes to EasyIOT server so the automation script checks the status on EasyIOT not on the sensor itself. I have also created a generic AO/DO module as an Alarm Switch, so when I leave the house I can set the Alarm ON/OFF so that I dont get notifications pushed each time I open a door or garage.

The script is really basic and basicly sends a notification when the Alarm is ON (1) and the Door/Window Sensor changes value to Open (1).

public void Setup()
{

EventHelper.ModuleChangedHandler((o, m, p) =>
{
Console.WriteLine(m.Address + " in program id "+ Program.ProgramId.ToString()+ " property "+ p.Property + " value " + p.Value);
if (m.Domain == Domains.VIRTUAL && m.Address == "N19S0" && p.Property == "Sensor.DoorWindow"){
ModuleParameter n = ModuleHelper.GetProperty(Domains.VIRTUAL, "N18S0", "Sensor.DigitalValue");


if (p.Value == "1")
if (n.Value == "1")

{

System.Collections.Specialized.NameValueCollection values = new System.Collections.Specialized.NameValueCollection();
System.Net.WebClient client = new System.Net.WebClient();
values["AuthorizationToken"] = "Your API KEY goes here";
values["Body"] = "Someone has opened the Backdoor?";
client.UploadValues(" pushalot.com/api/sendmessage",values );
}
}
return true;
});

}

/*
This code is running periodicaly when program is enabled.
Cron job detirmine running period.
*/

public void Run()
{
}

Hope this helps at least one person with a windows phone :)
That being said the code should work on any notification system that requires you to post values to a RESTAPI
The following user(s) said Thank You: asm7100

Please Log in or Create an account to join the conversation.

Time to create page: 0.171 seconds

Forum latest

  • No posts to display.