Hi, I have created a sensor using the old methodology, which is
sensor:
- platform: template
sensors:
currentelectriccost:
friendly_name: "Current Electric Cost"
unit_of_measurement: "GBP"
value_template: "{{ (states('sensor.lux_power_from_grid_live') | float) * ((states('sensor.octopus_energy_electricity_21e5390550_2321143881010_current_rate')|float )/1000) }} "
this works fine in collecting statistics as you can see here:
Yet when I convert it to the new methodology:
template:
- sensor:
- name: "CurrentElectricCost2"
unique_id: "CurrentElectricCost2"
device_class: monetary
state_class: total
state: <-
"{{ (states('sensor.lux_power_from_grid_live') | float) * ((states('sensor.octopus_energy_electricity_21e5390550_2321143881010_current_rate')|float )/1000) }} "
It does not generate any history, as you can see here:
Do I have to set up a separate Statistics template to do this?
Any help greatly appreciated.
Mike