I’m trying to get the energy section working. I have an Api that every minute returns my kWh usage. I’ve stripped down the JSON to a Value 1234567. Every minute the Api updates the value, and then it increases 1234568. Ive tried to create an Rest sensor, that I can add as energy Usage.
But it gives me two errors. A missing statistic, and non numeric value
statistics_not_defined
* sensor.total_energy_1
Entity has non-numeric state
The following entities have a state that cannot be parsed as a number:
* sensor.total_energy_1
My sensors value are :
state_class: total_increasing
value: 12251159
unit_of_measurement: kWh
device_class: energy
friendly_name: total_energy_1
The complete coded is:
- platform: rest
resource_template: XXX
headers:
Authorization: token XXXX
User-Agent: Home Assistant
content-type: "application/json"
method: GET
name: total_energy_1
unique_id: total_energy_1_1
value_template: "{{ value_json.results[-1:].value }}"
json_attributes_path: "$.results[-1:]"
json_attributes:
- results
- value
scan_interval: 60
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
Any ideas what I may have done wrong here ?