Add UDP listener in Lightwave (#85385)

pull/93223/head^2
Colin Robbins 2023-05-24 12:44:12 +01:00 committed by GitHub
parent c475273145
commit f355f0cc6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 8 deletions

View File

@ -1,4 +1,6 @@
"""Support for device connected via Lightwave WiFi-link hub."""
import logging
from lightwave.lightwave import LWLink
import voluptuous as vol
@ -20,12 +22,13 @@ CONF_PROXY_PORT = "proxy_port"
CONF_TRV = "trv"
CONF_TRVS = "trvs"
DEFAULT_PROXY_PORT = 7878
DEFAULT_PROXY_IP = "127.0.0.1"
DOMAIN = "lightwave"
LIGHTWAVE_LINK = f"{DOMAIN}_link"
LIGHTWAVE_TRV_PROXY = f"{DOMAIN}_proxy"
LIGHTWAVE_TRV_PROXY_PORT = f"{DOMAIN}_proxy_port"
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = vol.Schema(
{
@ -44,9 +47,7 @@ CONFIG_SCHEMA = vol.Schema(
vol.Optional(
CONF_PROXY_PORT, default=DEFAULT_PROXY_PORT
): cv.port,
vol.Optional(
CONF_PROXY_IP, default=DEFAULT_PROXY_IP
): cv.string,
vol.Optional(CONF_PROXY_IP): cv.string,
vol.Required(CONF_TRVS, default={}): {
cv.string: vol.Schema(
{
@ -84,9 +85,15 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
if trv := config[DOMAIN][CONF_TRV]:
trvs = trv[CONF_TRVS]
proxy_ip = trv[CONF_PROXY_IP]
proxy_ip = trv.get(CONF_PROXY_IP)
proxy_port = trv[CONF_PROXY_PORT]
lwlink.set_trv_proxy(proxy_ip, proxy_port)
if proxy_ip is None:
await lwlink.LW_listen()
else:
lwlink.set_trv_proxy(proxy_ip, proxy_port)
_LOGGER.warning(
"Proxy no longer required, remove `proxy_ip` from config to use builtin listener"
)
for platform in PLATFORMS:
hass.async_create_task(

View File

@ -5,5 +5,5 @@
"documentation": "https://www.home-assistant.io/integrations/lightwave",
"iot_class": "assumed_state",
"loggers": ["lightwave"],
"requirements": ["lightwave==0.20"]
"requirements": ["lightwave==0.24"]
}

View File

@ -1073,7 +1073,7 @@ life360==5.5.0
lightify==1.0.7.3
# homeassistant.components.lightwave
lightwave==0.20
lightwave==0.24
# homeassistant.components.limitlessled
limitlessled==1.1.3