-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Hi.
After the recent Home Assistant updates, the integration is failing to add several entities (especially Grid L1/L2/L3) with the error: homeassistant.exceptions.HomeAssistantError: Invalid entity ID.
This is caused by uppercase letters (e.g., "L1") being passed directly into the entity_id. Home Assistant now strictly requires all entity IDs to be lowercase.
The fix is simple. In sensor.py, the self.entity_id needs to be forced to lowercase.
Current code in sensor.py (around line 164, 161):
Python
if description.slave not in (0, 100, 225):
self.entity_id = (
f"{SENSOR_DOMAIN}.{DOMAIN}{self.description.key}{description.slave}"
)
else:
self.entity_id = f"{SENSOR_DOMAIN}.{DOMAIN}_{self.description.key}"
Proposed fix:
Python
if description.slave not in (0, 100, 225):
self.entity_id = (
f"{SENSOR_DOMAIN}.{DOMAIN}{self.description.key}{description.slave}".lower()
)
else:
self.entity_id = f"{SENSOR_DOMAIN}.{DOMAIN}_{self.description.key}".lower()
Could you please push this update to prevent integration failures for users on newer HA versions?
To fully resolve this, the .lower() fix should be applied across all entity platforms in the integration. Currently, several files are still generating entity_id with uppercase characters from self.description.key, causing them to fail on newer Home Assistant versions.
Please apply the .lower() conversion in the following files:
sensor.py 16.-164
self.entity_id = (
f"{SENSOR_DOMAIN}.{DOMAIN}_{self.description.key}_{description.slave}".lower()
)
else:
self.entity_id = f"{SENSOR_DOMAIN}.{DOMAIN}_{self.description.key}".lower()
binary_sensor.py 92-94
self.entity_id = f"{BINARY_SENSOR_DOMAIN}.{DOMAIN}_{self.description.key}_{self.description.slave}".lower()
else:
self.entity_id = f"{BINARY_SENSOR_DOMAIN}.{DOMAIN}_{self.description.key}".lower()
switch.py 95-99
self.entity_id = (
f"{SWITCH_DOMAIN}.{DOMAIN}_{self.description.key}_{description.slave}".lower()
)
else:
self.entity_id = f"{SWITCH_DOMAIN}.{DOMAIN}_{self.description.key}".lower()
select.py 104-106
self.entity_id = f"{SELECT_DOMAIN}.{DOMAIN}_{self.description.key}_{self.description.slave}".lower()
else:
self.entity_id = f"{SELECT_DOMAIN}.{DOMAIN}_{self.description.key}".lower()
number.py 234-236
self.entity_id = f"{NUMBER_DOMAIN}.{DOMAIN}_{self.description.key}_{self.description.slave}".lower()
else:
self.entity_id = f"{NUMBER_DOMAIN}.{DOMAIN}_{self.description.key}".lower()
button.py 93-95
self.entity_id = f"{BUTTON_DOMAIN}.{DOMAIN}_{self.description.key}_{self.description.slave}".lower()
else:
self.entity_id = f"{BUTTON_DOMAIN}.{DOMAIN}_{self.description.key}".lower()
Thanks for your great work on this integration!