Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration for Vallox Ventilation Units.
- Loading branch information
1 parent
d7fcb52
commit 7ce5051
Showing
9 changed files
with
643 additions
and
0 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
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,80 @@ | ||
"""Support for Vallox ventilation units.""" | ||
|
||
import ipaddress | ||
import logging | ||
|
||
import voluptuous as vol | ||
|
||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SENSORS | ||
from homeassistant.helpers import discovery | ||
import homeassistant.helpers.config_validation as cv | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
DOMAIN = 'vallox' | ||
DEFAULT_NAME = 'Vallox' | ||
|
||
MODE_METRIC_KEY = 'A_CYC_MODE' | ||
|
||
DATA_VALLOX_SENSOR_LIST = 'vallox_sensor_list' | ||
|
||
# List of implemented sensors. | ||
SENSOR_FAN_SPEED = 'fan_speed' | ||
SENSOR_TEMP_EXTRACT_AIR = 'temp_extract_air' | ||
SENSOR_TEMP_EXHAUST_AIR = 'temp_exhaust_air' | ||
SENSOR_TEMP_OUTDOOR_AIR = 'temp_outdoor_air' | ||
SENSOR_TEMP_SUPPLY_AIR = 'temp_supply_air' | ||
SENSOR_HUMIDITY = 'humidity' | ||
SENSOR_REMAINING_TIME_FILTER = 'remaining_time_filter' | ||
|
||
SENSORS = [ | ||
SENSOR_FAN_SPEED, | ||
SENSOR_TEMP_EXTRACT_AIR, | ||
SENSOR_TEMP_EXHAUST_AIR, | ||
SENSOR_TEMP_OUTDOOR_AIR, | ||
SENSOR_TEMP_SUPPLY_AIR, | ||
SENSOR_HUMIDITY, | ||
SENSOR_REMAINING_TIME_FILTER | ||
] | ||
|
||
CONFIG_SCHEMA = vol.Schema({ | ||
DOMAIN: vol.Schema({ | ||
vol.Required(CONF_HOST): vol.All(ipaddress.ip_address, cv.string), | ||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, | ||
vol.Optional(CONF_SENSORS): vol.All(cv.ensure_list, [vol.In(SENSORS)]), | ||
}), | ||
}, extra=vol.ALLOW_EXTRA) | ||
|
||
|
||
async def async_setup(hass, config): | ||
"""Set up the client and boot the platforms.""" | ||
from vallox_websocket_api import Vallox | ||
|
||
if DOMAIN not in config: | ||
return True | ||
|
||
conf = config[DOMAIN] | ||
host = conf.get(CONF_HOST) | ||
name = conf.get(CONF_NAME) | ||
|
||
vallox_client = Vallox(host) | ||
|
||
hass.data[DOMAIN] = { | ||
'client': vallox_client, | ||
'name': name | ||
} | ||
|
||
sensor_list = conf.get(CONF_SENSORS) | ||
hass.data[DATA_VALLOX_SENSOR_LIST] = sensor_list | ||
|
||
# Case for having a "sensors:" entry in the configuration. | ||
if sensor_list is not None: | ||
# If the list is empty, add all sensors by default. | ||
if not sensor_list: | ||
sensor_list = SENSORS | ||
|
||
await discovery.async_load_platform(hass, 'sensor', DOMAIN, {}, config) | ||
|
||
await discovery.async_load_platform(hass, 'fan', DOMAIN, {}, config) | ||
|
||
return True |
Oops, something went wrong.