- openHABian v3 on rPi 4 4GB
This is a generic MQTT query… (hence, I did not state the environment in detail).
When I subscribe to a topic, I can see messages pop in when they are sent to the topic.
I also have a topic that instantly gives me a message that has been published in the past.
It is this topic that has me puzzled, as to why that is.
More specific: I have a tank level meter that:
- reports the water level, which it publishes every 60 seconds
- subscribes to a minimum level
- subscribes to a “permit advertising my water demand” topic (AllowDemand [on|off])
- publishes a demand message (when permitted to do so) (WaterDemand [on|off])
This controller has been working flawlessly for almost ten years. (No firmware or other system changes where made.)
That is, when the tank level is under the demand level, it advertises its demand and fills the tank up to 100%. Done. Easy.
However, in recent days, it may occasionally fill the tank to any random level above the minimum demand level and stops filling.
I have analysed the controller code, and for the life of me, I cannot find a fault in the software.
However, what I did observe is, that whenever I subscribe to AllowDemand, it shows OFF; even when it was just switched ON, and the controller has received ON.
Here are three terminals I have used.
The first to issue ON
# [2023-10-20 15:34] maxg@x570 ~ $ mosquitto_pub -h 192.168.1.5 -t ArgyleCourt/Property/IrrigationTank/AllowDemand -m ON
The second was subscribed to the same topic:
# [2023-10-20 15:31] maxg@x570 ~ $ mosquitto_sub -h 192.168.1.5 -v -t ArgyleCourt/Property/IrrigationTank/AllowDemand/# | xargs -d$'\n' -L1 sh -c 'date "+%Y-%m-%d %T.%3N $0"' 2023-10-20 15:32:50.007 ArgyleCourt/Property/IrrigationTank/AllowDemand OFF 2023-10-20 15:34:43.760 ArgyleCourt/Property/IrrigationTank/AllowDemand ON 2023-10-20 15:45:00.423 ArgyleCourt/Property/IrrigationTank/AllowDemand OFF
The third was subscribed to, a minute after publishing ON:
# [2023-10-20 15:36] maxg@x570 ~ $ mosquitto_sub -h 192.168.1.5 -v -t ArgyleCourt/Property/IrrigationTank/AllowDemand | xargs -d$'\n' -L1 sh -c 'date "+%Y-%m-%d %T.%3N $0"' 2023-10-20 15:37:09.735 ArgyleCourt/Property/IrrigationTank/AllowDemand OFF 2023-10-20 15:45:00.423 ArgyleCourt/Property/IrrigationTank/AllowDemand OFF
The OFF at 15:45 was published by openHAB (as programmed.
To answer the question “why?” … we run electricity as an off-grid system (though with the grid as backup), and the tank is only allowed to publish its demand between 14:00 and 15:45, when we have the most excess solar PV generation.
Here an example log output from OH, where filling water was swithced off at a random level, and I issued the AllowDemand via command line publish to keep the filling going.
2023-10-20 14:01:00.768 [INFO ] [openhab.core.model.script.Water.4.01] - Tank_Irrigation_Demand_Allow........: ON 2023-10-20 14:01:50.314 [INFO ] [openhab.core.model.script.Water.8.01] - TheHub: Irrigation tank valve is....: ON (at 84 %) 2023-10-20 14:01:50.377 [INFO ] [penhab.core.model.script.Water.10.01] - Bore Pump: total starts.............: 1747 2023-10-20 14:30:50.294 [INFO ] [openhab.core.model.script.Water.6.01] - Tank_Irrigation_Demand..............: OFF 2023-10-20 14:30:50.298 [INFO ] [openhab.core.model.script.Water.8.01] - TheHub: Irrigation tank valve is....: OFF (at 93 %) 2023-10-20 14:30:50.312 [INFO ] [penhab.core.model.script.Water.11.01] - Bore Pump...........................: stopped 2023-10-20 15:26:50.250 [INFO ] [openhab.core.model.script.Water.8.01] - TheHub: Irrigation tank valve is....: ON (at 93 %) 2023-10-20 15:26:50.300 [INFO ] [penhab.core.model.script.Water.10.01] - Bore Pump: total starts.............: 1748 2023-10-20 15:45:00.769 [INFO ] [openhab.core.model.script.Water.5.01] - Tank_Irrigation_Demand_Allow........: OFF 2023-10-20 15:45:20.222 [INFO ] [openhab.core.model.script.Water.6.01] - Tank_Irrigation_Demand..............: OFF 2023-10-20 15:45:20.222 [INFO ] [openhab.core.model.script.Water.8.01] - TheHub: Irrigation tank valve is....: OFF (at 99 %) 2023-10-20 15:45:20.237 [INFO ] [penhab.core.model.script.Water.11.01] - Bore Pump...........................: stopped
So the question is: why is AllowDemand always OFF when I subscribe in a terminal to it?
While I make heavy use of MQTT, I use it in its basic config, no last will testament, or quality of service, other than the defaults.
Any hints where to look for the culprit would be much appreciated.
My theory is, if what I am seeing, that AllowDemand is always OFF, then what publishes OFF? But, why does the controller keep filling, if “I” see OFF, but the controller sees ON. I don’t know that for sure, but it must be that way, because the controller reacts to OFF (as published at 15:45).
Yes, this is doing my head in; and after spending two days on solving this puzzle, I thought I post here. Thanks.