notifying doorbell and then some more with pushingbox

well i got it setup using pushing box api. but i want to add more inputs that outputs to pushing box. i have a generator and transfer switch i want to know when it switches.

i have dry contacts off the transfer switch for normal and emergency position. i want the uno to send me alerts when it switches states. can someone help me add more outputs from the inputs??

heres the current code

////
//
// General code from http://www.pushingbox.com for Arduino + Ethernet Shield (official)
//
////

#include <SPI.h>
#include <Ethernet.h>

/////////////////
// MODIFY HERE //
/////////////////
byte mac = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x19 }; // Be sure this address is unique in your network

//Your secret DevID from PushingBox.com. You can use multiple DevID on multiple Pin if you want
#define DEVID1 “vCD1F3635179D6F4” //Scenario : “The mailbox is open”

//Numeric Pin where you connect your switch
#define pinDevid1 3 // Example : the mailbox switch is connect to the Pin 3

// Debug mode
#define DEBUG true
///////
//End//
///////

char serverName = “api.pushingbox.com”;
boolean pinDevid1State = false;

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
Serial.begin(9600);
pinMode(pinDevid1, INPUT);

// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println(“Failed to configure Ethernet using DHCP”);
// no point in carrying on, so do nothing forevermore:
while(true);
}
else{
Serial.println(“Ethernet ready”);
}
// give the Ethernet shield a second to initialize:
delay(1000);
}

void loop()
{
////
// Listening for the pinDevid1 state
////
if (digitalRead(pinDevid1) == HIGH && pinDevid1State == false) // switch on pinDevid1 is ON
{
if(DEBUG){Serial.println(“pinDevid1 is HIGH”);}
pinDevid1State = true;
//Sending request to PushingBox when the pin is HIGHT
sendToPushingBox(DEVID1);
}
if (digitalRead(pinDevid1) == LOW && pinDevid1State == true) // switch on pinDevid1 is OFF
{
if(DEBUG){Serial.println(“pinDevid1 is LOW”);}
pinDevid1State = false;
//Sending request to PushingBox when the pin is LOW
//sendToPushingBox(DEVID1);
}
}

//Function for sending the request to PushingBox
void sendToPushingBox(String devid){
if(DEBUG){Serial.println(“connecting…”);}

if (client.connect(serverName, 80)) {
if(DEBUG){Serial.println(“connected”);}

if(DEBUG){Serial.println(“sendind request”);}
client.print(“GET /pushingbox?devid=”);
client.print(devid);
client.println(" HTTP/1.1");
client.print("Host: ");
client.println(serverName);
client.println(“User-Agent: Arduino”);
client.println();
}
else {
if(DEBUG){Serial.println(“connection failed”);}
}

// if there are incoming bytes available
// from the server, read them and print them:
if(DEBUG){
if (client.available()) {
char c = client.read();
Serial.print(c);
}
}

if(DEBUG){Serial.println();}
if(DEBUG){Serial.println(“disconnecting.”);}
client.stop();
}

Brad,

I am not an expert at the Arduino and especially not at programming (more of a hardware guy) but I am using the same sketch and here is what I found. If you un-comment the "//sendToPushingBox(DEVID1)" shown below:

if(DEBUG){Serial.println("pinDevid1 is LOW");} pinDevid1State = false; //Sending request to PushingBox when the pin is LOW //sendToPushingBox(DEVID1)

The program should send a message when the pin goes high and again when it goes low. I tried it and this seems to work. Let me know what you find. Oh and by the way that is a great idea to monitor an emergency generator. I have a generator and will look at my transfer switch first thing in the morning to see if I have a relay closure or other contacts that I can wire to my Arduino or my IOBridge.

Good luck,

Al

Awesome man i didnt see ur post till now. I will try it out tomorrow. Let me know what kinda transfer switch u have and i can help u get some contact points if u aint found em yet. My email Is bradcox5975 at bellsouth.net its faster!

Will that add 6 more apots for dry contacts?

Bump

HI Brad,
I didn’t test it yet but it should work

Just try this (with givin the DEVID2 value):

