After various attempts to build my own water level sensor for my cisterns, I gave up and bought a PTLevel device: https://www.amazon.com/gp/product/B07B6DRC8P/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1
I don't know how to code, but wondered if anyone else would be interested in doing a simple device type that can show the results of this devices output?
The url to request is xxx.xxx.xxx.xxx/config?json=true
The output is:
{"free_space":"667648","rx_id":"227","tx_id":"50","tx_rssi":"-71","rx_rssi":"-59","firmware_version":"212","hardware_version":"4","id":"483FDA91E94F","ip":"10.54.25.254","subnet":"255.255.255.0""gateway":"10.54.25.1","dns":"unknown","tx_firmware_version":"7","tx_hardware_version":"5","fails":"3","rx_sensors":"[]","tx_sensors":"[{"1":366,"z":58},{"2":6.16},{"3":-15.01}]"}
The sections tx_sensors is as follows:
"1":366 -- first variable 366 being the current pressure reading
"z":58 -- second variable 58 being the pressure when nothing is applied
The percentage remaining needs to be calculated somehow. Here's how the manufacturer describes it:
the 1:{value} is the sensor a/d value and the z:{value} is the zero point value. The zero point is the a/d value of the sensor when there is no pressure applied. You'd use that value as the low part of the linear range. You must then figure out the high point of the range which is calculated based on your tank size or by doing a pressure test when your tank is full (basic calibration). Then you have your range and you can calculate the current level based on that range whether it be in percent, inches, volume, etc.
The "2":6.16 is the battery voltage 6.16v.
In the device website, you need to tell the depth of the tank and then calibrate it, so I'm not sure how that all works.
If someone could code this to just show even the raw values, maybe with a manually set point for full/empty, and the battery voltage, that would be amazing!
I'll happily help anyone that wants to take this on, thanks for the consideration!