Hi,
thanks! I´ve rewritten die config and it was already placed at configuration.yaml:
rest:
- resource: http://192.168.188.109/rest
scan_interval: 30
headers:
accept: "application/json"
sensor:
- name: "Amis Verbrauch minus Einspeisung"
unique_id: AmisEnergySensorSaldo
state_class: total_increasing
unit_of_measurement: W
device_class: energy
value_template: "{{ value_json.saldo }}"
- name: "Amis aktueller Verbrauch"
unique_id: AmisEnergySensor_1_7_0
state_class: total_increasing
unit_of_measurement: W
device_class: energy
value_template: "{{ value_json['1.7.0'] }}"
- name: "Amis aktuelle Einspeisung"
unique_id: AmisEnergySensor_2_7_0
state_class: total_increasing
unit_of_measurement: W
device_class: energy
value_template: "{{ value_json['2.7.0'] }}"
- name: "Amis Zählerstand Bezug"
unique_id: AmisEnergySensor_1_8_0
state_class: total
unit_of_measurement: kWh
device_class: energy
value_template: "{{ value_json['1.8.0'] }}"
- name: "Amis Zählerstand Einspeisung"
unique_id: AmisEnergySensor_2_8_0
state_class: total
unit_of_measurement: kWh
device_class: energy
value_template: "{{ value_json['2.8.0'] }}"
There are no values since 12 hours at my energy dashboard, but I can´t see any errors on reboot.
This is an example output of the resource:
{"1_8_0":50760982,"2_8_0":0,"3_8_1":11972952,"4_8_1":2745599,"1_7_0":791,"2_7_0":0,"3_7_0":0,"4_7_0":572,"1_128_0":0,"saldo":791}
After rebooting my home assistant I found this log entry:
Error adding entity sensor.amis_aktueller_verbrauch for domain sensor with platform rest
Error adding entity sensor.amis_aktuelle_einspeisung for domain sensor with platform rest
Error adding entity sensor.amis_zahlerstand_bezug for domain sensor with platform rest
Error adding entity sensor.amis_zahlerstand_einspeisung for domain sensor with platform rest
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 636, in state
numerical_value = int(value)
ValueError: invalid literal for int() with base 10: ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 639, in state
numerical_value = float(value)
ValueError: could not convert string to float: ''
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 633, in _async_add_entities
await coro
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 972, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1383, in add_to_platform_finish
await self.async_added_to_hass()
File "/usr/src/homeassistant/homeassistant/components/rest/entity.py", line 43, in async_added_to_hass
self._update_from_rest_data()
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/rest/sensor.py", line 186, in _update_from_rest_data
self.async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state
self._async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
self.__async_calculate_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1085, in __async_calculate_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 643, in state
raise ValueError(
...<5 lines>...
) from err
ValueError: Sensor sensor.amis_aktueller_verbrauch has device class 'energy', state class 'total_increasing' unit 'W' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '' (<class 'str'>)