Skip to content

Commit 87ead6b

Browse files
committed
Simple PLATFORM names, better unique_ids
1 parent 6f7be86 commit 87ead6b

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

custom_components/plugwise-beta/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
_LOGGER = logging.getLogger(__name__)
2121

22-
SENSORS = ["sensor"]
23-
CLIMATE = ["binary_sensor", "climate", "sensor", "switch"]
22+
SENSOR = ["sensor"]
23+
SINGLE = ["binary_sensor", "climate", "sensor", "switch"]
2424
MULTI = ["binary_sensor", "climate", "sensor", "switch", "water_heater"]
2525

2626
async def async_setup(hass: HomeAssistant, config: dict):
@@ -70,11 +70,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
7070
_LOGGER.debug("Single master thermostat = %s", single_master_thermostat)
7171
if single_master_thermostat is not None:
7272
if single_master_thermostat == True:
73-
PLATFORMS = CLIMATE
73+
PLATFORMS = SINGLE
7474
else:
7575
PLATFORMS = MULTI
7676
else:
77-
PLATFORMS = SENSORS
77+
PLATFORMS = SENSOR
7878

7979
for component in PLATFORMS:
8080
hass.async_create_task(

custom_components/plugwise-beta/binary_sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __init__(self, api, updater, name, binary_sensor, dev_id):
7272
self._name = name
7373
self._binary_sensor = binary_sensor
7474
self._is_on = False
75-
self._unique_id = f"{dev_id}-{name}"
75+
self._unique_id = f"bs-{dev_id}-{name}"
7676

7777
@property
7878
def unique_id(self):

custom_components/plugwise-beta/climate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __init__(self, api, updater, name, dev_id, loc_id, min_temp, max_temp):
103103
self._schedule_temp = None
104104
self._hvac_mode = None
105105
self._single_thermostat = self._api.single_master_thermostat()
106-
self._unique_id = f"{dev_id}-climate"
106+
self._unique_id = f"cl-{dev_id}-{name}"
107107

108108
@property
109109
def unique_id(self):

custom_components/plugwise-beta/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def __init__(self, api, updater, name, dev_id, sensor, sensor_type):
204204
self._icon = sensor_type[3]
205205
self._class = sensor_type[2]
206206
self._state = None
207-
self._unique_id = f"{dev_id}-{name}-{sensor_type[2]}"
207+
self._unique_id = f"sr-{dev_id}-{name}"
208208
_LOGGER.debug("Registering Plugwise %s", self._unique_id)
209209

210210
@property

custom_components/plugwise-beta/switch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, api, updater, name, dev_id):
4444
self._name = name
4545
self._dev_id = dev_id
4646
self._device_is_on = False
47-
self._unique_id = f"{dev_id}-{name}"
47+
self._unique_id = f"sw-{dev_id}-{name}"
4848

4949
@property
5050
def unique_id(self):

custom_components/plugwise-beta/water_heater.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(self, api, updater, name, dev_id):
6767
self._cooling_state = False
6868
self._domestic_hot_water_state = False
6969
self._central_heater_water_pressure = None
70-
self._unique_id = f"{dev_id}-water_heater"
70+
self._unique_id = f"wh-{dev_id}-{name}"
7171

7272
@property
7373
def unique_id(self):

0 commit comments

Comments
 (0)