diff --git a/custom_components/enphase_envoy/binary_sensor.py b/custom_components/enphase_envoy/binary_sensor.py index 5e3f30f..7719676 100644 --- a/custom_components/enphase_envoy/binary_sensor.py +++ b/custom_components/enphase_envoy/binary_sensor.py @@ -141,10 +141,13 @@ def device_info(self) -> DeviceInfo or None: """Return the device_info of the device.""" if not self._device_serial_number: return None + + model = self.coordinator.data.get("envoy_info", {}).get("model", "Standard") + return DeviceInfo( identifiers={(DOMAIN, str(self._device_serial_number))}, manufacturer="Enphase", - model="Envoy", + model=f"Envoy-S {model}", name=self._device_name, ) @@ -202,10 +205,11 @@ def device_info(self) -> DeviceInfo or None: """Return the device_info of the device.""" if not self._device_serial_number: return None + return DeviceInfo( identifiers={(DOMAIN, str(self._device_serial_number))}, manufacturer="Enphase", - model="Envoy", + model="Inverter", name=self._device_name, ) @@ -277,7 +281,11 @@ def device_info(self) -> DeviceInfo | None: if self._parent_device: device_info_kw["via_device"] = (DOMAIN, self._parent_device) - if self.MODEL == "Relay": + if self.MODEL == "Envoy": + model = self.coordinator.data.get("envoy_info", {}).get("model", "Standard") + self.MODEL = f"Envoy-S {model}" + + elif self.MODEL == "Relay": info = self.coordinator.data.get("relay_info", {}).get( self._device_serial_number, {} ) diff --git a/custom_components/enphase_envoy/sensor.py b/custom_components/enphase_envoy/sensor.py index f7bba0f..d17134b 100644 --- a/custom_components/enphase_envoy/sensor.py +++ b/custom_components/enphase_envoy/sensor.py @@ -253,13 +253,9 @@ def device_info(self) -> DeviceInfo | None: if not self._device_serial_number: return None - sw_version = None - hw_version = None - model = None - if self.coordinator.data.get("envoy_info"): - sw_version = self.coordinator.data.get("envoy_info").get("software", None) - hw_version = self.coordinator.data.get("envoy_info").get("pn", None) - model = self.coordinator.data.get("envoy_info").get("model", None) + sw_version = self.coordinator.data.get("envoy_info", {}).get("software", None) + hw_version = self.coordinator.data.get("envoy_info", {}).get("pn", None) + model = self.coordinator.data.get("envoy_info", {}).get("model", "Standard") return DeviceInfo( identifiers={(DOMAIN, str(self._device_serial_number))}, diff --git a/custom_components/enphase_envoy/switch.py b/custom_components/enphase_envoy/switch.py index 5c1c3d4..77ac348 100644 --- a/custom_components/enphase_envoy/switch.py +++ b/custom_components/enphase_envoy/switch.py @@ -73,10 +73,13 @@ def device_info(self) -> DeviceInfo or None: """Return the device_info of the device.""" if not self._device_serial_number: return None + + model = self.coordinator.data.get("envoy_info", {}).get("model", "Standard") + return DeviceInfo( identifiers={(DOMAIN, str(self._device_serial_number))}, manufacturer="Enphase", - model="Envoy", + model=f"Envoy-S {model}", name=self._device_name, )