Exemplo n.º 1
0
 def __init__(self, name, mac, target_temp, keep_alive, initial_hvac_mode,
              away_temp, unit):
     super(TionClimateYaml,
           self).__init__(name, mac, target_temp, keep_alive,
                          initial_hvac_mode, away_temp, unit)
     from tion_btle.s3 import S3 as tion
     self._tion = tion(self.mac)
Exemplo n.º 2
0
    def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry):
        self.hass: HomeAssistant = hass
        self._config_entry: ConfigEntry = config_entry

        self._entry_id: str = self._config_entry.entry_id

        self.__keep_alive: int = 60
        try:
            self.__keep_alive = self.config[CONF_KEEP_ALIVE]
        except KeyError:
            pass

        self.__out_temp: int = None
        self.__fan_speed: int = None
        self.__heater_temp: int = None

        self.__is_on: bool = None
        self.__is_heater_on: bool = None
        self.__is_heating: bool = None
        self.__fw_version: str = None
        self.__in_temp: int = None
        self.__filter_remain: int = None

        # delay before next update if we got btle.BTLEDisconnectError
        self._delay: int = 600
        self._next_update: int = 0

        self.__tion = tion(self.config[CONF_MAC])

        hass.loop.create_task(self.start_up())
Exemplo n.º 3
0
    async def async_step_user(self, input=None):
        """user initiates a flow via the user interface."""

        if input is not None:
            self._data = input
            if input['pair']:
                _LOGGER.debug("Showing pair info")
                return self.async_show_form(step_id="pair")
            else:
                _LOGGER.debug("Going create entry with name %s" %
                              input['name'])
                _LOGGER.debug(input)
                from tion_btle.s3 import s3 as tion
                try:
                    _tion: tion = tion(input['mac'])
                    result = _tion.get()
                    fw: str = result['fw_version']
                except Exception as e:
                    _LOGGER.error(
                        "Could not get data from breezer. result is %s, error: %s"
                        % (result, str(e)))
                    return self.async_show_form(step_id='add_failed')

                return self.async_create_entry(title=input['name'], data=input)
        try:
            config = self.hass.data['climate'].config['climate']
        except KeyError:
            config = {}
        self._build_schema(config)
        return self.async_show_form(step_id="user", data_schema=self._schema)
Exemplo n.º 4
0
    async def async_step_pair(self, input):
        """Pair host and breezer"""
        from tion_btle.s3 import s3 as tion
        _LOGGER.debug("Real pairing step")
        _tion: tion = tion(self._data['mac'])
        result = {}
        try:
            _tion.pair()
            # We should sleep a bit, because immediately connection will cause device disconnected exception while
            # enabling notifications
            result = _tion.get()
            fw: str = result['fw_version']
        except Exception as e:
            _LOGGER.error("Cannot pair and get data. Result is %s, error: %s" %
                          (result, str(e)))
            return self.async_show_form(step_id='pair_failed')

        return self.async_create_entry(title=self._data['name'],
                                       data=self._data)
Exemplo n.º 5
0
 def __init__(self, name, mac, target_temp, keep_alive, initial_hvac_mode,
              away_temp, unit):
     super(TionClimateYaml,
           self).__init__(name, mac, target_temp, keep_alive,
                          initial_hvac_mode, away_temp, unit)
     self._tion = tion(self.mac)