Suggested pathway for expanded project

So I have recently reinstalled cayenne onto a raspberry pi and moved to the Agent 2.0.

Using the Add device for a raspberry pi I have set it up with essentially the same as I had with Agent 1.0: Some “two state” sensors which when they change state send email to alert me while others trigger relays etc.

One feature I would like to add is to delay a water pump powering up for 30 mins following a house power failure. Of course, in the event of a power failure the raspberry pi will crash at the same time and then reboot upon power being restored.

I cannot see a way to do this within the raspberry pi cayenne control dashboard. Would this be possible if I use it via “Bring your own device” and learn to use the mqtt process or would I be better to learn about webhooks?

If I could be pointed to resources to learn these and install and use with cayenne? I am largely ignorant to coding except from the basic raspberry pi commands - which is of course what drew me to Cayenne in the first place!

Many thanks

you can give this a try.

  • You have a two-state sensor connect to your raspberry pi.
  • connect your water pump to a Arduino with an ethernet shield or use an Esp8266 device and power it using batteries. connect it to cayenne. add a button widget “water pump” to your dashboard.
  • add a trigger when raspberry pi is offline then turn on button widget “water pump”
  • when there is a power cut-off this will turn on the button widget on.
  • once it is on, you can use miilis() to turn on water pump after 30 minutes.

i have not tested this out. you can give it a try and let me know.

Thanks. I’ve been meaning to buy an arduino so will get one this week. I’m sure it will be useful regardless!

Reading back on how I wrote my question I could have been clearer:

There is in fact two pumps. Both normally run 24/7.

In the event of a power failure both pumps will shut down. The first pump is connected to the mains and will restart as soon as power is restored (obvs).

I need the second pump to restart 30 minutes after the first pump restarts (ie 30 mins after power is restored.

a simple programme on Arduino can do it.

unsigned long lastMillis = 0;
int x;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  if (millis() - lastMillis > 1800000) {
    lastMillis = millis();
    if (x == 0)
    {
      // turn on your relay after 30 min
      Serial.println("turning on relay ");
      x = 1;
    }
  }
}
1 Like