OpenSprinkler Forums OpenSprinkler Unified Firmware Announcing OpenSprinkler Unified Firmware 2.1.9(4) Reply To: Announcing OpenSprinkler Unified Firmware 2.1.9(4)

#67771

dkkim
Participant

Hello All,

Thanks to Ray (see: https://opensprinkler.com/forums/topic/easy-debug-setup/#post-67770) I was able to get some more debugging info. Also looked at code further.

I figured out that raw events for sensor1 (used for flow in the OSPi 1.4) are not actually logged via MQTT since the logic does not check for a SENSOR_TYPE_FLOW, only for RAIN or SOIL types. If I make the following patch, then it works:

 /** Read rain sensor status */
 void OpenSprinkler::detect_binarysensor_status(ulong curr_time) {
        // sensor_type: 0 if normally closed, 1 if normally open
-       if(iopts[IOPT_SENSOR1_TYPE]==SENSOR_TYPE_RAIN || iopts[IOPT_SENSOR1_TYPE]==SENSOR_TYPE_SOIL) {
+       if(iopts[IOPT_SENSOR1_TYPE]==SENSOR_TYPE_RAIN ||
+               iopts[IOPT_SENSOR1_TYPE]==SENSOR_TYPE_SOIL ||
+               iopts[IOPT_SENSOR1_TYPE]==SENSOR_TYPE_FLOW) {
                pinModeExt(PIN_SENSOR1, INPUT_PULLUP); // this seems necessary for OS 3.2
                byte val = digitalReadExt(PIN_SENSOR1);

Note that the reason I want to do this is to read raw flow sensor events for fine-grained water use tracking and leak detection in my hybrid surface/buried drip system. I have a 1 gallon/cycle reed switch flow meter, so events aren’t too frequent. MQTT seems a great way to glue all this together.

Question for Ray and the other devs:
Was the intention to omit flow sensor raw events from MQTT? Or is that an oversight? I.e. Is there any reason not to enable these as I did?
If you are amenable, I will prepare a pull request…

Thanks,
David