For anyone that may be interested:
I have a RTL -SDR V4 Blog dongle attached to my NUC running HAOS.
I installed rtl_433 and rtl_433 Autodiscovery (both “next” versions but don’t think that matters).
Mosquitto Mqtt Broker intergration installed and I have MQTT Explorer also installed (in order to see the entities picked up and their refresh times)
I did not do any setup of the above, it simply worked out of the box (I will have to fiddle as I also want to pick up some 868mhz signal, in addition to the 433mhz for the oil sensors)
MQTT provides me with devides (oilSonicstd-16915 for te Apollo) and oilSonicadv-xxx for teh watchman) with various entities including Airgap and Timestamp (showing last update received) and some others whcih I have not identified yet.
In configuration.yaml I have added the following code which provides me with the following which I display on my dashboard:
-Oil Depth
Oil Volume (as i have a horizontal cylindrical tank - i use depth/volume numbers givenm by teh manufacturer) (see mapping section)
-Oil needed when ordering
-Oil percentage left
I will later use something like this Liquid level display to display a bit nicer than the standard stats card i use now.
You will need to replace the mapping numbers with whatever you have, as well as teh tank_height value in cm (mine is 150), the full_tank_capacity (mine 3500) in litres (in several places)
and change the unique_ids.
All working nicely. here is the code:
sensor:
- platform: template
sensors:
oil_depthft:
unique_id: 35bc8083-a6ce-4406-b005-513c36f7c1b6
friendly_name: "Oil Depth Farm Tank"
unit_of_measurement: "cm"
value_template: >-
{% set total_tank_height = 150 %}
{% set airgap = states('sensor.oil_sonicstd_16915_depth') | float %}
{{ total_tank_height - airgap }}
oil_volumeft:
unique_id: 713a91a4-6f76-412a-adf2-0d626add6a7d
friendly_name: "Oil Volume Farm Tank"
unit_of_measurement: "L"
value_template: >-
{% set depth_volume_map = {
10: 130,
20: 305,
30: 515,
40: 745,
50: 1010,
60: 1285,
70: 1575,
80: 1875,
90: 2170,
100: 2450,
110: 2710,
120: 2950,
130: 3155,
140: 3315,
150: 3420
} %}
{% set oil_depth = states('sensor.oil_depthft') | float %}
{% set depths = depth_volume_map.keys() | map('float') | sort | list %}
{% set lower_depth = depths | select('le', oil_depth) | list | last %}
{% set upper_depth = depths | select('ge', oil_depth) | list | first %}
{% if lower_depth == upper_depth %}
{% set volume = depth_volume_map.get(lower_depth, 0) %}
{% else %}
{% set lower_volume = depth_volume_map.get(lower_depth, 0) %}
{% set upper_volume = depth_volume_map.get(upper_depth, 0) %}
{% set volume = lower_volume + (upper_volume - lower_volume) * (oil_depth - lower_depth) / (upper_depth - lower_depth) %}
{% endif %}
{{ volume | round(2) }}
oil_neededft:
unique_id: 0f56ed92-2edc-4f12-82f4-b871710ade5b
friendly_name: "Oil Needed to Fill Farm Tank"
unit_of_measurement: "L"
value_template: >-
{% set full_tank_capacity = 3500 %}
{% set depth_volume_map = {
10: 130,
20: 305,
30: 515,
40: 745,
50: 1010,
60: 1285,
70: 1575,
80: 1875,
90: 2170,
100: 2450,
110: 2710,
120: 2950,
130: 3155,
140: 3315,
150: 3420
} %}
{% set oil_depth = states('sensor.oil_depthft') | float %}
{% set depths = depth_volume_map.keys() | map('float') | sort | list %}
{% set lower_depth = depths | select('le', oil_depth) | list | last %}
{% set upper_depth = depths | select('ge', oil_depth) | list | first %}
{% if lower_depth == upper_depth %}
{% set current_volume = depth_volume_map.get(lower_depth, 0) %}
{% else %}
{% set lower_volume = depth_volume_map.get(lower_depth, 0) %}
{% set upper_volume = depth_volume_map.get(upper_depth, 0) %}
{% set current_volume = lower_volume + (upper_volume - lower_volume) * (oil_depth - lower_depth) / (upper_depth - lower_depth) %}
{% endif %}
{{ full_tank_capacity - current_volume | round(2) }}
farm_oil_percentage_leftft:
unique_id: 48287b52-1bc6-4390-83b3-cf9764bccdc5
friendly_name: "Farm Oil Percentage Left"
unit_of_measurement: "%"
value_template: >-
{% set full_tank_capacity = 3500 %}
{% set current_volume = states('sensor.oil_volumeft') | float %}
{{ ((current_volume / full_tank_capacity) * 100) | round(2) }}