def sync(self):
     """Sync the Harmony device with the web service."""
     import pyharmony
     _LOGGER.debug("Syncing hub with Harmony servers")
     self._client.sync()
     self._config = self._client.get_config()
     _LOGGER.debug("Writing hub config to file: %s", self._config_path)
     pyharmony.ha_write_config_file(self._config, self._config_path)
Example #2
0
 def sync(self):
     """Sync the Harmony device with the web service."""
     import pyharmony
     _LOGGER.debug("Syncing hub with Harmony servers")
     self._client.sync()
     self._config = self._client.get_config()
     _LOGGER.debug("Writing hub config to file: %s", self._config_path)
     pyharmony.ha_write_config_file(self._config, self._config_path)
Example #3
0
 def sync(self):
     """Sync the Harmony device with the web service."""
     import pyharmony
     _LOGGER.debug("Syncing hub with Harmony servers")
     pyharmony.ha_sync(self._token, self._ip, self._port)
     self._config = pyharmony.ha_get_config(
         self._token, self._ip, self._port)
     _LOGGER.debug("Writing hub config to file: %s", self._config_path)
     pyharmony.ha_write_config_file(self._config, self._config_path)
    def __init__(self, name, host, port, activity, out_path, token):
        """Initialize HarmonyRemote class."""
        import pyharmony
        from pathlib import Path

        _LOGGER.debug('HarmonyRemote device init started for: ' + name)
        self._name = name
        self._ip = host
        self._port = port
        self._state = None
        self._current_activity = None
        self._default_activity = activity
        self._token = token
        self._config_path = out_path
        _LOGGER.debug('retrieving harmony config using token: ' + token)
        self._config = pyharmony.ha_get_config(self._token, host, port)
        if not Path(self._config_path).is_file():
            _LOGGER.debug('writing harmony configuration to file: ' + out_path)
            pyharmony.ha_write_config_file(self._config, self._config_path)
Example #5
0
    def __init__(self, name, host, port, activity, out_path, token):
        """Initialize HarmonyRemote class."""
        import pyharmony
        from pathlib import Path

        _LOGGER.debug("HarmonyRemote device init started for: %s", name)
        self._name = name
        self._ip = host
        self._port = port
        self._state = None
        self._current_activity = None
        self._default_activity = activity
        self._token = token
        self._config_path = out_path
        _LOGGER.debug("Retrieving harmony config using token: %s", token)
        self._config = pyharmony.ha_get_config(self._token, host, port)
        if not Path(self._config_path).is_file():
            _LOGGER.debug("Writing harmony configuration to file: %s", out_path)
            pyharmony.ha_write_config_file(self._config, self._config_path)
    def __init__(self, name, host, port, activity, out_path, delay_secs):
        """Initialize HarmonyRemote class."""
        import pyharmony
        from pathlib import Path

        _LOGGER.debug("HarmonyRemote device init started for: %s", name)
        self._name = name
        self.host = host
        self.port = port
        self._state = None
        self._current_activity = None
        self._default_activity = activity
        self._client = pyharmony.get_client(host, port, self.new_activity)
        self._config_path = out_path
        self._config = self._client.get_config()
        if not Path(self._config_path).is_file():
            _LOGGER.debug("Writing harmony configuration to file: %s",
                          out_path)
            pyharmony.ha_write_config_file(self._config, self._config_path)
        self._delay_secs = delay_secs
Example #7
0
    def __init__(self, name, host, port, activity, out_path, delay_secs):
        """Initialize HarmonyRemote class."""
        import pyharmony
        from pathlib import Path

        _LOGGER.debug("HarmonyRemote device init started for: %s", name)
        self._name = name
        self.host = host
        self.port = port
        self._state = None
        self._current_activity = None
        self._default_activity = activity
        self._client = pyharmony.get_client(host, port, self.new_activity)
        self._config_path = out_path
        self._config = self._client.get_config()
        if not Path(self._config_path).is_file():
            _LOGGER.debug("Writing harmony configuration to file: %s",
                          out_path)
            pyharmony.ha_write_config_file(self._config, self._config_path)
        self._delay_secs = delay_secs
        if activity:
            pyharmony.ha_start_activity(self._token, self._ip, self._port,
                                        self._config, activity)
            self._state = True
        else:
            _LOGGER.error('No activity specified with turn_on service')

    def turn_off(self):
        """Start the PowerOff activity."""
        import pyharmony
        pyharmony.ha_power_off(self._token, self._ip, self._port)

    def send_command(self, **kwargs):
        """Send a command to one device."""
        import pyharmony
        pyharmony.ha_send_command(self._token, self._ip, self._port,
                                  kwargs[ATTR_DEVICE], kwargs[ATTR_COMMAND])

    def sync(self):
        """Sync the Harmony device with the web service."""
        import pyharmony
        _LOGGER.debug('syncing hub with Harmony servers')
        pyharmony.ha_sync(self._token, self._ip, self._port)
        self._config = pyharmony.ha_get_config(self._token, self._ip,
                                               self._port)
        _LOGGER.debug('writing hub config to file: ' + self._config_path)


pyharmony.ha_write_config_file(self._config, self._config_path)