Recently purchased a Tank Mate - the fact that there was a basic integration in place (Thanks Simon!) swung the decision in favour of their device.
I’ve made a few tweaks to Simon’s excellent starting point and include them here in case of use to anyone else.
# Mofified version of the Tankmate "Farm Tank" sensor by SimonPth
# Modifications by hughhalf:
# * Set scan interval to 5m instead of default 30s Data changes no more often than
# 15m and reduces load the TankMate backend
# * Used 'tankName' as the Value_template and shifted currentLevel into template section
# this seemed to improve handling of the 'currentLevel' value in HA cards etc
# * Unit of measure fot outlet height is millimetres rather than metres
# * Changed name to "Water Tank" from "Farm Tank"
#
# ToDo One Day Maybe...
# * Abstract out UID, API Key and DeviceID to be set once at top of file
# * Re-write as a full integration with multi tank support etc.
#
# This version 2024-08-12a
sensor: # May not need this line depending on how you include this into your HA install
- platform: rest
name: Water Tank
resource: https://api.tankmate.app/status/?uid=Your-UID-Goes-Here
scan_interval: 300
method: GET
headers:
accept: application/json
api-key: Your-API-Key-Goes-Here
value_template: "{{ value_json['Your-DeviceID-Goes-Here']['tankName'] }}"
json_attributes:
- 'Your-DeviceID-Goes-Here'
- platform: template
sensors:
water_tank_device_id:
friendly_name: "Water Tank Device ID"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').deviceId }}"
water_tank_max_volume:
friendly_name: "Water Tank Max Volume"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').maxVolume }}"
unit_of_measurement: "L"
device_class: volume_storage
water_tank_maximum_height:
friendly_name: "Water Tank Maximum Height"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').maximumHeight }}"
unit_of_measurement: "m"
device_class: distance
water_tank_outlet_height:
friendly_name: "Water Tank Outlet Height"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').outletHeight }}"
unit_of_measurement: "mm"
device_class: distance
water_tank_overflow_height:
friendly_name: "Water Tank Overflow Height"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').overflowHeight }}"
unit_of_measurement: "m"
device_class: distance
water_tank_tank_area:
friendly_name: "Water Tank tank Area"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').tankArea }}"
unit_of_measurement: "m2"
water_tank_bat_voltage:
friendly_name: "Water Tank Battery Voltage"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').batVoltage | float / 1000|round(2) }}"
unit_of_measurement: "V"
device_class: battery
water_tank_current_volume:
friendly_name: "Water tank Current Volume"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').currentVolume }}"
unit_of_measurement: "L"
device_class: volume_storage
water_tank_current_percent:
friendly_name: "Water Tank Current Percent"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').currentPercent }}"
unit_of_measurement: "%"
device_class: volume_storage
water_tank_current_level:
friendly_name: "Water Tank Current Level"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').currentLevel }}"
unit_of_measurement: "m"
device_class: distance
water_tank_last_reading:
friendly_name: "Water Tank Last Reading"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').lastReading }}"
device_class: timestamp
water_tank_network:
friendly_name: "Water Tank Network"
value_template: "{{ state_attr('sensor.water_tank', 'Your-DeviceID-Goes-Here').network }}"