diff --git a/homeassistant/components/rainmachine/__init__.py b/homeassistant/components/rainmachine/__init__.py index 1ad1fb734fa..a5426552ae2 100644 --- a/homeassistant/components/rainmachine/__init__.py +++ b/homeassistant/components/rainmachine/__init__.py @@ -31,6 +31,7 @@ from homeassistant.helpers import ( ) from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity, UpdateFailed +from homeassistant.util.dt import as_timestamp, utcnow from homeassistant.util.network import is_ip_address from .config_flow import get_client_controller @@ -299,7 +300,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_restrict_watering(call: ServiceCall) -> None: """Restrict watering for a time period.""" controller = async_get_controller_for_service_call(hass, call) - await controller.restrictions.restrict(call.data[CONF_DURATION]) + duration = call.data[CONF_DURATION] + await controller.restrictions.set_universal( + { + "rainDelayStartTime": round(as_timestamp(utcnow())), + "rainDelayDuration": duration.total_seconds(), + }, + ) await async_update_programs_and_zones(hass, entry) async def async_stop_all(call: ServiceCall) -> None: @@ -317,7 +324,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_unrestrict_watering(call: ServiceCall) -> None: """Unrestrict watering.""" controller = async_get_controller_for_service_call(hass, call) - await controller.restrictions.unrestrict() + await controller.restrictions.set_universal( + { + "rainDelayStartTime": round(as_timestamp(utcnow())), + "rainDelayDuration": 0, + }, + ) await async_update_programs_and_zones(hass, entry) for service_name, schema, method in ( diff --git a/homeassistant/components/rainmachine/manifest.json b/homeassistant/components/rainmachine/manifest.json index 4d60730ba6c..b183fc1b24f 100644 --- a/homeassistant/components/rainmachine/manifest.json +++ b/homeassistant/components/rainmachine/manifest.json @@ -3,7 +3,7 @@ "name": "RainMachine", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/rainmachine", - "requirements": ["regenmaschine==2022.07.3"], + "requirements": ["regenmaschine==2022.08.0"], "codeowners": ["@bachya"], "iot_class": "local_polling", "homekit": { diff --git a/requirements_all.txt b/requirements_all.txt index 1cd3875344c..d2777a873f3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2082,7 +2082,7 @@ raincloudy==0.0.7 raspyrfm-client==1.2.8 # homeassistant.components.rainmachine -regenmaschine==2022.07.3 +regenmaschine==2022.08.0 # homeassistant.components.renault renault-api==0.1.11 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index d387fd49e1d..75a0c06acc9 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1409,7 +1409,7 @@ radios==0.1.1 radiotherm==2.1.0 # homeassistant.components.rainmachine -regenmaschine==2022.07.3 +regenmaschine==2022.08.0 # homeassistant.components.renault renault-api==0.1.11