OilPal / Watchman Ultrasonic Oil Tank level reading for Home Assistant

This is my first “project” that I’m happy enough with to share with the HA community.

For years I used the Fibaro Home Center 2 with various ZWave devices from Aeotec, Greenwave and Fibaro. Recently I decided to move away from the HC2 and look at other home automation systems.

I landed with Home Assistant around 6 weeks ago and have been extremely happy with it since. I’m running my HA on a RPi 3b+.

Anyhow, around December of 2018 I purchased an OilPal system which is basically a Watchman ultrasonic oil sensor and a modem that sends the sensors data back to OilPal. I’m aware that these are possibly generic systems as they are sold by various companies.

I wanted to include my oil tank level in HA.

My first attempt at this was to clone the imap component and create a custom component from is, which checked for mail up to 48 hours old. It seems the original component only checks from when HA is started.

This was working well but the issue was that OilPal only send emails warning of low tank levels when your oil level gets below 50%. This wasn’t ideal.

I then looked at a few Youtube videos which show the Watchman ultrasonic sensor was communicating via radio and you could read that with a USB SDR dongle. I purchased a £10 USB dongle and was half way along the road of using the SDR dongle to pull the data the Watchman was sending using a combination of SDR, Node Red and MQTT.

At this stage I had mentioned I was working on this project on a Facebook group and was contacted by Stig. Stig pointed out that the OilPal modem had a webserver running on it. I wasn’t aware of this or would I have considered looking. So without Stig pointing me this out to me I’d probably have spent days working out SDR etc. etc. So many thanks to Stig.

So I’ve mentioned the OilPal modem, yup, there’s a webserver and yup, it holds the sensor data from the Watchman. This now sent me down another road and finally to the end of this project.

Below is the configuration I’m using to scrape the data from the modem. My tank is a vertical cylinder. I calculated it to be around 1350 Litres in volume. The tank_dimensions are in CM.

Please keep in mind I’m a complete newbie to HA, YAML etc. I’m sure there is a more elegant way to do this, I’d love to hear alternatives, optimised code, etc.

edit: 30th April 2019. I’ve fixed a bug where the oilpal modem returns “No Data”. I’ve also updated the tank types to take into account rectangle tanks, set the tank_type value.
edit: 2nd May 2019. I’ve now fixed a bug when “No Data” was received and the card would report “Unknown”. The value from the modems last response is now used. Scan interval has been reduced to 60 seconds per read to quicker update from “Waiting for first reading”.

# Sensors
# scrape oilpal tank level from modem.  tank_depth is the amount of air between the bottom of the sensor to the oil level.
# the ip address in the resource: statement is the ip of your oilpal modem.
# tank_type 1 is cylindar, tank_type 2 is a rectangle 
  - platform: scrape
    name: OilPalData
    select: 'table:nth-of-type(2) td:nth-of-type(5)'
    unit_of_measurement: 'Litres'
    value_template: >-
      {% set modem_values = value.split(' ') %}
      {% set tank_temp = modem_values[1] %}
      {% if tank_temp != "Data" %}
        {% set tank_depth = modem_values[0] | int %}
        {% set tank_type = {
          "value": 1
        } %}
        {% set tank_dimentions = {
          "height": 125,
          "radius": 58.65,
          "width": 64,
          "length": 150,
        } %}
        {% set tank_area = {
          "value": (3.1472 * (tank_dimentions.radius * tank_dimentions.radius) * tank_dimentions.height) / 1000,
        } %}
        {% if tank_type.value == 1 %}
          {% set tank_volume = {
            "value": (tank_dimentions.height - tank_depth) * tank_area.value / 100,
          } %}
        {% else %}
          {% set tank_volume = {
            "value": (tank_dimentions.height - tank_depth) * tank_dimentions.length * tank_dimentions.width / 1000,
          } %}
        {% endif %}
        {{ tank_volume.value | round (0) }}
      {% else %}
        {% if states.sensor.oilpaldata.state == "" %}
          Waiting for first reading
        {% else %}
          {{ states.sensor.oilpaldata.state }}
        {% endif %}
      {% endif %}
    scan_interval: 60

Below is my card configuration

entity: sensor.oilpaldata
graph: line
hours_to_show: 720
icon: 'mdi:oil'
name: OilPal
type: sensor
unit: Litres

This is what I love about home assistant and it’s community.

Hi , I was wondering do you know the default credentials to access the TEK608 webserver?

Found it on my network , but seems it’s password protected.

@mrmercedes84 Sorry I never knew the default login or password for the TEK608 webserver. I’m scrapping the tank stats from the only page on the webserver that isn’t password protected.


Can i confirm that this is still woking and function for you? I am total Newbee, came from the Smartthings platform and starting to transfer my Smarthome enviroment. Oilpal was always something i was hoping to get on for a visual display in the Kitchen so this got me excited.

I Added the code to the Config file and creasted the card but seem to be stuck on Awaiting data. I know the Oilpal only reads once a day but i wanted to ensure i didnt have false hope

This is what the ip address in the config file brings:


@davy932 yup, i can confirm that this still works, still using it without issues. It does take a while to get a reading.


Thanks for the reply.

All looks same from the OilPal point of view. Just I don’t have any data in the column we’re looking for. You said it takes a while- couple of days?

@davy932 it shouldn’t take more than a couple of hours to catch your first reading. the oilpal modem gets a reading every hour or so but the reading is cleared after a few minutes, no idea why. You could try changing the 60 minute scan interval in the script to something lower.

I too have implemented your solution, so thank you. But I also get
Waiting for first reading
And have been for two days.
Any tips on getting this working?
What do the figures on the diag/htm mean?

I also get “This entity does not have a unique ID, therefore it’s settings cannot be managed from the UI”
What am I doing wrong?


That unique ID message means you configured via configuration.yaml. It is not an error.

Frustration time.
I had this working, sort of.
For three days I got - Waiting for first reading then it changed to 20 litres more than my tank holds. I realised the dimensions of the tank in the code were not the same as for my actual tank, so I changed them. I swear I only altered the dimensions, nothing more or less
I also updated Hassio to the latest version. 0.113
now I get the following error:

Log Details (ERROR)

Logger: homeassistant.components.hassio
Source: components/hassio/init.py:326
Integration: Hass.io (documentation, [issues]
First occurred: 9:44:08 PM (2 occurrences)
Last logged: 9:46:35 PM

Invalid config for [sensor.scrape]: [device_tracker] is an invalid option for [sensor.scrape]. Check: sensor.scrape->device_tracker. (See ?, line ?).

The card now shows: entry not available sensor.oilpaldata

I don’t know enough about Hassio, yaml or coding to be able to fix this myself. Can anybody help, please?