|
Post by papa on Nov 25, 2016 22:46:57 GMT
Water Level Monitor Node, Type 2 Thread Updated April 5, 2019 for openHAB 2.5.0.M1, MQTT 2.x Binding, & the Embedded MQTT Broker
Today I finished building, programming, & installing a Type 2 RFM node to monitor water levels (in my case, still within my sump pump hole). With the "type 1" node (which I documented as " Sump Monitor Node"), an ultrasonic sensor at the top of the sump hole uses ultrasonic sound waves to measure the distance to the water surface. So far this node (& the OpenHAB programming), basically works to measure & signal safe levels, & levels that are too low (pump stuck on) or too high. Not too many connections are required to build the node. While this node is serving its purpose, readings from this node bounce around a lot (I guess because of the "fuzzy" surface of trickling water in the sump hole). For the "type 2" of a node to monitor water levels, probes are placed at various levels in the water container & when the probes are covered by water, transistors amplify the probe's output for the Arduino program sketch to read. On the internet, you may have seen the many examples of this principle being used to directly light LEDs according to the water level. I've seen a couple examples of an arduino type device controlling this monitor. In fact, I adapted a schematic & a program sketch (provided below) which I used to test the water level reading ability of the basic principle. Once that was working, I installed an RFM69 radio on the node & added the water level code to my Multi-Choice End Node version (also provided below) of the computourist end nodes. So far, the type 2 water level node signals straightforward changes in water level status (not bouncing around like for type 1). Since electrified probes like for type 2 can supposedly corrode faster due to electrolysis, my design uses an Arduino digital pin (d7) to power the probes briefly every 60 seconds just before the water level status is sent via the gateway & then power to the probes turns off. Because this type 2 method measures one less level than the number of probes (because the lowest probe is "common" to the others), a limited number of levels are measured (Besides the common probe, I use 3 other probes which require 3 Arduino pins plus the pin to power the probes.) Building the type 2 water level node is more challenging (See the schematic below): The four probes all connect to d7 that powers them. The three transistors each have 3 pins & each of the 3 pins have 2 or 3 connections to them. As for type 1, the water level status that the node sends to OpenHAB can be massaged to use dynamic icons to visually display the status. Both types have advantages & disadvantages. I will let them operate side by side & see how they compare.
|
|
|
Post by papa on Nov 25, 2016 23:47:20 GMT
Water Level Monitor Node, Type 2, Schematic
<< Click on pic for larger view ^^ Note that there are a range of choices for the parts used. For one set of 3 resistors, choose a value between 470 ohms & 1 kilo ohms. I have successfully used 550 ohms & 1 K (1,000) ohms. For the other set of 3 resistors, use a value between 220 kilo ohms & 470 kilo ohms. For the set of 3 transistors, choose an NPN type. I used BC547. To build this, you'll probably need to make & install a 3.3 volt friendly shield on top the Arduino compatible. ====================================== Added 6/10/2017: ^^ This Leak Detector Node schematic could be the first stage of a Water Level Monitor Node. This schematic only has two probes, the common probe & the probe connected to A3. This schematic also untangles some of the connections. For example, note the different view of how the bottom resistor connects to the transistor's base.
|
|
|
Post by papa on Nov 26, 2016 0:57:05 GMT
Preparation for the Water Level Monitor Node Updated April 5, 2019
Needed in order for the following to work: See this thread on achieving an RFM69 Gateway & RFM69 nodes. See this thread on installing openHAB/MQTT on a local network-connected computer.
Suggestion: To get a feel for the water level monitoring circuit, you might build part of the above schematic using a 3.3 volt Arduino & a solderless breadboard. To the Arduino, start with connecting what is needed for the common probe & the low level probe (A3) . This way you can troubleshoot a more limited number of connections & get an idea of the layout you need for making all the schematic connections. At this point, for the common & lowest probe, you can use 2 short wires (insulated, but bared on both ends). << Make sure you connect the transistor correctly. This picture helps relate the actual transistor (viewed from its flat side) with the representation in the schematic above. Water_Lvl_03.ino (1.6 KB) << Next you can download this test program sketch, upload it to the Arduino using the IDE, & run the IDE's serial monitor at 115200. With only the common probe in the same container of water, you should see "Water level No water" on the serial monitor. With the common AND the lowest probe in the water container, you should see "Water level low." There will be a 30 second delay between outputs on the serial monitor while the probes are powered down. In the final sketch this power down should help prevent corrosion on the probes. Once you get the common & lowest probes working, you can add the other two probes one at a time. Then you can add the RFM69 radio. On the final node, you can mount the probes on some stiff, insulated "stick" (plastic?). I used a length of small diameter PVC pipe. Each probe is a length of insulated wire, one end bared to connect to the Arduino pin & the other end bared to mount exposed on the "stick" at the level you choose for it. The common probe is mounted very near the bottom, next the A3 probe, next A4 probe, etc. The programming generates an integer code 0-3 indicating the highest level covered by water. In translating the code to a text status, you could use general terms like the low, middle, high. Or for example, you could mount ends of the probes at 3 inches, 6 inches, & 9 inches & have the codes generate those statuses. The wireless node's programming (below) will use the same principles & similar coding for monitoring water levels.
|
|
|
Post by papa on Nov 26, 2016 0:59:23 GMT
Water Level Monitor Node, Programming
GO HERE to download the latest node choices sketch ( updated frequently) & achieve initial customization. These provide the Water Level Monitor Node Programming. (Note: this sketch can be customized for several types of nodes with separate or combined functions. See the list here.) With the Arduino IDE, appropriately add this to the initial customization of the sketch: ================= UNcomment (no // at the start) this item: #define WATERLEVEL ======================= #define NODEID 05 << change 05 to a unique number in your RFM69 network (For this water level node, I suggest you use NODEID 21 as I will below.) With Arduino IDE running on a computer & the Water Level Monitor Node 21 connected via USB, upload the sketch program to the node. Then with the node still on USB, the Gateway successfully running connected to your Ethernet network & the IDE serial monitor running at 115200 baud, the serial monitor (in DEBUG mode) will display connection & data info about the node. << Fulfill the conditions in this paragraph to see if things are working so far. This node generates a compound code: The code's tens digit indicates the highest level probe that is covered. The code's ones digit shows the just previous level code. For example, 10 means "too low (0)" became "safe low (1)" 11 means "safe low for the last two readings." 32 means "safe top (2)" became "too high (3). OpenHAB config entries (next post) will use these codes to communicate more useful data about the water level.
|
|
|
Post by papa on Nov 26, 2016 1:00:51 GMT
Post Content Deleted
Space Preserved for Future Use
|
|
|
Post by papa on Nov 28, 2016 0:03:31 GMT
OpenHAB Configurations To Communicate with A Water Level Monitor End Node Updated April 5, 2019
(Presupposes NODEID is 21. In the following, replace 21 with the NODEID you assign) PaperUI\configuration\Things Add Thing (click + in blue disc) click MQTT Binding Add Manually Generic MQTT Thing Node21 Location (arbitrary physical location) Base MQTT Broker - mqtt:systemBroker:embedded-mqtt-broker save (click check mark in blue disc)
PaperUI\Configuration\Things\Node21 Add 3 channels (click + in blue disc)
Type: Text Type: Number Channel ID Node21Channel02 Channel ID: Node21Channel04 Label: Node21_RSSI Label: Node21_Volts MQTT State Topic: home/rfm_gw/nb/node21/dev02 State topic: home/rfm_gw/nb/node21/dev04
Type: Number Channel ID: Node21Channel66 Label: Water_Data21 State topic: home/rfm_gw/nb/node21/dev66
================== Add to transform files: ------------------------ water.map (387 B) << Download this file & add it to this folder: For Windows, C:\openhab\configurations\transform For Linux (incl. Raspberry Pi), /etc/openhab/configurations/transform ================== WaterLevel.items (517 B) << Download & save to OpenHAB 2's \conf\items folder ( updated April 5, 2019) This file contains items for Node 21 radio signal strength, voltage, water status message, & water level (%).
Important: Link this file's items to the above matching channels.
================== This file translates the water level code into a percentage to be shown in the Water_Display icon. It also provides commented areas where one can send email messages of warnings or all clears. ================== Changes for the icons: ------------------------ If you did not do it before, follow the directions in this Nov 20, 2016 post on changing & downloading the icons. (For this node, disregard that Nov 20, 2016 post after the icon instructions.) ================== Add to sitemap file entries: ------------------------ Text item=Water_Stat21 Text item=Water_Display valuecolor=[>90="red",>40="green",>0="green",<=0="red"] If you stopped OpenHAB, restart it.
Note: This thread documents having OpenHAB email data notices to us
|
|
|
Post by papa on Nov 28, 2016 21:15:22 GMT
Display Water Level Monitor Data on the OpenHAB User Interface
Powered, the Water Level Monitor Node should be ready to connect & work with the Gateway & with a computer's running MQTT service & OpenHAB. Once the node & OpenHAB (& its configuration files) are started & working, have your browser display the Classic User Interface (UI) by entering the address http://localhost:8080/openhab.app?sitemap=My [ ^^ … IF the first line of your sitemap config file starts with: sitemap My Change accordingly for a different first line. ] Or view / control your DIY home automation network via your smart phone: See my Success... thread at the end of the Oct 17, 2015 at 6:10pm post. For further testing, power the Sump Monitor Node via the USB of the programming computer or separately. On the OpenHAB User Interface’s main page, you should see the Water Status & Water Level plus a percentage. The icons on the Water Level item should change dynamically based on the level & status.
|
|
|
Post by papa on Nov 2, 2018 18:39:26 GMT
Water Level Node, Fixing Erratic Results
In early Oct. 2018, this Water Level Node started giving erratic results: It would report very low or very high values even if the actual level was OK. Then at the end of Oct., its reported levels did not change though the sump cistern levels were changing. What could be causing this & how do we fix it? See the 2 following quotes & the clues I bold-faced.
In this thread's first post above, I wrote "Since electrified probes like for type 2 can supposedly corrode faster due to electrolysis, my design uses an Arduino digital pin (d7) ." In this post above, I wrote, "On the final node, you can mount the probes on some stiff, insulated "stick" (plastic?). I used a length of small diameter PVC pipe. Each probe is a length of insulated wire, one end bared to connect to the Arduino pin & the other end bared to mount exposed on the "stick" at the level you choose for it. The common probe is mounted very near the bottom, next the A3 probe, next A4 probe, etc."
This thread's first post is dated Nov. 25, 2016. Thus, this probe (which spends most of its time UNpowered) lasted almost 2 years without needing maintenance. I guessed that corrosion had finally compromised the water level probe. I rubbed clear vinegar & then steel wool on the bared ends of the probe's wiring (at least the sides of the bared ends that were accessible).
To delay corrosion more, I'm changing how often the node's programming powers the probes briefly just before the water level status is sent via the gateway & then turns off power to the probes. This is increased from 30 seconds to usually every 60 seconds.
The water level node is now working again. Lesson learned: Watch for erratic data & clean corrosion as necessary.
Next, Add a Vibration Sensor to the Water Level Node
|
|
|
Post by papa on Nov 3, 2018 15:44:06 GMT
Add a Vibration Sensor to the Water Level Node Updated July 24, 2020
Caution: The vibration sensor in the following instructions failed fairly quickly. Perhaps it could not handle my sump pump's frequent runs. Also I installed the sensor hanging over the top of the open sump cistern & the sensor board got corroded. My sump water level node now uses a sound sensor. To avoid corrosion, I installed it near the sump piping's check valve & NOT directly over the sump cistern. The sound sensor has been reliable for many months so far. To use a sound sensor, skip ahead to the posts starting here. In case you still want to use a vibration sensor, I leave the instructions that follow immediately here. This previous thread documents working with Vibration Sensors. This current thread documents how I added a vibration sensor to the Water Level Node. I've been using the Water Level Node to monitor my sump pump's cistern. I wanted to add a vibration sensor to monitor when the sump pump was off & on & add that information to the monitoring. I used 3 (color-coded) male to female dupont cables to connect the vibration sensor to the node's Arduino. To avoid corroding the sensor, I now recommend placing the sensor board on the sump pump's exit pipe near the check valve (NOT over the sump cistern). < Forum Members (free registration), click on pic for larger view ^^ Schematic for adding Vibration Sensor to the Water Level Node Next, Programming the Water Level Node with Vibration Sensor
|
|
|
Post by papa on Nov 3, 2018 16:09:28 GMT
Programming the Water Level Node with Vibration Sensor (Updated Nov. 27, 2018)
Get the sketch & the customizing via this post above. This sketch includes special programming to provide reliable & accurate sensing of vibrations.
Before you upload the programming to the node, add this customizing: Besides UNcommenting (no // at the start) this option: #define WATERLEVEL Also UNcomment these defines: // #define sample_tsai // #define VIBR_tsai
Caution: Do NOT UNcomment // #define MIC_tsai on the same node VIBR_tsai & MIC_tsai will conflict with each other.
Next, OpenHAB Config Files Entries for the Water Level Node with Vibration Sensor
|
|
|
Post by papa on Nov 4, 2018 19:35:09 GMT
OpenHAB Configurations for
the Water Level Node with Vibration Sensor (Updated April 5 & 13, 2019)
(Presupposes NODEID is 21 in the node sketch. In the following files, replace 21 with the NODEID you assign) Create the Thing, 3 channels, & other configs in this post & add the following: PaperUI\Configuration\Things\Node21 Add a channel (click + in blue disc)
Type: Number Channel ID: Node21Channel71 Label: Node21VibVal State topic: home/rfm_gw/nb/node21/dev71
If from this post above you have the WaterLevel.rule s file in OpenHAB 2's \conf\ rules folder, disable it (rename it WaterLevel.rule r). Vib_Sense21.items (245 B) << Download & save this file also to OpenHAB 2's \conf\ items folder
Important: Link one item from the above file to the above matching new channel 71.
If this rule finds that vibration is NOT happening, it avoids messaging that the sump cistern is stuck low because the pump is stuck running. To the sitemap file in the \conf\ sitemaps folder, add (near entries this post lists): Switch item=Node21VibState Text item=Node21VibVal Text item=vibration_time
|
|
|
Post by papa on Nov 4, 2018 20:44:17 GMT
OpenHAB User Interface Results from
the Water Level Node with Vibration Sensor (Updated Nov. 27, 2018)
<< Forum members, click on pic for larger view. ^^ One User Interface display after sump pump has just run.
Hint: If the User Interface does not display updated water & vibration values without refreshing the browser, try stopping & re-starting the OpenHAB2 service.
A sump pump like mine normally runs a short time, maybe 8 to 10 seconds. In those cases, the Node21VibState switch will be seen on only briefly. If the sump pump sticks in the on position (not good), then this switch will be visibly on. The above rule can send a warning email about this.
When the node detects vibration, the "Pump on or off timestamp" gives some sense when the pump last ran. Again given my sump pump's normally short run, the node & VibValue21 generally show a small amount of seconds, perhaps 8 or so. Via the above sketch's improved coding, VibVal21 will now report vibration seconds, accurate with 1 or 2 seconds. When vibration starts, it reads 0 seconds. When vibration stops, seconds will be negative, indicating a PAST vibration that has stopped.
|
|
|
Post by papa on Apr 12, 2019 16:00:51 GMT
Node Choices Sketch & Optional Vibration Sensor The above thread was ... Updated April 5, 2019
For openHAB 2.5.0.M1, MQTT 2.x Binding, & the Embedded MQTT Broker
As I wrote above: "With a length of insulated wire, I fastened the sensor board to a pipe above the top of the sump cistern."
After a while, the node became erratic in detecting the pump's on/off & how long on. I better secured the sensor to the pipe & now it is working. I will continue to monitor.
|
|
brump
Junior Member
Posts: 81
|
Post by brump on Apr 16, 2020 10:38:32 GMT
Hello papa, I was away from home automation projects, as I was developing a 4K subsea camera project, and an ROV. But little by little, I will be back. I have been working on the MPX5XXX sensors (MPX5010, MPX5100) for measuring water levels. Some ultrasonic sensors have been completely corroded by the chlorine vapor present in a cistern. The water has high levels of chlorine. These sensors solved the problem.
papa: Good to hear from you brump. I moved your post to this thread to keep it with related material. Yes, I tried again with an ultrasonic sensor node at the top of a perforated pipe inserted into my sump cistern. It was still not reliable & the humidity corroded the sensor. The water level sensor above & the sound sensor have still been working very reliably.
I hope that you will later document how you connected & programmed for the MPX5XXX sensors.
|
|
|
Post by papa on Jul 24, 2020 19:20:55 GMT
Add a Sound Sensor to the Water Level Node Instead of the Vibration Sensor Above
Note: If you used the vibration sensor in above posts, remove that sensor from the attached wires. Keep the wires attached to Arduino D4 & GND connections. Move the wire from Arduino A0 to D5.
This previous thread documents working with Sound or MIC Sensors. This & following posts document how I added a sound sensor to the Water Level Node. I've been using the Water Level Node to monitor my sump pump's cistern. I wanted to add a sound sensor to monitor when the sump pump was off & on & add that information to the monitoring. I used 3 (color-coded) male to female dupont cables to connect the vibration sensor to the node's Arduino. To avoid corroding the sensor, I recommend placing the sensor board on the sump pump's exit pipe near the check valve (NOT over the sump cistern). < Forum Members (free registration), click on pic for larger view ^^ Schematic for adding Sound Sensor to the Water Level Node Next, Programming the Water Level Node with Sound Sensor
|
|
|
Post by papa on Jul 24, 2020 19:36:18 GMT
Programming the Water Level Node with Sound Sensor Get the sketch & the customizing via this post above. This sketch includes special programming to provide reliable & accurate sensing of vibrations.
Before you upload the programming to the node, add this customizing: Besides UNcommenting (no // at the start) this item: #define WATERLEVEL
Make sure #define VIBR_tsai is commented (// at the start)
Also UNcomment these items: // #define sample_tsai // #define MIC_tsai
Caution: Do NOT UNcomment // #define VIBR_tsai on the same node VIBR_tsai & MIC_tsai will conflict with each other.
Next, OpenHAB Config Entries for the Water Level Node with Sound Sensor
|
|
|
Post by papa on Jul 25, 2020 19:48:56 GMT
OpenHAB Configurations To Communicate with A Water Level Monitor End Node Updated April 5, 2019
Do the following instructions in this post IF you did NOT do them for this above post:
(Presupposes NODEID is 21. In the following, replace 21 with the NODEID you assign) PaperUI\configuration\Things Add Thing (click + in blue disc) click MQTT Binding Add Manually Generic MQTT Thing Node21 Location (arbitrary physical location) Base MQTT Broker - mqtt:systemBroker:embedded-mqtt-broker save (click check mark in blue disc)
PaperUI\Configuration\Things\Node21 Add 3 channels (click + in blue disc)
Type: Text Type: Number Channel ID Node21Channel02 Channel ID: Node21Channel04 Label: Node21_RSSI Label: Node21_Volts MQTT State Topic: home/rfm_gw/nb/node21/dev02 State topic: home/rfm_gw/nb/node21/dev04
Type: Number Channel ID: Node21Channel66 Label: Water_Data21 State topic: home/rfm_gw/nb/node21/dev66
================== Add to transform files: ------------------------ water.map << Download this file & add it to OpenHAB 2's \conf\transform folder ================== WaterLevel.items << Download & save to OpenHAB 2's \conf\items folder ( updated April 5, 2019) This file contains items for Node 21 radio signal strength, voltage, water status message, & water level (%). ================== This file translates the water level code into a percentage to be shown in the Water_Display icon. It also provides commented areas where one can send email messages of warnings or all clears. ================== Changes for the icons: ------------------------ If you did not do it before, follow the directions in this Nov 20, 2016 post on changing & downloading the icons. (For this node, disregard that Nov 20, 2016 post after the icon instructions.) ================== Add to sitemap file entries: ------------------------ Text item=Water_Stat21 Text item=Water_Display valuecolor=[>90="red",>40="green",>0="green",<=0="red"] If you stopped OpenHAB, restart it.
Note: This thread documents having OpenHAB email data notices to us
Next, OpenHAB Configs for a Water Level Node with Sound Sensor
|
|
|
Post by papa on Jul 26, 2020 18:16:02 GMT
OpenHAB Configurations for
the Water Level Node with Sound Sensor (Presupposes NODEID is 21 in the node sketch. In the following files, replace 21 with the NODEID you assign) Create the Thing, channels, & other configs in the post just above & add the following:
PaperUI\Configuration\Things\Node21 Add a new channel 71 (click + in blue disc):
Type: Number Channel ID: Node21Channel71 Label: SndVal21 State topic: home/rfm_gw/nb/node21/dev71
If from this post above you have the WaterLevel.rule s file in OpenHAB 2's \conf\ items folder, disable it (rename it WaterLevel.rule r). Snd_Sense21.items (265 B) << Download & save this file also to OpenHAB 2's \conf\ items folder
Important: Link one item from the above file to the above matching new channel 71.
If this rule finds that vibration is NOT happening, it avoids messaging that the sump cistern is stuck low because the pump is stuck running. To the sitemap file in the \conf\ sitemaps folder, add (near entries this post lists): Switch item=Node21SndDigiState Text item=Node21SndVal Text item=sound_digi_time21 Text item=switchTrips
Node21SndDigiState turns on while the sensor hears the pump run Node21SndVal tracks how long the pump sound ran the last time.
sound_digi_time21 time stamps the last time the pump ran switchTrips counts how many times the pump has run.
|
|
|
Post by papa on Jul 26, 2020 20:38:00 GMT
Results from the Water Level Node with Sound Sensor My sump water level node now uses a sound sensor. To avoid corrosion, I installed it near the sump piping's check valve & NOT directly over the sump cistern. The sound sensor has been reliable for many months so far.
A sump pump like mine normally runs a short time, maybe 8 to 10 seconds. In those cases, on the User Interface, the Node21SndDigiState switch will be seen on only briefly. If the sump pump sticks in the on position (not good), then this switch will stay visibly on. The above rule could send a warning email about this. When the node detects vibration, the "Pump on or off timestamp" gives some sense when the pump last ran. Again given my sump pump's normally short run, the node & Node21SndVal generally show a small amount of seconds, perhaps 8 or so. Via the above sketch's improved coding, Node21SndVal reports vibration seconds, accurate within 1 or 2 seconds. When vibration starts, it reads 0 seconds. When vibration stops, seconds will be negative, indicating a PAST vibration that has stopped. The switchTrips item counts how many times the pump has run since the count started. If the User Interface starts showing a 110% water level & pump runs are reaching a high level, it may be time to replace the sump pump or at least the sump pump's switch.
|
|
|
Post by papa on Jul 26, 2020 20:54:16 GMT
Water Level Node Proves Itself AgainThe water level sensor on the above node can detect 4 levels, 1) Too low (represented by 0%), 2) safe low (represented by 40%), safe high (90%), & too high (110%). Ideally openHAB reports smooth transitions between safe low & safe high. Too high means the sump switch is not reliably triggering on. Too low means the sump switch is stuck in the on position. Both too low & too high indicate that the sump switch is becoming questionable. (Usually the pump is still functional & I use a kit to replace the pump switch.) My sump pump runs constantly all year long. (For one thing, I live at the bottom of a hill.) After a rain of maybe 3 inches & a few days of dry weather, the sump ran every 5 minutes. Even in extended dry weather, the sump runs at least once per day, maybe more. Over 13 years of living here, I believe I've replaced sump switches about every 18 months. However, I just recently had to replace a switch after only 9 months of operation. More & more frequently, openHAB's user interface showed "Too high, 110%" before the sump switch would finally trip. More & more frequently my water supply powered backup needed to take over pumping. I have more than one sump pump & always have one ready with a new switch. Watching the node's reports on the openHAB's user interface, I could promptly remedy the problem before basement flooding & before the backup system wasted more water.
The switchTrips item noted in the post just above can now give me more data to help know when to replace a sump pump switch.
|
|
|
Post by papa on Nov 16, 2020 20:45:11 GMT
Fixing a switchTrips Glitch As I note in another thread, after an openHAB restart, persistence does not restore my proxy item switchTrips. In the following, I show my workaround. When switchTrips is first used, it needs initializing (it starts as NULL). My workaround also helps with this. Add another entry to an . items file (? Snd_Sense21.items from this post): Switch seedCount "Seed switch counts" In a new entry in a . sitemap file (add to this list from here) OR in an added HABPanel switch widget, link to the new seedCount item shown just above. If you downloaded the WaterLevel_Snd.rules file from here, disable it (delete it or rename it to WaterLevel_Snd.ruler).
This illustrates another workaround for when persistence does not restore the value of an item.
Next: How the switchTrip Workaround Functions
|
|
|
Post by papa on Nov 16, 2020 21:16:18 GMT
How the switchTrip Workaround Functions WaterLevel_Snd_3.rules' Line 18's "if (switchTrips.state==NULL) ..." initializes switchTrips to zero the first time the rule is used & then every time openHAB restarts.
With switchTrip initalized, line 20's "swTp = swTp + 1" will count up from zero (instead of erroring out on NULL). However, this value will not include pump runs since the pump's installation OR since the last openHAB restart.
First, to edit line 80 of WaterLevel_Snd_3.rules, calculate a tru(ish) current value for sump runs (switchTrips). If you've just installed WaterLevel_Snd_3.rules, estimate sump runs since the pump's install &
edit that value into WaterLevel_Snd_3.rules' line 80, postUpdate(switchTrips, xxx). OR if WaterLevel_Snd_3.rules has been running, but an openHAB restart has set switchTrips to NULL ... Load openHAB's /userdata/logs/events.log file into a text editor, but caution: do not change this file. Go to the end of the file & start searching UP for switchTrips. The first found instance is the current count since a restart NULL. << Make note of this. Continue searching UP until where switchTrips was shown as NULL, then search UP once more. << Make note of the last value. This is switchTrips' value before a restart NULL. Add together the two switchTrip values you noted & edit the total into WaterLevel_Snd_3.rules' line 80.
Next, once WaterLevel_Snd_3.rules' line 80 has been corrected as instructed above ...
click the seedCount switch in the User Interface. switchTrips should now display the corrected value.
Thus one calculates the correct value of switchTrips & edits that into line 80. Then clicking the seedCount switch updates switchTrips to the corrected value.
|
|
|
Post by papa on Aug 28, 2022 19:27:36 GMT
Some TroubleshootingMy RFM69 nodes tend to run for years without trouble. (Other than soldering lead wires to RFM69 radios) I tend to plug wires into Arduino sockets. These connections (especially in damp situations) can tarnish & become unreliable. Recently this water-level node (damp basement corner near open sump cistern) stopped working & needed troubleshooting. I plugged the node into my Arduino IDE computer & watched the serial monitor output. The RFM69 radio was not connecting & the water levels were not reporting reliably, but the sound sensor was working fine. With vinegar & steel wool, I cleaned the water level probes (bared ends of insulated copper wire). I don't believe this led to my eventual success. I've found that even corroded copper conducts sufficiently. To un-tarnish the RFM69 connections & water level connections to transistors & Arduino analog pins, I started slightly unplugging & re-plugging wires into Arduino sockets. The water level reports (except for one probe) started working better. I gave more attention to connections for the one not working probe & that started working. The RFM69 radio connection was still not working. I checked the RFM69 Gateway which was working. I unplugged the radio's wires & used steel wool on the bared wire ends that plug into Arduino sockets. I plugged the cleaned RFM69 radio into my receiving test RFM69 Arduino ( see this thread). Now the radio works & acknowledges my sending test RFM69 Arduino. I reinstalled the radio on the water level node. Now the node connects & reports to openHAB via its gateway. My last tasks: (1) return the water level node to the awkward sump cistern area. 2) Estimate how many times the sump has run since the node stopped working & update the cumulative total (switchTrips).
|
|
|
Post by papa on Aug 28, 2022 20:44:37 GMT
Troubleshooting CompleteI returned the RFM69 water level node to the sump cistern area & powered it. The node communicates reliably with openHAB via the Gateway. The MIC sensor "hears" the pump noise & signals that pumping is on. The node reports how long the pumping lasts. The node reliably reports water levels of low, medium, & high. See this post for how I updated the cumulative total of pump runs since the current pump was installed.
|
|