I was too quick…
The reset works fine, but now I got the error:
Logger: homeassistant.helpers.sensor
Source: helpers/trigger_template_entity.py:209
First occurred: 11:16:45 (1 occurrences)
Last logged: 11:16:45
Error rendering state template for sensor.fusionsolar_daypeak: TypeError: '>' not supported between instances of 'int' and 'str'
(the time stap doesn’t correspond with the real first occurrence, as I reloaded and restarted HA already).
I noticed a missing data-type for the trigger.to_state.state compared with the initial template, so I changed to:
- trigger:
- platform: time
at: '00:00:00'
- platform: state
entity_id: sensor.fusionsolar_realtime_power_w
not_to:
- 'unavailable'
- 'unknown'
sensor:
- name: 'fusionsolar_daypeak'
unique_id: 'fusionsolar_daypeak'
unit_of_measurement: 'W'
device_class: power
state: >
"{{ [trigger.to_state.state | float(0), this.state | float(0)] | max
if trigger.platform != 'time' else
states('sensor.fusionsolar_realtime_power_w') | float(0) }}"
Unfortunately, same result.
I also added the " " around the state-template. Same result.
The signal sensor.fusionsolar_realtime_power_w is available and is displayed with the correct value.
However, the logfile reports:
2024-04-11 11:25:46.953 ERROR (MainThread) [homeassistant.helpers.event] Error while dispatching event for sensor.fusionsolar_realtime_power_w to <Job track state_changed event ['sensor.fusionsolar_realtime_power_w'] HassJobType.Callback <function async_attach_trigger.<locals>.state_automation_listener at 0xffff50247ec0>>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 668, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: '"1317.0"'
and:
ValueError: Sensor sensor.fusionsolar_daypeak has device class 'power', state class 'None' unit 'W' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '"1317.0"' (<class 'str'>)
(note the double quoting around 1317.0 )
The template sensor itself was defined as:
- name: "FusionSolar realtime power W"
device_class: power
icon: mdi:solar-power
unit_of_measurement: "W"
availability: "{{ is_number(states('sensor.ew16_garage_realtime_power')) }}"
state: "{{ states('sensor.ew16_garage_realtime_power')|float * 1000 }}"
unique_id: "FusionSolar realtime power W"
I tried removing the quotes around the state template, but that again resulted in an error.
Cannot quick reload all YAML configurations because the configuration is not valid: Error loading /config/configuration.yaml: invalid key: "{"states('sensor.ew16_garage_realtime_power')|float(0) * 1000": None}" in "/config/packages/solarpanels/solarpanels.yaml", line 74, column 0
Anybody?