////
//
// General code from http://www.pushingbox.com for Arduino + Ethernet Shield (official)
//
////

#include <SPI.h>
#include <Ethernet.h>

  /////////////////
 // MODIFY HERE //
/////////////////
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x19 };   // Be sure this address is unique in your network

//Your secret DevID from PushingBox.com. You can use multiple DevID  on multiple Pin if you want
#define DEVID1 "vCD1F3635179D6F4"        //Scenario : "The mailbox is open"
#define DEVID2 "vXXXXXXXXXXXXXXX"

//Numeric Pin where you connect your switch
#define pinDevid1 3  // Example : the mailbox switch is connect to the Pin 3
#define pinDevid2 4

// Debug mode
#define DEBUG true
  ///////
 //End//
///////

char serverName[] = "api.pushingbox.com";
boolean pinDevid1State = false;
boolean pinDevid2State = false;

// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  Serial.begin(9600);
  pinMode(pinDevid1, INPUT);
  pinMode(pinDevid2, INPUT);
  
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  else{
    Serial.println("Ethernet ready");
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
}

void loop()
{
      ////
      // Listening for the pinDevid1 state
      ////
      if (digitalRead(pinDevid1) == HIGH && pinDevid1State == false) // switch on pinDevid1 is ON
      {
        if(DEBUG){Serial.println("pinDevid1 is HIGH");}
        pinDevid1State = true;
        //Sending request to PushingBox when the pin is HIGHT
        sendToPushingBox(DEVID1);
      }
       if (digitalRead(pinDevid1) == LOW && pinDevid1State == true) // switch on pinDevid1 is OFF
      {
        if(DEBUG){Serial.println("pinDevid1 is LOW");}
        pinDevid1State = false;
        //Sending request to PushingBox when the pin is LOW
        //sendToPushingBox(DEVID1);
      }
	  
	  
      ////
      // Listening for the pinDevid2 state
      ////
      if (digitalRead(pinDevid2) == HIGH && pinDevid2State == false) // switch on pinDevid2 is ON
      {
        if(DEBUG){Serial.println("pinDevid2 is HIGH");}
        pinDevid2State = true;
        //Sending request to PushingBox when the pin is HIGHT
        sendToPushingBox(DEVID2);
      }
       if (digitalRead(pinDevid2) == LOW && pinDevid2State == true) // switch on pinDevid2 is OFF
      {
        if(DEBUG){Serial.println("pinDevid2 is LOW");}
        pinDevid2State = false;
        //Sending request to PushingBox when the pin is LOW
        //sendToPushingBox(DEVID2);
      }
}


//Function for sending the request to PushingBox
void sendToPushingBox(String devid){
    if(DEBUG){Serial.println("connecting...");}

  if (client.connect(serverName, 80)) {
    if(DEBUG){Serial.println("connected");}

    if(DEBUG){Serial.println("sendind request");}
    client.print("GET /pushingbox?devid=");
    client.print(devid);
    client.println(" HTTP/1.1");
    client.print("Host: ");
    client.println(serverName);
    client.println("User-Agent: Arduino");
    client.println();
  } 
  else {
    if(DEBUG){Serial.println("connection failed");}
  }
  
  // if there are incoming bytes available
  // from the server, read them and print them:
  if(DEBUG){
    if (client.available()) {
    char c = client.read();
    Serial.print(c);
    }
  }

    if(DEBUG){Serial.println();}
    if(DEBUG){Serial.println("disconnecting.");}
    client.stop();
}

Ill test it as soon as i get home! Thanks!

Can i just keep adding the devid for all the pins?

Hi All,

I'm totally new in this Arduino and pushing box. Managed to find the officiall code from pushingbox.com via http://makeprojects.com/Project/Notifying-Doorbell-with-PushingBox/2165/2

and try our step by step of hardware/software set up, but still could not get notified sms when pressed the doorbell. Can you all help me with it?

Follow the instruction, i changed the mac address which found at the sticker of ethernet shield, and copy/paste the devid code from senarios, please guide me beside these 2, whereelse i need to change?

Thanks for your help, and any guides/suggestion will be much appreciated.