TimSoethout / goodwe-sems-home-assistant

Sensor for Home Assistant pulling data from the GoodWe SEMS API for solar panel production metrics.
88 stars 38 forks source link

Error adding entities for domain sensor with platform sems #93

Open alexcool83 opened 11 months ago

alexcool83 commented 11 months ago

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 582, in _async_add_entity entity_name = entity.name ^^^^^^^^^^^ File "/config/custom_components/sems/sensor.py", line 169, in name return f"Inverter {self.coordinator.data[self.sn]['name']}"


KeyError: 'name'
RobSmyth commented 10 months ago

I think I'm seeing the same error. It was working fine but after a complete system shutdown I get this error:

`2023-12-28 11:26:15.418 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: multiply got invalid input 'None' when rendering template '{{ (state_attr('sensor.smart_meter', 'loadStatus') | multiply(-1) state_attr('sensor.smart_meter', 'grid') | float(0) 1 / 1000) | round(1) }}' but no default was specified') while processing template 'Template<template=({{ (state_attr('sensor.smart_meter', 'loadStatus') | multiply(-1) state_attr('sensor.smart_meter', 'grid') | float(0) 1 / 1000) | round(1) }}) renders=22>' for attribute '_attr_native_value' in entity 'sensor.solar_smart_meter_grid_kw' 2023-12-28 11:26:17.248 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform sems Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 584, in _async_add_entity entity_name = entity.name ^^^^^^^^^^^ File "/config/custom_components/sems/sensor.py", line 169, in name return f"Inverter {self.coordinator.data[self.sn]['name']}"


KeyError: 'name'
`

I have not changed anything that I can think of. Does anybody know how to fix?