From 4bfc7b984852398238053cde0e9dcf334bd5f4c7 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Tue, 31 Dec 2019 14:41:44 +0100 Subject: [PATCH] Add homematic host port config for HMIP-only CCUs (#30077) * homematic: Add host port config for HMIP-only CCUs When adding a host (CCU) to the homematic component currently the hardcoded port 2001 is used to communicate with it. However that port is only available on the target if the target supports HM (wireless) protocol which is not the case e.g. for the Hass.io Homematic CCU addon when running in HMIP-only mode with the HMIP-RFUSB stick. This allows to change the port home assistant uses to talk to the CCU in order to provide services under hte homematic homain, e.g. homematic.set_variable_value The default value for this option is the old hardcoded value this the change should be backwards compatible with existing configurations. * Change style of config retrieval --- homeassistant/components/homematic/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/homematic/__init__.py b/homeassistant/components/homematic/__init__.py index 828e170c67d..d0776baa106 100644 --- a/homeassistant/components/homematic/__init__.py +++ b/homeassistant/components/homematic/__init__.py @@ -298,6 +298,7 @@ CONFIG_SCHEMA = vol.Schema( vol.Optional(CONF_HOSTS, default={}): { cv.match_all: { vol.Required(CONF_HOST): cv.string, + vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, vol.Optional( CONF_USERNAME, default=DEFAULT_USERNAME ): cv.string, @@ -392,7 +393,7 @@ def setup(hass, config): for sname, sconfig in conf[CONF_HOSTS].items(): remotes[sname] = { "ip": sconfig.get(CONF_HOST), - "port": DEFAULT_PORT, + "port": sconfig[CONF_PORT], "username": sconfig.get(CONF_USERNAME), "password": sconfig.get(CONF_PASSWORD), "connect": False,