Skip to content

Commit cf31668

Browse files
authored
Add additional device info attributes (#187)
* Add additional device info attributes * Remove device sn and mac address sensors
1 parent 553a9a2 commit cf31668

15 files changed

Lines changed: 4 additions & 200 deletions

File tree

custom_components/petlibro/entity.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Generic, TypeVar
66
from functools import cached_property
77

8-
from homeassistant.helpers.device_registry import DeviceInfo
8+
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
99
from homeassistant.helpers.entity import EntityDescription
1010
from homeassistant.helpers.update_coordinator import CoordinatorEntity, DataUpdateCoordinator
1111

@@ -42,11 +42,13 @@ def device_info(self) -> DeviceInfo | None:
4242
assert self.device.serial
4343
return DeviceInfo(
4444
identifiers={(DOMAIN, self.device.serial)},
45+
connections={(CONNECTION_NETWORK_MAC, self.device.mac)},
4546
manufacturer="PETLIBRO",
4647
model=self.device.model,
4748
name=self.device.name,
4849
sw_version=self.device.software_version,
49-
hw_version=self.device.hardware_version
50+
hw_version=self.device.hardware_version,
51+
serial_number=self.device.serial,
5052
)
5153

5254
async def async_added_to_hass(self) -> None:

custom_components/petlibro/sensor.py

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -291,18 +291,6 @@ def extra_state_attributes(self):
291291
Feeder: [
292292
],
293293
AirSmartFeeder: [
294-
PetLibroSensorEntityDescription[AirSmartFeeder](
295-
key="device_sn",
296-
translation_key="device_sn",
297-
icon="mdi:identifier",
298-
name="Device SN"
299-
),
300-
PetLibroSensorEntityDescription[AirSmartFeeder](
301-
key="mac",
302-
translation_key="mac_address",
303-
icon="mdi:network",
304-
name="MAC Address"
305-
),
306294
PetLibroSensorEntityDescription[AirSmartFeeder](
307295
key="wifi_ssid",
308296
translation_key="wifi_ssid",
@@ -421,18 +409,6 @@ def extra_state_attributes(self):
421409
),
422410
],
423411
GranarySmartFeeder: [
424-
PetLibroSensorEntityDescription[GranarySmartFeeder](
425-
key="device_sn",
426-
translation_key="device_sn",
427-
icon="mdi:identifier",
428-
name="Device SN"
429-
),
430-
PetLibroSensorEntityDescription[GranarySmartFeeder](
431-
key="mac",
432-
translation_key="mac_address",
433-
icon="mdi:network",
434-
name="MAC Address"
435-
),
436412
PetLibroSensorEntityDescription[GranarySmartFeeder](
437413
key="wifi_ssid",
438414
translation_key="wifi_ssid",
@@ -560,18 +536,6 @@ def extra_state_attributes(self):
560536
),
561537
],
562538
GranarySmartCameraFeeder: [
563-
PetLibroSensorEntityDescription[GranarySmartCameraFeeder](
564-
key="device_sn",
565-
translation_key="device_sn",
566-
icon="mdi:identifier",
567-
name="Device SN"
568-
),
569-
PetLibroSensorEntityDescription[GranarySmartCameraFeeder](
570-
key="mac_address",
571-
translation_key="mac_address",
572-
icon="mdi:network",
573-
name="MAC Address"
574-
),
575539
PetLibroSensorEntityDescription[GranarySmartCameraFeeder](
576540
key="wifi_ssid",
577541
translation_key="wifi_ssid",
@@ -734,18 +698,6 @@ def extra_state_attributes(self):
734698
),
735699
],
736700
OneRFIDSmartFeeder: [
737-
PetLibroSensorEntityDescription[OneRFIDSmartFeeder](
738-
key="device_sn",
739-
translation_key="device_sn",
740-
icon="mdi:identifier",
741-
name="Device SN"
742-
),
743-
PetLibroSensorEntityDescription[OneRFIDSmartFeeder](
744-
key="mac",
745-
translation_key="mac_address",
746-
icon="mdi:network",
747-
name="MAC Address"
748-
),
749701
PetLibroSensorEntityDescription[OneRFIDSmartFeeder](
750702
key="wifi_ssid",
751703
translation_key="wifi_ssid",
@@ -886,18 +838,6 @@ def extra_state_attributes(self):
886838
),
887839
],
888840
PolarWetFoodFeeder: [
889-
PetLibroSensorEntityDescription[PolarWetFoodFeeder](
890-
key="device_sn",
891-
translation_key="device_sn",
892-
icon="mdi:identifier",
893-
name="Device SN"
894-
),
895-
PetLibroSensorEntityDescription[PolarWetFoodFeeder](
896-
key="mac",
897-
translation_key="mac_address",
898-
icon="mdi:network",
899-
name="MAC Address"
900-
),
901841
PetLibroSensorEntityDescription[PolarWetFoodFeeder](
902842
key="wifi_rssi",
903843
translation_key="wifi_rssi",
@@ -969,18 +909,6 @@ def extra_state_attributes(self):
969909
),
970910
],
971911
SpaceSmartFeeder: [
972-
PetLibroSensorEntityDescription[SpaceSmartFeeder](
973-
key="device_sn",
974-
translation_key="device_sn",
975-
icon="mdi:identifier",
976-
name="Device SN"
977-
),
978-
PetLibroSensorEntityDescription[SpaceSmartFeeder](
979-
key="mac",
980-
translation_key="mac_address",
981-
icon="mdi:network",
982-
name="MAC Address"
983-
),
984912
PetLibroSensorEntityDescription[SpaceSmartFeeder](
985913
key="wifi_ssid",
986914
translation_key="wifi_ssid",
@@ -1105,18 +1033,6 @@ def extra_state_attributes(self):
11051033
),
11061034
],
11071035
DockstreamSmartFountain: [
1108-
PetLibroSensorEntityDescription[DockstreamSmartFountain](
1109-
key="device_sn",
1110-
translation_key="device_sn",
1111-
icon="mdi:identifier",
1112-
name="Device SN"
1113-
),
1114-
PetLibroSensorEntityDescription[DockstreamSmartFountain](
1115-
key="mac",
1116-
translation_key="mac_address",
1117-
icon="mdi:network",
1118-
name="MAC Address"
1119-
),
11201036
PetLibroSensorEntityDescription[DockstreamSmartFountain](
11211037
key="wifi_ssid",
11221038
translation_key="wifi_ssid",
@@ -1227,18 +1143,6 @@ def extra_state_attributes(self):
12271143
),
12281144
],
12291145
DockstreamSmartRFIDFountain: [
1230-
PetLibroSensorEntityDescription[DockstreamSmartRFIDFountain](
1231-
key="device_sn",
1232-
translation_key="device_sn",
1233-
icon="mdi:identifier",
1234-
name="Device SN"
1235-
),
1236-
PetLibroSensorEntityDescription[DockstreamSmartRFIDFountain](
1237-
key="mac",
1238-
translation_key="mac_address",
1239-
icon="mdi:network",
1240-
name="MAC Address"
1241-
),
12421146
PetLibroSensorEntityDescription[DockstreamSmartRFIDFountain](
12431147
key="wifi_ssid",
12441148
translation_key="wifi_ssid",
@@ -1317,18 +1221,6 @@ def extra_state_attributes(self):
13171221
),
13181222
],
13191223
Dockstream2SmartCordlessFountain: [
1320-
PetLibroSensorEntityDescription[Dockstream2SmartCordlessFountain](
1321-
key="device_sn",
1322-
translation_key="device_sn",
1323-
icon="mdi:identifier",
1324-
name="Device SN"
1325-
),
1326-
PetLibroSensorEntityDescription[Dockstream2SmartCordlessFountain](
1327-
key="mac",
1328-
translation_key="mac_address",
1329-
icon="mdi:network",
1330-
name="MAC Address"
1331-
),
13321224
PetLibroSensorEntityDescription[Dockstream2SmartCordlessFountain](
13331225
key="wifi_ssid",
13341226
translation_key="wifi_ssid",
@@ -1446,18 +1338,6 @@ def extra_state_attributes(self):
14461338
),
14471339
],
14481340
Dockstream2SmartFountain: [
1449-
PetLibroSensorEntityDescription[Dockstream2SmartFountain](
1450-
key="device_sn",
1451-
translation_key="device_sn",
1452-
icon="mdi:identifier",
1453-
name="Device SN"
1454-
),
1455-
PetLibroSensorEntityDescription[Dockstream2SmartFountain](
1456-
key="mac",
1457-
translation_key="mac_address",
1458-
icon="mdi:network",
1459-
name="MAC Address"
1460-
),
14611341
PetLibroSensorEntityDescription[Dockstream2SmartFountain](
14621342
key="wifi_ssid",
14631343
translation_key="wifi_ssid",

custom_components/petlibro/translations/ar.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@
102102
},
103103
"entity": {
104104
"sensor": {
105-
"device_sn": {
106-
"name": "جهاز SN"
107-
},
108-
"mac_address": {
109-
"name": "عنوان MAC"
110-
},
111105
"wifi_ssid": {
112106
"name": "Wi-fi ssid"
113107
},

custom_components/petlibro/translations/bn.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@
102102
},
103103
"entity": {
104104
"sensor": {
105-
"device_sn": {
106-
"name": "ডিভাইস এসএন"
107-
},
108-
"mac_address": {
109-
"name": "ম্যাক ঠিকানা"
110-
},
111105
"wifi_ssid": {
112106
"name": "Wi-Fi ssid"
113107
},

custom_components/petlibro/translations/de.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@
102102
},
103103
"entity": {
104104
"sensor": {
105-
"device_sn": {
106-
"name": "Seriennummer"
107-
},
108-
"mac_address": {
109-
"name": "MAC Adresse"
110-
},
111105
"wifi_ssid": {
112106
"name": "Wi-Fi SSID"
113107
},

custom_components/petlibro/translations/dk.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@
102102
},
103103
"entity": {
104104
"sensor": {
105-
"device_sn": {
106-
"name": "Serienummer"
107-
},
108-
"mac_address": {
109-
"name": "MAC Address"
110-
},
111105
"wifi_ssid": {
112106
"name": "Wi-Fi SSID"
113107
},

custom_components/petlibro/translations/en.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@
113113
},
114114
"entity": {
115115
"sensor": {
116-
"device_sn": {
117-
"name": "Device SN"
118-
},
119-
"mac_address": {
120-
"name": "MAC Address"
121-
},
122116
"wifi_ssid": {
123117
"name": "Wi-Fi SSID"
124118
},

custom_components/petlibro/translations/es.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@
102102
},
103103
"entity": {
104104
"sensor": {
105-
"device_sn": {
106-
"name": "Dispositivo SN"
107-
},
108-
"mac_address": {
109-
"name": "Dirección MAC"
110-
},
111105
"wifi_ssid": {
112106
"name": "Wi-Fi SSID"
113107
},

custom_components/petlibro/translations/fr.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@
102102
},
103103
"entity": {
104104
"sensor": {
105-
"device_sn": {
106-
"name": "Appareil Sn"
107-
},
108-
"mac_address": {
109-
"name": "Adresse MAC"
110-
},
111105
"wifi_ssid": {
112106
"name": "Wi-Fi SSID"
113107
},

custom_components/petlibro/translations/hi.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@
102102
},
103103
"entity": {
104104
"sensor": {
105-
"device_sn": {
106-
"name": "युक्ति एसएन"
107-
},
108-
"mac_address": {
109-
"name": "मैक पता"
110-
},
111105
"wifi_ssid": {
112106
"name": "वाई-फाई ssid"
113107
},

0 commit comments

Comments
 (0)