|
22 | 22 | from homeassistant.helpers.entity import Entity |
23 | 23 |
|
24 | 24 | from .uponor_api import UponorClient |
25 | | -from .uponor_api.const import (UNIT_BATTERY, UNIT_HUMIDITY) |
| 25 | +from .uponor_api.const import (DOMAIN, UNIT_BATTERY, UNIT_HUMIDITY) |
26 | 26 |
|
27 | 27 | _LOGGER = getLogger(__name__) |
28 | 28 |
|
@@ -77,9 +77,18 @@ def __init__(self, prefix, uponor_client, thermostat): |
77 | 77 | self.prefix = prefix |
78 | 78 | self.uponor_client = uponor_client |
79 | 79 | self.thermostat = thermostat |
80 | | - |
| 80 | + self.device_name = f"{prefix or ''}{thermostat.by_name('room_name').value}" |
| 81 | + self.device_id = f"{prefix or ''}controller{thermostat.controller_index}_thermostat{thermostat.thermostat_index}" |
81 | 82 | self.identity = f"{prefix or ''}controller{thermostat.controller_index}_thermostat{thermostat.thermostat_index}_temp" |
82 | 83 |
|
| 84 | + @property |
| 85 | + def device_info(self) -> dict: |
| 86 | + """Return info for device registry.""" |
| 87 | + return { |
| 88 | + "identifiers": {(DOMAIN, self.device_id)}, |
| 89 | + "name": self.device_name, |
| 90 | + } |
| 91 | + |
83 | 92 | # ** Generic ** |
84 | 93 | @property |
85 | 94 | def name(self): |
@@ -141,9 +150,18 @@ def __init__(self, prefix, uponor_client, thermostat): |
141 | 150 | self.prefix = prefix |
142 | 151 | self.uponor_client = uponor_client |
143 | 152 | self.thermostat = thermostat |
144 | | - |
| 153 | + self.device_name = f"{prefix or ''}{thermostat.by_name('room_name').value}" |
| 154 | + self.device_id = f"{prefix or ''}controller{thermostat.controller_index}_thermostat{thermostat.thermostat_index}" |
145 | 155 | self.identity = f"{prefix or ''}controller{thermostat.controller_index}_thermostat{thermostat.thermostat_index}_rh" |
146 | 156 |
|
| 157 | + @property |
| 158 | + def device_info(self) -> dict: |
| 159 | + """Return info for device registry.""" |
| 160 | + return { |
| 161 | + "identifiers": {(DOMAIN, self.device_id)}, |
| 162 | + "name": self.device_name, |
| 163 | + } |
| 164 | + |
147 | 165 | # ** Generic ** |
148 | 166 | @property |
149 | 167 | def name(self): |
@@ -197,9 +215,18 @@ def __init__(self, prefix, uponor_client, thermostat): |
197 | 215 | self.prefix = prefix |
198 | 216 | self.uponor_client = uponor_client |
199 | 217 | self.thermostat = thermostat |
200 | | - |
| 218 | + self.device_name = f"{prefix or ''}{thermostat.by_name('room_name').value}" |
| 219 | + self.device_id = f"{prefix or ''}controller{thermostat.controller_index}_thermostat{thermostat.thermostat_index}" |
201 | 220 | self.identity = f"{prefix or ''}controller{thermostat.controller_index}_thermostat{thermostat.thermostat_index}_batt" |
202 | 221 |
|
| 222 | + @property |
| 223 | + def device_info(self) -> dict: |
| 224 | + """Return info for device registry.""" |
| 225 | + return { |
| 226 | + "identifiers": {(DOMAIN, self.device_id)}, |
| 227 | + "name": self.device_name, |
| 228 | + } |
| 229 | + |
203 | 230 | # ** Generic ** |
204 | 231 | @property |
205 | 232 | def name(self): |
|
0 commit comments