Oil Tank Level Monitor Watchman Sonic rtl_433 Integration for RF sensors or level sensors

Hi

I have a Kingspan oil tank with a wachtman sensor, but NOT the ‘sonic’.
I bought a usb stick as mentioned in the intro (excellently written by the way) and now I am listening for messages from my tank, but it seems I don’t receive anything.
image
This has been running for more that 2 hours, but nothing has come in yet. (I’ve been searching the update frequency of the oil monitor that I have, and that should be 15 mins, so I should have seen it pass by)
The antenna is located only 5-7 meters away (the indoor receiver is located further away, so I presume that can’t be the issue.)

Do you guys have any suggestions I could try?

Hi, could be a few things, are you publishing and subscribing on mosquito and that’s running, 433mhz and if your receiving on the normal monitor it should come through along with anything else in the area, and if a supported device, my battery lasted about a year before signal loss, mine was a good 10 metres away indoors so shouldn’t be that, the Watchman sensor has a reed switch activated by magnet to rapid send signals which helped :flushed:

Hey, I have configured the mosquito MQTT and tested it as in the following link (https://www.howtoforge.com/how-to-install-mosquitto-mqtt-message-broker-on-debian-11/ )
but I am not using it anymore now, since I am just trying to get a signal caught.
Afterwards I can forward it to mosquitto MQTT.
Now, when I see screenshots of other people, I sometimes see “tuned to 433,92Mhz” which it doesn’t say on mine.
I have found that is the default frequency that it’s supposed to be tuned to but I don’t see any verification somewhere that it actually is.
Even when I explicitly say to tune to that frequency, it doesn’t say that it does tune to that frequency:
image

I even took a picture of the watchman receiver indoors to verify that it was using 433,92 Mhz (it’s actually labeled as such)

Here is the picture:

Hi
First of all many thanks to @dingleydell for kicking this off. I have today got RTL_433 working on a very old Gen 1 Raspberry Pi model B with a USB RTL-SDR device.plugged in and I found my Watchman Sonic (and two other temperature modules I wasn’t expecting!) and fed them to my MQTT Broker. I’ve also noticed the temperature reading from the Watchman Sonic, but I’ve not yet used this in HA.

I made a couple of changes to the templates presented by @adwuk to generalise them for other tanks of different dimensions and volumes.

template:
  - sensor:
      - name: "Oil Litres"
        unit_of_measurement: 'Litres'
        # x = tank radius, y = depth of oil, z = tank length, v = volume
        # for my tank: x = 0.5725, z = 1.755 and v = 1800
        state: >
          {% set x = 0.5725 %}
          {% set y = ((x*2*100) - (states('sensor.oil_tank_air_at_top') | float) + 2) * 0.01 %}
          {% set z = 1.755 %}
          {% set v = 1800 %}
          {{ ((x*x*acos((x-y)/x) - (x-y)*sqrt(2*x*y-y*y))*z*1000) | round(0,default=0) }}
      - name: "Oil Percent"
        unit_of_measurement: '%'
        state: >
          {{ (100 * (states('sensor.oil_litres') | float) / v) | round(0,default=0) }}
      - name: "Oil Depth Left"
        unit_of_measurement: 'cm'
        state: >
          {{ 2*x - (states('sensor.oil_tank_air_at_top') | float) | round(2,default=0) }}

Thanks everyone for a very informative post - still useful three years later!

Hi,

Some time has past since the first post in this topic so I thought I would post my config.

I installed the libraries using the instructions on the first post of this topic, then

/etc/rtl_433/service.config

output mqtt://192.168.70.142:1883,retain=false,user=********,pass=*****,devices=home/rtl_433[/model][/id]

/etc/systemd/system/rtl_433.service

# based on https://github.com/merbanan/rtl_433/issues/1651
        
[Unit]
Description=RTL_433 service script
StartLimitIntervalSec=5
Documentation=https://github.com/merbanan/rtl_433/README.md
After=syslog.target network.target

[Service]
ExecStart=/usr/local/bin/rtl_433 -c /etc/rtl_433/service.conf

# Restart script if stopped
Restart=always
# Wait 30s before restart
RestartSec=30s

# Tag things in the log
# View with: sudo journalctl -f -u rtl_433 -o cat
SyslogIdentifier=rtl_433

Once created start & enable the service as follows:

$ sudo systemctl enable rtl_433-mqtt.service
$ sudo systemctl start rtl_433-mqtt.service

HA config

#Oil Tank Sensor
    - name: "Oil Tank Air at Top"
      state_topic: "home/rtl_433/Oil-SonicSmart/142082062/depth_cm"
      unit_of_measurement: 'cm'

    - name: "Oil Percent"
      state_topic: "home/rtl_433/Oil-SonicSmart/142082062/depth_cm"
#tank is 139cm diameter and 123cm high to the fill line (the bottom of the sensor is 150cm high) so approx 10.56 Litres per 1cm of fill if search online for calculator
      value_template: "{{ (150 - (value|int) * 10.56 / 1298 * 100) | round(1) }}"
      unit_of_measurement: '%'
    
    - name: "Oil Litres Remaining"
      state_topic: "home/rtl_433/Oil-SonicSmart/142082062/depth_cm"
      value_template: "{{ ((150 - ( value|int )) * 10.56) | round(1) }}"
      unit_of_measurement: 'Litres'
      
    - name: "Oil Depth Left"
      state_topic: "home/rtl_433/Oil-SonicSmart/142082062/depth_cm"
      value_template: "{{ 150 - (value|int)}}"
      unit_of_measurement: 'cm'
      
    - name: "Oil Temperature"
      state_topic: "home/rtl_433/Oil-SonicSmart/142082062/temperature_C"
      unit_of_measurement: '°C'
      
    - name: "Oil last message"
      state_topic: "home/rtl_433/Oil-SonicSmart/142082062/time"

Regards

This is great and exactly the type of thing I want to achieve. I am brand new to HA (haven’t actually got it set up yet) but will be using a HA Green. Would what you’ve written work for that too? Apologies for the completely newbie question!!

@dingleydell Thanks a million for sharing this project, within an afternoon I was able to follow your guide and get this working. Appreciate your time and effort in helping out the community with this detailed write-up :+1:

If it helps anyone else with this implementation, here are a few snags I found during my setup.

  • I had to reduce my gain on rtl_433 to (-2) as I live near a business with a lot of 433MHz security devices (contact sensors) so I was picking up way too much noise, reducing the gain allowed me to get more stable reading from the Watchman. Apologies, I miss spoke here, I set the Gain to -1 which is for Automatic Gain Control (AGC).
  • Although it quotes 433.92MHz on all the data sheets I could find for the Watchman Advanced, I was getting very spotty updates to my Pi, where the bundled receiver unit was updated in near real-time when testing at different heights. So using the same SDR Dongle I was using with rtl_433 on the Pi, I was able to use it as a “poor-mans” Spectrum Analyser by plugging it into my desktop running Windows OS and using the software SDR# (SDR-Sharp) following this guide - Quick Start Guide
  • After running the watchman in test mode (using a magnet on the internal reed-switch) I could see a huge spike in activity from 433.90 - 433.91 in the spectrum analyser in SDR#. So using this, I set the frequency to 433.905MHz via the -f switch in rtl_433 and voila, it updates in near real-time now in test mode. So if you are getting bad throughput, check to see if your frequency is aligned with the device using this method.
  • For those living in the UK/Ireland, This is the SDR dongle I got and I can confirm it works well with the Watchman Advanced running in the 433MHz band - NooElec-NESDR-Mini on Amazon

Setup Info:

  • Running rtl_433 on Pi 3 B → Publishing to MQTT topic
  • Home Assistant/MQTT running on separate hardware on my network.
  • Distance from tank to Pi approx 30 meters to house attic (no foil insulation installed).


Note: Says 431.837MHz on top of the photo, disregard that. It has to do with the small red line on the left-hand side of the graph. Just wanted to give it a shout-out in case it was confusing to anyone. The blue/cyan line is the one of interest.

@CaptainTed I am running HA as HA OS on a Pi 4. I would try and avoid messing with Linux package installs on your HA instance, just incase they don’t play nice with anything HA OS has pre-baked. You want to keep your HA instance clean to help avoid hard to troubleshoot Linux issues. In the case of the original author, he is using HA in a python virtualenv which is a older way of using HA but gives you more control over the underlying OS.

Once you have a more advanced HA instance up and running over the months and years to come (Zigbee/Zwave/UPS/etc.) you are going to want to mitigate any risky changes like Linux package installs/updates that might cause strange (and hard to debug) behavior.

In my case, to minimize risk to my HA instance and allow for more granular troubleshooting, I set the rtl_433 aspect of this project up on an old Pi3 I had (any Pi would do though). This way if things go bad on you, you now have a separate Pi you can start troubleshooting/testing on without any risk involved to the rest of your home automations :slight_smile:

This might be overkill (probably overkill lol) but it simplifies the system IMHO as your just adding a MQTT sensor with no hardware/software change to HA instance.

An added benefit of using separate hardware is you can place the rtl_433 Pi closer to the oil tank as your HA Green location might be the other side of the house.

To the folks on this thread running HA OS:
There are addons available for the rtl_433 software [Link]
Astonishingly little config and no messing with system files.

Thanks to OP for sharing their work.

I bought the DollaTek USB SDR linked in the original post, arrived today and had it setup and receiving signal from the Watchman Sonic in no time with the above addons.

Still need to calculate tank size for sensors etc but delighted with how easy it was to get up and running.

Has anyone set up their sensors based off the settings of the dip switches on the original receiver unit? Assuming that it was calibrated correctly on install.
Not of a mind currently to go out and measure the tank in the cold and rain.

I you still have the paperwork for the dip switch settings you can use that to figure out what dip switchs are for the tank depth and Oil loss alarm (if it applys to your sender)

Anyone with the Watchman Sonic Advance sender here ??

I have my watchman setup in HA using a Lilygo esp Lora32 that is flashed with esp_433 fsk from OpenMQTTGateway and it automatically populated HA with 4 sensors.

I have added a few yaml sensors with the help of some code posted here and another site.

generated sensors are: Oil Temp, rssi, Device Id & oil depth. Yaml sensors are :- Litres remaining, Oil percentage remaining & oil status.

The oil Status sensor always shows a reading of 144. Is this the leak detection sensor and if it detects a sudden oil loss will this change ?

The leak detection is the final part of the puzzle I need to sort. I know leak detection works as the reciever unit would chime a warning every 30 seconds or so while I was testing it on the bench but I forgot to monitor the mqtt data while it was going daft.

I know I can grab the sender and test it inside again now I have HA configured but thats last straw as its raining like heck here the now.