From 6b0f0d21fe8abf271f0083ad72302b50278b63b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sun, 16 Oct 2022 20:43:10 +0200 Subject: [PATCH] Add hardware ID to device model --- custom_components/plejd/light.py | 2 +- custom_components/plejd/pyplejd/plejd_device.py | 10 +++++++--- custom_components/plejd/switch.py | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/custom_components/plejd/light.py b/custom_components/plejd/light.py index 61318a5..8f398da 100644 --- a/custom_components/plejd/light.py +++ b/custom_components/plejd/light.py @@ -48,7 +48,7 @@ class PlejdLight(LightEntity, CoordinatorEntity): "identifiers": {(DOMAIN, self.device.BLE_address)}, "name": self.device.name, "manufacturer": "Plejd", - "model": self.device.model, + "model": f"{self.device.model} ({self.device.hardwareId})", #"connections": ???, "suggested_area": self.device.room, "sw_version": self.device.firmware, diff --git a/custom_components/plejd/pyplejd/plejd_device.py b/custom_components/plejd/pyplejd/plejd_device.py index 5883896..8adc9a3 100644 --- a/custom_components/plejd/pyplejd/plejd_device.py +++ b/custom_components/plejd/pyplejd/plejd_device.py @@ -8,6 +8,7 @@ LIGHT = "light" SENSOR = "sensor" SWITCH = "switch" + HARDWARE_TYPES = { "0": Device("-unknown-", LIGHT, False), "1": Device("DIM-01", LIGHT, True), @@ -17,13 +18,13 @@ HARDWARE_TYPES = { "5": Device("LED-10", LIGHT, True), "6": Device("WPH-01", SWITCH, False), "7": Device("REL-01", SWITCH, False), - "8": Device("-unknown-", LIGHT, False), + "8": Device("SPR-01?", SWITCH, False), "9": Device("-unknown-", LIGHT, False), - "10": Device("-unknown-", LIGHT, False), + "10": Device("WRT-01", SWITCH, False), "11": Device("DIM-01", LIGHT, True), "12": Device("-unknown-", LIGHT, False), "13": Device("Generic", LIGHT, False), - "14": Device("-unknown-", LIGHT, False), + "14": Device("DIM-01", LIGHT, True), "15": Device("-unknown-", LIGHT, False), "16": Device("-unknown-", LIGHT, False), "17": Device("REL-01", SWITCH, False), @@ -66,6 +67,9 @@ class PlejdDevice: @property def firmware(self): return self.data["firmware"] + @property + def hardwareId(self): + return self.data["hardwareId"] @property def type(self): diff --git a/custom_components/plejd/switch.py b/custom_components/plejd/switch.py index f3aab28..7e6bb19 100644 --- a/custom_components/plejd/switch.py +++ b/custom_components/plejd/switch.py @@ -48,7 +48,7 @@ class PlejdSwitch(SwitchEntity, CoordinatorEntity): "identifiers": {(DOMAIN, self.device.BLE_address)}, "name": self.device.name, "manufacturer": "Plejd", - "model": self.device.model, + "model": f"{self.device.model} ({self.device.hardwareId})", #"connections": ???, "suggested_area": self.device.room, "sw_version": self.device.firmware,