Skip to content

Commit ead53da

Browse files
JFC-Devic-dev21
authored andcommitted
Update binary_sensor.py
Use hub index
1 parent 9094d82 commit ead53da

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

custom_components/hilo/binary_sensor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from homeassistant.helpers.entity_platform import AddEntitiesCallback
1111
from homeassistant.util import slugify
1212

13-
from . import Hilo
13+
from . import HUB_CHALLENGES, HUB_DEVICES, Hilo
1414
from .const import DOMAIN, LOG, SIGNAL_WEBSOCKET_STATUS
1515
from .entity import HiloEntity
1616

@@ -43,7 +43,7 @@ def __init__(self, hilo: Hilo, device):
4343
@property
4444
def is_on(self) -> bool:
4545
"""Return True if any WebSocket hub is connected."""
46-
return self._hilo._device_hub_connected or self._hilo._challenge_hub_connected
46+
return any(self._hilo._hub_connected.values())
4747

4848
@property
4949
def icon(self) -> str:
@@ -54,8 +54,8 @@ def icon(self) -> str:
5454
def extra_state_attributes(self) -> dict:
5555
"""Return individual hub connectivity details."""
5656
return {
57-
"devices_hub": self._hilo._device_hub_connected,
58-
"challenges_hub": self._hilo._challenge_hub_connected,
57+
"devices_hub": self._hilo._hub_connected[HUB_DEVICES],
58+
"challenges_hub": self._hilo._hub_connected[HUB_CHALLENGES],
5959
}
6060

6161
async def async_added_to_hass(self) -> None:

0 commit comments

Comments
 (0)