ON off for 5 seconds

How can i use a button to switch on for say 5 seconds then turn off?

you can send the OFF state back to cayenne on two-state widget and add a trigger to it to turn off the button.

is there a way to put a delay. so if the switch is on then turn off after 5 seconds

this is what you need to do.
Steps:-

  1. read button state.
  2. turn ON
  3. wait for 5 second
  4. make variable state = true
  5. turn OFF
  6. if state == true publish value 1 to two-state widget.
  7. make variable state = false
  8. add a trigger to the two-state widget.
  9. if two-state == 1thenturn OFF button`

Is that meant for me to code it? if so I dont know how, I use cayenne for its drag and drop abilities. would it be easier on a raspi?

yes, for trigger like the one you want, you have to do it in the code.

Do you know of somewhere someone would code this for me? I’d be willing to pay.

you don’t need to pay me but you can buy me a cup of coffee if we meet. Give it a try to add the code and if you are stuck, then share it the code and i will you with it.

Sounds like a plan man. after all the help your giving me thats the least i could do. (except spread the word about this platform).

Where should i start with this? what sketch would you recommend starting with and then if you dont mind a more simplified version (i hate to ask that as any help is helpful).

Thanks so much for your time, Best regards and stay healthy

-Nick

it is the same project with nodemcu and pump? can you share the code that are using.

So yes and no is it the same project. Let me tell you what i’m trying to do. First Im looking to hookup a peristaltic pump that will run for 5 seconds then stop. I want it to do this every hr if and only if the ph is out of certain parameters.

Secondly, my pool light I’m ULTIMATELY working on. I need to be able to turn it on and off. now the complicated part. the pool light has to be controlled by flipping a switch x (1-16) amount of times. for instasnce switching my pool light on and off say 6 times to achieve the color red. 8 times to achieve blue and so on. I’ve attached a link to the manual for further explination. The applicable part is on Pg.2

Thank you for your time and guidance,
-Nick

Pentair amerlite led color changing manual

I know this is a lot and will be a challenge for someone like myself but im up for it.
so far the peristaltic pump is hooked up using a raspi and the 2 state widget connected to that gpio.

This will be simpler if we do it with a nodemcu in-place of raspberry pi.

i am not sure how this will work, but have got any result with the controls?

sorry i’ve been out of town for the week. I have a node mcu I just dont know where to start with the actual programming. Any suggestions? I’m able to connect using the example sketch for esp8266, but beyond that im lost haha. Thanks for your help in advance.

stay healthy,
-nick

as for the pool light lets worry about that second haha.

you need to use this library https://github.com/myDevicesIoT/Cayenne-MQTT-Arduino and the code example for nodemcu is in exmples —> connection ----> esp8266.