Skip to content

Commit

Permalink
Check if 'coordinator' exists in hass.data
Browse files Browse the repository at this point in the history
Changed icon for night cooling switch and status
  • Loading branch information
toringer committed Jun 15, 2023
1 parent 3ca3591 commit b6416db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions custom_components/heru/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ICON_CALENDAR = "mdi:calendar"
ICON_THERMOSTAT = "mdi:home-thermometer"
ICON_START = "mdi:ray-start-arrow"
ICON_COOLING = "mdi:snowflake"

# Platforms
SENSOR = Platform.SENSOR
Expand Down Expand Up @@ -159,7 +160,7 @@
"modbus_address": "1x00038",
"address": 37,
"scale": None,
"icon": ICON_ALARM,
"icon": ICON_COOLING,
"unit_of_measurement": None,
"device_class": None,
"entity_category": EntityCategory.DIAGNOSTIC,
Expand Down Expand Up @@ -401,7 +402,7 @@
"name": "Night cooling enabled",
"modbus_address": "4x00019",
"address": 18,
"icon": ICON_SWITCH,
"icon": ICON_COOLING,
"register_type": HOLDING_REGISTERS,
},
]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/heru/helpers/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def validate_step_user(
"""Validate step_user"""

coordinator = None
if DOMAIN in hass.data:
if DOMAIN in hass.data and "coordinator" in hass.data[DOMAIN]:
coordinator = hass.data[DOMAIN]["coordinator"]
if coordinator is not None:
coordinator.pause()
Expand Down

0 comments on commit b6416db

Please sign in to comment.