If I understand you correctly, you are not measuring rain or soil moisture. Effectively the sensors are a switch – they just switch on (open state) once the sensor reaches a certain preset level, as defined by the sensor, NOT OpenSprinkler. They switch off (normally closed) once the value of whatever they’re measuring drops below the sensor threshold. There are variables (on and off delays) that give some hysteresis in order to prevent false positives and avoid thrashing.
Flow sensors are different as they actually read flow data while a program is running and will display realtime flow data (at the footer) and display total flow when the program ends.
What’s the memory usage and cycle time of the current OpenSprinkler code?
Just wondering how much room there is to add features with the spare analogue, I2C and SPI pins, etc.
How many digital I/O ports on the microcontroller are free?
How many analogue ports are available?
As a basic hack, would it be possible to multiplex sensor signals onto the sensor pins with a “number of sensors per pin” variable so that multiple “alerts” could be processed with the same sensor input pin? That would meet most of the requirements of what I (and I suspect many others) might want? Especially as we could then get away with alert sensors as are currently implemented. (It might require few code changes especially if the sensor reading block is implemented as a function).
8 sensor inputs would require 4 I/O pins. 16 sensors would require 5 pins. Each additional sensor would require three extra variables (value, on_delay, off_delay) along with the code required to cycle through reading each sensor.
Another option without using microcontroller I/O ports is to use RF as per your other adventures with weather sensors and power sockets. Would either need an addressing scheme or a form of multiplexing.
Thoughts? Am I understanding things correctly? (Generally if I think I understand something, I’m not really comprehending the full complexity of a situation). 😉