Watchman Sonic Oil Monitor

Hi

I have my Watchman Sonic Oil monitor sending to OpenHab via MQTT, that all works fine but I just get raw data, in this case depth which I believe is in cm’s

I am trying to convert this to litres but this is proving a bit more challenging than I initially thought.

The following script is exactly what I am trying to achieve but I can’t get it to work in OpenHAB

Oil Monitor Script

I am hoping someone can point me in the right direction or help out if someone has managed to get this to work.

Thank you

I just store the raw data, then I have a rule that calculates the percentage left when the depth changes - I don’t see why you couldn’t do some maths to work out the volume instead

Hi Nick

Interesting, would you be willing to share your rule that calculates the percentage?

Sure - it isn’t that pretty

val float height = 115 // height of the tank

rule "Oil Calc"
when
    Item GF_Oil_Depth changed // this is the mqtt item that holds the depth from the sensor
then
    val float depth = Float::parseFloat(GF_Oil_Depth.state.toString) as Number 
    val float left = height - depth
    val float per = (left / height) * 100
    GF_Oil_Remaining.sendCommand(per) // update the item that holds the percentage

end
1 Like

Is your tank height in cm?

Yes