예제 #1
0
파일: __init__.py 프로젝트: mmmahammm/core
class DanfossAir:
    """Handle all communication with Danfoss Air CCM unit."""
    def __init__(self, host):
        """Initialize the Danfoss Air CCM connection."""
        self._data = {}

        from pydanfossair.danfossclient import DanfossClient

        self._client = DanfossClient(host)

    def get_value(self, item):
        """Get value for sensor."""
        return self._data.get(item)

    @Throttle(MIN_TIME_BETWEEN_UPDATES)
    def update(self):
        """Use the data from Danfoss Air API."""
        _LOGGER.debug("Fetching data from Danfoss Air CCM module")
        from pydanfossair.commands import ReadCommand
        self._data[ReadCommand.exhaustTemperature] \
            = self._client.command(ReadCommand.exhaustTemperature)
        self._data[ReadCommand.outdoorTemperature] \
            = self._client.command(ReadCommand.outdoorTemperature)
        self._data[ReadCommand.supplyTemperature] \
            = self._client.command(ReadCommand.supplyTemperature)
        self._data[ReadCommand.extractTemperature] \
            = self._client.command(ReadCommand.extractTemperature)
        self._data[ReadCommand.humidity] \
            = round(self._client.command(ReadCommand.humidity), 2)
        self._data[ReadCommand.filterPercent] \
            = round(self._client.command(ReadCommand.filterPercent), 2)
        self._data[ReadCommand.bypass] \
            = self._client.command(ReadCommand.bypass)

        _LOGGER.debug("Done fetching data from Danfoss Air CCM module")
예제 #2
0
class DanfossAir:
    """Handle all communication with Danfoss Air CCM unit."""

    def __init__(self, host):
        """Initialize the Danfoss Air CCM connection."""
        self._data = {}

        from pydanfossair.danfossclient import DanfossClient

        self._client = DanfossClient(host)

    def get_value(self, item):
        """Get value for sensor."""
        return self._data.get(item)

    @Throttle(MIN_TIME_BETWEEN_UPDATES)
    def update(self):
        """Use the data from Danfoss Air API."""
        _LOGGER.debug("Fetching data from Danfoss Air CCM module")
        from pydanfossair.commands import ReadCommand
        self._data[ReadCommand.exhaustTemperature] \
            = self._client.command(ReadCommand.exhaustTemperature)
        self._data[ReadCommand.outdoorTemperature] \
            = self._client.command(ReadCommand.outdoorTemperature)
        self._data[ReadCommand.supplyTemperature] \
            = self._client.command(ReadCommand.supplyTemperature)
        self._data[ReadCommand.extractTemperature] \
            = self._client.command(ReadCommand.extractTemperature)
        self._data[ReadCommand.humidity] \
            = round(self._client.command(ReadCommand.humidity), 2)
        self._data[ReadCommand.filterPercent] \
            = round(self._client.command(ReadCommand.filterPercent), 2)
        self._data[ReadCommand.bypass] \
            = self._client.command(ReadCommand.bypass)

        _LOGGER.debug("Done fetching data from Danfoss Air CCM module")
예제 #3
0
class DanfossAir:
    """Handle all communication with Danfoss Air CCM unit."""
    def __init__(self, host):
        """Initialize the Danfoss Air CCM connection."""
        self._data = {}

        self._client = DanfossClient(host)

    def get_value(self, item):
        """Get value for sensor."""
        return self._data.get(item)

    def update_state(self, command, state_command):
        """Send update command to Danfoss Air CCM."""
        self._data[state_command] = self._client.command(command)

    @Throttle(MIN_TIME_BETWEEN_UPDATES)
    def update(self):
        """Use the data from Danfoss Air API."""
        _LOGGER.debug("Fetching data from Danfoss Air CCM module")

        self._data[ReadCommand.exhaustTemperature] = self._client.command(
            ReadCommand.exhaustTemperature)
        self._data[ReadCommand.outdoorTemperature] = self._client.command(
            ReadCommand.outdoorTemperature)
        self._data[ReadCommand.supplyTemperature] = self._client.command(
            ReadCommand.supplyTemperature)
        self._data[ReadCommand.extractTemperature] = self._client.command(
            ReadCommand.extractTemperature)
        self._data[ReadCommand.humidity] = round(
            self._client.command(ReadCommand.humidity), 2)
        self._data[ReadCommand.filterPercent] = round(
            self._client.command(ReadCommand.filterPercent), 2)
        self._data[ReadCommand.bypass] = self._client.command(
            ReadCommand.bypass)
        self._data[ReadCommand.fan_step] = self._client.command(
            ReadCommand.fan_step)
        self._data[ReadCommand.supply_fan_speed] = self._client.command(
            ReadCommand.supply_fan_speed)
        self._data[ReadCommand.exhaust_fan_speed] = self._client.command(
            ReadCommand.exhaust_fan_speed)
        self._data[ReadCommand.away_mode] = self._client.command(
            ReadCommand.away_mode)
        self._data[ReadCommand.boost] = self._client.command(ReadCommand.boost)
        self._data[ReadCommand.battery_percent] = self._client.command(
            ReadCommand.battery_percent)
        self._data[ReadCommand.bypass] = self._client.command(
            ReadCommand.bypass)
        self._data[ReadCommand.automatic_bypass] = self._client.command(
            ReadCommand.automatic_bypass)

        _LOGGER.debug("Done fetching data from Danfoss Air CCM module")