def connect(self): logger.info("connecting harmony: %s:%s" % (self.ip, self.port)) self.harmony_client = pyharmony.get_client(self.ip, self.port, self.state_change_callback) self.harmony_config_cache = self.harmony_client.get_config() harmony_home_controls.register_automation_callback( self.harmony_client, self.home_control_callback) logger.info("Harmony connected.")
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Harmony Hub Climate platform.""" name = config.get(CONF_NAME) ip_addr = config.get(CONF_HOST) port = config.get(CONF_PORT) device_id = config.get(CONF_DEVICE_ID) min_temp = config.get(CONF_MIN_TEMP) max_temp = config.get(CONF_MAX_TEMP) target_temp = config.get(CONF_TARGET_TEMP) target_temp_step = config.get(CONF_TARGET_TEMP_STEP) temp_sensor_entity_id = config.get(CONF_TEMP_SENSOR) operation_list = config.get(CONF_CUSTOMIZE).get( CONF_OPERATIONS, []) or DEFAULT_OPERATION_LIST fan_list = config.get(CONF_CUSTOMIZE).get(CONF_FAN_MODES, []) or DEFAULT_FAN_MODE_LIST default_operation = config.get(CONF_DEFAULT_OPERATION) default_fan_mode = config.get(CONF_DEFAULT_FAN_MODE) default_operation_from_idle = config.get(CONF_DEFAULT_OPERATION_FROM_IDLE) import pyharmony harmony_device = pyharmony.get_client(ip_addr, port) if harmony_device is None: _LOGGER.error("Failed to connect to Harmony Hub") return else: _LOGGER.debug( "Connected to Harmony Hub Climate Component: %s at %s:%s", name, ip_addr, port) async_add_entities([ HarmonyIRClimate(hass, name, harmony_device, device_id, min_temp, max_temp, target_temp, target_temp_step, temp_sensor_entity_id, operation_list, fan_list, default_operation, default_fan_mode, default_operation_from_idle) ])
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
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