We have an oil boiler, and therefore oil tank - the tank capacity is only available to be manually read, but I’d like to track it, by manually adding a metric every time I check it.
How can I store these readings in HA?
Thanks in advance
I have a similar need, and I have a solution through MQTT.
Do you an MQTT broker?
I use a script with a triggered template sensor to track manually input values. For example tracking my weight from the scale:
I use this script with an input field to take a measurement. When you put this on your dashboard, there is a nice UI to take a recording.
alias: Weight Report
sequence:
- event: weigh_in
event_data:
weight: "{{ weight }}"
fields:
weight:
default: 155
selector:
number:
unit_of_measurement: lbs
min: 1
max: 200
mode: box
step: 0.1
name: Weight
description: Current weight in lbs
required: true
description: Report my current weight
icon: mdi:weight-pound
On the backend, the following template sensor collects the values input from the script and stores them in long term statistics. It also tracks the time of the last recording, so you could make an automation to nag you to take a new reading if you haven’t done it in however many days you prefer.
- trigger:
- platform: event
event_type: weigh_in
sensor:
- name: Weight
unique_id: weight
state_class: measurement
device_class: Weight
unit_of_measurement: lb
state: >
{{ trigger.event.data.weight | float(-1)}}
attributes:
record_date: "{{ now() }}"
I’ve resolved this (until I get something “automatic”) by creating a helper, which stores the manual number I enter. Seems to be working well - now to save up for a proper sensor!
I do have an MQTT broker, yes - I’ve for now, done a manual helper, but interested in any ideas!