1 """Support for Danfoss Air HRV."""
3 from datetime
import timedelta
6 from pydanfossair.commands
import ReadCommand
7 from pydanfossair.danfossclient
import DanfossClient
8 import voluptuous
as vol
17 _LOGGER = logging.getLogger(__name__)
19 PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR, Platform.SWITCH]
20 DOMAIN =
"danfoss_air"
24 CONFIG_SCHEMA = vol.Schema(
25 {DOMAIN: vol.Schema({vol.Required(CONF_HOST): cv.string})}, extra=vol.ALLOW_EXTRA
29 def setup(hass: HomeAssistant, config: ConfigType) -> bool:
30 """Set up the Danfoss Air component."""
33 hass.data[DOMAIN] =
DanfossAir(conf[CONF_HOST])
35 for platform
in PLATFORMS:
36 discovery.load_platform(hass, platform, DOMAIN, {}, config)
42 """Handle all communication with Danfoss Air CCM unit."""
45 """Initialize the Danfoss Air CCM connection."""
51 """Get value for sensor."""
55 """Send update command to Danfoss Air CCM."""
56 self.
_data_data[state_command] = self.
_client_client.command(command)
58 @Throttle(MIN_TIME_BETWEEN_UPDATES)
60 """Use the data from Danfoss Air API."""
61 _LOGGER.debug(
"Fetching data from Danfoss Air CCM module")
63 self.
_data_data[ReadCommand.exhaustTemperature] = self.
_client_client.command(
64 ReadCommand.exhaustTemperature
66 self.
_data_data[ReadCommand.outdoorTemperature] = self.
_client_client.command(
67 ReadCommand.outdoorTemperature
69 self.
_data_data[ReadCommand.supplyTemperature] = self.
_client_client.command(
70 ReadCommand.supplyTemperature
72 self.
_data_data[ReadCommand.extractTemperature] = self.
_client_client.command(
73 ReadCommand.extractTemperature
75 self.
_data_data[ReadCommand.humidity] = round(
76 self.
_client_client.command(ReadCommand.humidity), 2
78 self.
_data_data[ReadCommand.filterPercent] = round(
79 self.
_client_client.command(ReadCommand.filterPercent), 2
81 self.
_data_data[ReadCommand.bypass] = self.
_client_client.command(ReadCommand.bypass)
82 self.
_data_data[ReadCommand.fan_step] = self.
_client_client.command(ReadCommand.fan_step)
83 self.
_data_data[ReadCommand.supply_fan_speed] = self.
_client_client.command(
84 ReadCommand.supply_fan_speed
86 self.
_data_data[ReadCommand.exhaust_fan_speed] = self.
_client_client.command(
87 ReadCommand.exhaust_fan_speed
89 self.
_data_data[ReadCommand.away_mode] = self.
_client_client.command(ReadCommand.away_mode)
90 self.
_data_data[ReadCommand.boost] = self.
_client_client.command(ReadCommand.boost)
91 self.
_data_data[ReadCommand.battery_percent] = self.
_client_client.command(
92 ReadCommand.battery_percent
94 self.
_data_data[ReadCommand.bypass] = self.
_client_client.command(ReadCommand.bypass)
95 self.
_data_data[ReadCommand.automatic_bypass] = self.
_client_client.command(
96 ReadCommand.automatic_bypass
99 _LOGGER.debug(
"Done fetching data from Danfoss Air CCM module")
def update_state(self, command, state_command)
def get_value(self, item)
web.Response get(self, web.Request request, str config_key)
bool setup(HomeAssistant hass, ConfigType config)