forked from MizterB/homeassistant-phyn
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sensors for Firmware Update, Leak Flow Test Running.
Add switch to turn off Scheduled Leak Flow Test
- Loading branch information
1 parent
3564374
commit 1c0ee15
Showing
7 changed files
with
206 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Switch representing the shutoff valve for the Phyn integration.""" | ||
from __future__ import annotations | ||
|
||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.entity_platform import AddEntitiesCallback | ||
from homeassistant.components.binary_sensor import BinarySensorEntity | ||
|
||
from .const import DOMAIN as PHYN_DOMAIN | ||
from .device import PhynDeviceDataUpdateCoordinator | ||
|
||
async def async_setup_entry( | ||
hass: HomeAssistant, | ||
config_entry: ConfigEntry, | ||
async_add_entities: AddEntitiesCallback, | ||
) -> None: | ||
"""Set up the Phyn switches from config entry.""" | ||
devices: list[PhynDeviceDataUpdateCoordinator] = hass.data[PHYN_DOMAIN][ | ||
config_entry.entry_id | ||
]["devices"] | ||
entities = [] | ||
for device in devices: | ||
entities.extend( | ||
[ | ||
entity | ||
for entity in device.entities | ||
if isinstance(entity, BinarySensorEntity) | ||
] | ||
) | ||
async_add_entities(entities) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.