Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb00f86
commit 53e2db6
Showing
4 changed files
with
74 additions
and
55 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,69 @@ | ||
"""Support for Salda Smarty XP/XV Ventilation Unit Binary Sensors.""" | ||
|
||
import logging | ||
|
||
from homeassistant.components.binary_sensor import BinarySensorDevice | ||
from . import DOMAIN | ||
from .sensor import SmartySensor | ||
|
||
DEPENDENCIES = ['smarty'] | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
async def async_setup_platform(hass, config, async_add_devices, | ||
discovery_info=None): | ||
"""Set up the Smarty Binary Sensor Platform.""" | ||
smarty = hass.data[DOMAIN]['api'] | ||
name = hass.data[DOMAIN]['name'] | ||
|
||
sensors = [AlarmSensor(name, smarty), | ||
WarningSensor(name, smarty), | ||
BoostSensor(name, smarty)] | ||
|
||
async_add_devices(sensors) | ||
|
||
|
||
class BoostSensor(SmartySensor, BinarySensorDevice): | ||
"""Boost State Binary Sensor.""" | ||
|
||
def __init__(self, name, smarty): | ||
"""Alarm Sensor Init.""" | ||
super().__init__(name='{} Boost State'.format(name), | ||
device_class=None, | ||
smarty=smarty) | ||
|
||
def update(self) -> None: | ||
"""Update state.""" | ||
_LOGGER.debug('Updating sensor %s', self._name) | ||
self._state = self._smarty.boost | ||
|
||
|
||
class AlarmSensor(SmartySensor, BinarySensorDevice): | ||
"""Alarm Binary Sensor.""" | ||
|
||
def __init__(self, name, smarty): | ||
"""Alarm Sensor Init.""" | ||
super().__init__(name='{} Alarm'.format(name), | ||
device_class=None, | ||
smarty=smarty) | ||
|
||
def update(self) -> None: | ||
"""Update state.""" | ||
_LOGGER.debug('Updating sensor %s', self._name) | ||
self._state = self._smarty.alarm | ||
|
||
|
||
class WarningSensor(SmartySensor, BinarySensorDevice): | ||
"""Warning Sensor.""" | ||
|
||
def __init__(self, name, smarty): | ||
"""Warning Sensor Init.""" | ||
super().__init__(name='{} Warning'.format(name), | ||
device_class=None, | ||
smarty=smarty) | ||
|
||
def update(self) -> None: | ||
"""Update state.""" | ||
_LOGGER.debug('Updating sensor %s', self._name) | ||
self._state = self._smarty.warning |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/ Home Assistant core | ||
# Home Assistant core | ||
aiohttp==3.5.4 | ||
astral==1.10.1 | ||
async_timeout==3.0.1 | ||
|