I have an Energy Price sensor defined in my template.yaml as:
- sensor:
- name: Energy Price
unique_id: energy_price
icon: mdi:counter
state_class: total_increasing
device_class: energy
unit_of_measurement: USD/kWh
state: >
{% set consumption=states('sensor.energy_meter_consumption')|float(0) %}
{% set fuel_adjustment=consumption*0.04260 %}
{{ 0.05214 if consumption > 1000 else 0.04989 + fuel_adjustment }}
availability: "{{ states('sensor.energy_meter_consumption')|is_number }}"
and a Water Meter Consumption sensor defined in my sensors.yaml file as follows:
- platform: template
sensors:
# convert value from add-in into statistic
water_meter_total_gal:
friendly_name: "Total Water Consumption"
device_class: water
unit_of_measurement: gal
value_template: "{{ (states('sensor.water_meter_consumption') | float) }}"
attribute_templates:
state_class: total_increasing
and they both are included in my configuration.yaml as:
I don’t know why you get these unavailable warnings, but your Energy Price sensor has the wrong unit_of_measurement.
You are calculating the total_increasing amount of USD paid, so the unit_of_measurement should be USD and not USD/kWh.
Also, I am not sure whether you can use such an Energy Paid sensor in the energy dashboard, but it might be possible if all the used sensors are in USD?
Probably this change PSA: MQTT Name changes in 2023.8 is affecting that add-on and it just stopped working. I am seeing it receiving data but the sensors are not available to the HA