I’ve created a basic template to handle a tank level offset in my campervan, tracked via a mopeka sensor. The offset is required to consider the water outlet height and therefore the true minimum value.
My code reports the new ‘true’ value fine but when I try to add a percentage string to the value I get “Entity not found” on the dashboard item.
Here is my code.
template:
- sensor:
- name: Fresh Water Level Calibrated
unit_of_measurement: "mm"
state: >
{% set fw_level = states('sensor.fresh_water_tank_level') | float(0) %}
{% set fw_level = fw_level - 70 %}
{% set fw_level_pc = fw_level / 450 * 100 %}
{% if fw_level > 0 %} {{ fw_level | int(0) }} ({{ fw_level_pc | int(0) }}%)
{% else %} empty
{% endif %}
This works fine in “development tools - template” but not in the dashboard card. Any ideas ?