Skip to content

Commit 972075b

Browse files
authored
Merge branch 'master' into s_m_t_devicenames
2 parents 8ea363e + 049535c commit 972075b

File tree

6 files changed

+43
-9
lines changed

6 files changed

+43
-9
lines changed

.github/workflows/hassfest.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Validate with hassfest
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 0 * * *"
8+
9+
jobs:
10+
validate:
11+
runs-on: "ubuntu-latest"
12+
steps:
13+
- uses: "actions/checkout@v2"
14+
- uses: home-assistant/actions/hassfest@master

custom_components/plugwise-beta/binary_sensor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,15 @@ def state(self):
114114
@property
115115
def device_info(self) -> Dict[str, any]:
116116
"""Return the device information."""
117+
via_device = None
118+
dev_name = f"{self._name.split('_')[0]} Sensors"
119+
if self._dev_id is not self._api.gateway_id:
120+
via_device = (DOMAIN, self._api.gateway_id)
117121
return {
118122
"identifiers": {(DOMAIN, self._dev_id)},
119-
"name": self._name,
123+
"name": dev_name,
120124
"manufacturer": "Plugwise",
121-
"via_device": (DOMAIN, self._api.gateway_id),
125+
"via_device": via_device,
122126
}
123127

124128
@property

custom_components/plugwise-beta/climate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,15 @@ def name(self):
149149
@property
150150
def device_info(self) -> Dict[str, any]:
151151
"""Return the device information."""
152+
via_device = None
153+
dev_name = f"{self._name.split('_')[0]} Climate/Thermostat"
154+
if self._dev_id is not self._api.gateway_id:
155+
via_device = (DOMAIN, self._api.gateway_id)
152156
return {
153157
"identifiers": {(DOMAIN, self._dev_id)},
154-
"name": self._name,
158+
"name": dev_name,
155159
"manufacturer": "Plugwise",
156-
"via_device": (DOMAIN, self._api.gateway_id),
160+
"via_device": via_device,
157161
}
158162

159163
@property

custom_components/plugwise-beta/sensor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,13 @@ def state(self):
256256
@property
257257
def device_info(self) -> Dict[str, any]:
258258
"""Return the device information."""
259+
via_device = None
260+
dev_name = f"{self._name.split('_')[0]} Sensors"
261+
if self._dev_id is not self._api.gateway_id:
262+
via_device = (DOMAIN, self._api.gateway_id)
259263
return {
260264
"identifiers": {(DOMAIN, self._dev_id)},
261-
"name": self._name,
265+
"name": dev_name,
262266
"manufacturer": "Plugwise",
263267
"via_device": (DOMAIN, self._via_id),
264268
}

custom_components/plugwise-beta/switch.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@ def is_on(self):
6666
@property
6767
def device_info(self) -> Dict[str, any]:
6868
"""Return the device information."""
69+
via_device = None
70+
dev_name = f"{self._name.split('_')[0]} Plug/Switch"
71+
if self._dev_id is not self._api.gateway_id:
72+
via_device = (DOMAIN, self._api.gateway_id)
6973
return {
7074
"identifiers": {(DOMAIN, self._dev_id)},
71-
"name": self._name,
75+
"name": dev_name,
7276
"manufacturer": "Plugwise",
73-
"via_device": (DOMAIN, self._api.gateway_id),
77+
"via_device": via_device,
7478
}
7579

7680
@property

custom_components/plugwise-beta/water_heater.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,15 @@ def name(self):
100100
@property
101101
def device_info(self) -> Dict[str, any]:
102102
"""Return the device information."""
103+
via_device = None
104+
dev_name = f"{self._name.split('_')[0]} Heater Central/Boiler"
105+
if self._dev_id is not self._api.gateway_id:
106+
via_device = (DOMAIN, self._api.gateway_id)
103107
return {
104108
"identifiers": {(DOMAIN, self._dev_id)},
105-
"name": self._name,
109+
"name": dev_name,
106110
"manufacturer": "Plugwise",
107-
"via_device": (DOMAIN, self._api.gateway_id),
111+
"via_device": via_device,
108112
}
109113

110114
@property

0 commit comments

Comments
 (0)