Skip to content

Commit

Permalink
Improve icons for switches for pumps and valves.
Browse files Browse the repository at this point in the history
  • Loading branch information
djtimca committed Jun 3, 2022
1 parent 63ea77a commit a1c242a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions custom_components/omnilogic/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ def __init__(
item_id: tuple,
state_key: str,
) -> None:

switch_type = coordinator.data[item_id].get("Type")

if switch_type:
icon = SWITCH_ICONS[switch_type]

"""Initialize Entities."""
super().__init__(
coordinator=coordinator,
Expand Down Expand Up @@ -235,7 +241,7 @@ async def async_set_speed(self, speed):
"entity_classes": {"relayState": OmniLogicRelayControl},
"name": "",
"kind": "relay",
"icon": None,
"icon": "mdi:electric-switch",
"guard_condition": [],
},
],
Expand All @@ -244,7 +250,7 @@ async def async_set_speed(self, speed):
"entity_classes": {"relayState": OmniLogicRelayControl},
"name": "",
"kind": "relay",
"icon": None,
"icon": "mdi:electric-switch",
"guard_condition": [],
}
],
Expand All @@ -253,7 +259,7 @@ async def async_set_speed(self, speed):
"entity_classes": {"pumpState": OmniLogicPumpControl},
"name": "",
"kind": "pump",
"icon": None,
"icon": "mdi:pump",
"guard_condition": [],
}
],
Expand All @@ -262,8 +268,12 @@ async def async_set_speed(self, speed):
"entity_classes": {"filterState": OmniLogicPumpControl},
"name": "",
"kind": "pump",
"icon": None,
"icon": "mdi:pump",
"guard_condition": [],
}
],
}

SWITCH_ICONS = {
"RLY_VALVE_ACTUATOR": "mdi:valve"
}

0 comments on commit a1c242a

Please sign in to comment.