Skip to content

Commit 3084c78

Browse files
authored
Added possible fix of switch icon error (#15)
* Added fix for switch icon error * Hacs json update
1 parent 0ca70bc commit 3084c78

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

custom_components/eldes_alarm/switch.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,14 @@ def extra_state_attributes(self):
6262
def icon(self):
6363
"""Return the icon of this sensor."""
6464
try:
65-
return OUTPUT_ICONS_MAP[self.data["outputs"][self.entity_index]["iconName"]]
66-
except ValueError:
65+
iconName = self.data["outputs"][self.entity_index]["iconName"]
66+
67+
if iconName is not None:
68+
return OUTPUT_ICONS_MAP[iconName]
69+
70+
return OUTPUT_ICONS_MAP["ICON_1"]
71+
72+
except Exception:
6773
_LOGGER.info("Unknown output icon for (%s)", self.data['outputs'][self.entity_index]['name'])
6874
return OUTPUT_ICONS_MAP["ICON_1"]
6975

hacs.json

-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
{
22
"name": "Eldes Alarm",
3-
"domains": [
4-
"alarm_control_panel",
5-
"binary_sensor",
6-
"sensor",
7-
"switch"
8-
],
93
"render_readme": true
104
}

0 commit comments

Comments
 (0)