Time-limited watering #201
Replies: 3 comments 9 replies
-
Hi Per, I'm currently on a small vacation to beautiful |
Beta Was this translation helpful? Give feedback.
-
Hey Per, Upon looking at the Irrigation.ino sketch, I think the best way to accomplish what you want is essentially what you described. Instead of sending "1" as the data to turn on the relay, you would send the number of seconds that you would like it turned on for. This is a great idea, but I would have to think of a way to implement it into the main example sketch without affecting backwards-compatibility. If changed now, existing users might send "1" expecting it to turn on the relay permanently, but only turn it on for one second instead. Perhaps a negative integer could indicate time. Then "-1" would turn it on for one second, but "1" would still turn it on permanently. Additionally you will have to set up a system of timers. There are a few libraries that would make this pretty easy, but it's also a great learning experience to do this yourself. You can take a look at this code to see how I made a scheduler for internal gateway functions. It may help to study "function pointers" a bit first. I'll be happy to break that code down a bit if you need help with it. It would confuse me too if I didn't write it. Another thing of note is that timekeeping will be added within the next couple of months. This will add another level of possibilities, like telling the relay what exact time of day you want it to shut off. I will probably revisit the Irrigation sketch once timekeeping is added, but in the meantime these changes will be up to you! |
Beta Was this translation helpful? Give feedback.
-
What is the best method to avoid watering forever?
I am looking for a method to automatically turn off a coil after an optional amount of time. I use MQTT.
My suggestion is to send a timeout via MQTT in "DataReading.d", so that DataReading.d=0 means off, DataReading.d=xxx means off after xxx seconds. And then build the timer into the controller.
Eg MQTT payload: [{"id": 12601,"type": 0,"data": 180}] to turn off coil no 12601 after 180 seconds.
Looking forward to hearing your suggestions, thanks
Beta Was this translation helpful? Give feedback.
All reactions