Add version and device type to powerwall device_info (#33453)
* Add version and device type to powerwall device_info * Upstream powerwall now supports a http_session
This commit is contained in:
1 parent
b88f56cbfb
commit
e6ed2f0377
13 files changed
+95
-31
No files matched your search
@@ -3,6 +3,7 @@
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import (
|
||||
DEVICE_TYPE_DEVICE_TYPE,
|
||||
DOMAIN,
|
||||
MANUFACTURER,
|
||||
MODEL,
|
||||
@@ -10,17 +11,20 @@ from .const import (
|
||||
SITE_INFO_GRID_CODE,
|
||||
SITE_INFO_NOMINAL_SYSTEM_ENERGY_KWH,
|
||||
SITE_INFO_UTILITY,
|
||||
STATUS_VERSION,
|
||||
)
|
||||
|
||||
|
||||
class PowerWallEntity(Entity):
|
||||
"""Base class for powerwall entities."""
|
||||
|
||||
def __init__(self, coordinator, site_info):
|
||||
def __init__(self, coordinator, site_info, status, device_type):
|
||||
"""Initialize the sensor."""
|
||||
super().__init__()
|
||||
self._coordinator = coordinator
|
||||
self._site_info = site_info
|
||||
self._device_type = device_type.get(DEVICE_TYPE_DEVICE_TYPE)
|
||||
self._version = status.get(STATUS_VERSION)
|
||||
# This group of properties will be unique to to the site
|
||||
unique_group = (
|
||||
site_info[SITE_INFO_UTILITY],
|
||||
@@ -32,12 +36,18 @@ class PowerWallEntity(Entity):
|
||||
@property
|
||||
def device_info(self):
|
||||
"""Powerwall device info."""
|
||||
return {
|
||||
device_info = {
|
||||
"identifiers": {(DOMAIN, self.base_unique_id)},
|
||||
"name": self._site_info[POWERWALL_SITE_NAME],
|
||||
"manufacturer": MANUFACTURER,
|
||||
"model": MODEL,
|
||||
}
|
||||
model = MODEL
|
||||
if self._device_type:
|
||||
model += f" ({self._device_type})"
|
||||
device_info["model"] = model
|
||||
if self._version:
|
||||
device_info["sw_version"] = self._version
|
||||
return device_info
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
|
||||
Reference in new issue
Block a user