Skip to content

Commit

Permalink
fix multiple TRVs in a room - asantaga#194
Browse files Browse the repository at this point in the history
  • Loading branch information
msp1974 committed Dec 23, 2021
1 parent 4d3a3d9 commit 6d33356
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion custom_components/wiser/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ def get_device_name(data, id, type = "device"):
if id == 0:
return f"{ENTITY_PREFIX} HeatHub ({data.wiserhub.system.name})"

if device.product_type in ["iTRV", "RoomStat"]:
if device.product_type == "iTRV":
device_room = data.wiserhub.rooms.get_by_device_id(id)
# To enable creating seperate devices for multiple TRVs in a room - issue #194
if device_room.number_of_smartvalves > 1:
# Get index of iTRV in room so they are numbered 1,2 etc instead of device id
# 1 is lowest device id, 2 next lowest etc
sv_index = device_room.smartvalve_ids.index(device.id) + 1
return f"{ENTITY_PREFIX} {device.product_type} {device_room.name}-{sv_index}"
return f"{ENTITY_PREFIX} {device.product_type} {device_room.name}"

if device.product_type == "RoomStat":
device_room = data.wiserhub.rooms.get_by_device_id(id)
return f"{ENTITY_PREFIX} {device.product_type} {device_room.name}"

Expand Down

0 comments on commit 6d33356

Please sign in to comment.