diff --git a/custom_components/luxtronik/__init__.py b/custom_components/luxtronik/__init__.py index 561db6f..cd816ef 100644 --- a/custom_components/luxtronik/__init__.py +++ b/custom_components/luxtronik/__init__.py @@ -60,12 +60,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: def setup_hass_services(hass: HomeAssistant, entry: ConfigEntry): """Home Assistant services.""" - def write_parameter(service): + async def write_parameter(service): """Write a parameter to the Luxtronik heatpump.""" parameter = service.data.get(ATTR_PARAMETER) value = service.data.get(ATTR_VALUE) - coordinator = LuxtronikCoordinator.connect(hass, entry) - coordinator.write(parameter, value) + data = hass.data[DOMAIN].get(entry.entry_id) + coordinator: LuxtronikCoordinator = data[CONF_COORDINATOR] + await coordinator.async_write(parameter, value) hass.services.register( DOMAIN, SERVICE_WRITE, write_parameter, schema=SERVICE_WRITE_SCHEMA diff --git a/custom_components/luxtronik/manifest.json b/custom_components/luxtronik/manifest.json index f2969b9..a8f1a21 100755 --- a/custom_components/luxtronik/manifest.json +++ b/custom_components/luxtronik/manifest.json @@ -9,7 +9,7 @@ "after_dependencies": [], "codeowners": ["@BenPru"], "iot_class": "local_polling", - "version": "2023.11.29", + "version": "2023.11.30", "homeassistant": "2023.1.0", "dhcp": [ { "macaddress": "000E8C*" },