Skip to content

Commit

Permalink
Removed set_filter_days from services
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyd-be committed Dec 4, 2023
1 parent 6e38af7 commit 1753442
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 18 deletions.
69 changes: 69 additions & 0 deletions homeassistant/components/renson/__init__.py
Expand Up @@ -58,3 +58,72 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data[DOMAIN].pop(entry.entry_id)

return unload_ok


def setup_hass_services(hass: HomeAssistant, renson_api: RensonVentilation) -> None:
"""Set up the Renson platforms."""

async def set_timer_level(call: ServiceCall) -> None:
"""Set timer level."""
level_string = call.data.get("timer_level", "Level1")
time = call.data.get("time", 0)
level = Level[level_string.upper()]

await hass.async_add_executor_job(renson_api.set_timer_level, level, time)

async def sync_time(call: ServiceCall) -> None:
"""Sync time of device."""
await hass.async_add_executor_job(renson_api.sync_time)

async def set_manual_level(call: ServiceCall) -> None:
"""Set manual level."""
level_string = call.data.get("manual_level", "Off")
level = Level[level_string.upper()]

await hass.async_add_executor_job(renson_api.set_manual_level, level)

async def set_breeze(call: ServiceCall) -> None:
"""Configure breeze feature."""
level = call.data.get("breeze_level", "")
temperature = call.data.get("temperature", 0)
activated = call.data.get("activate", False)

await hass.async_add_executor_job(
renson_api.set_breeze, level, temperature, activated
)

async def set_day_night_time(call: ServiceCall) -> None:
"""Configure day night times."""
day = call.data.get("day", "7:00")
night = call.data.get("night", "22:00")

await hass.async_add_executor_job(renson_api.set_time, day, night)

async def set_pollution_settings(call: ServiceCall) -> None:
"""Configure pollutions settings."""
day = call.data.get("day_pollution_level", "")
night = call.data.get("night_pollution_level", "")
humidity_control = call.data.get("humidity_control", "")
airquality_control = call.data.get("airquality_control", "")
co2_control = call.data.get("co2_control", "")
co2_threshold = call.data.get("co2_threshold", 0)
co2_hysteresis = call.data.get("co2_hysteresis", 0)

await renson_api.set_pollution(
day,
night,
humidity_control,
airquality_control,
co2_control,
co2_threshold,
co2_hysteresis,
)

hass.services.async_register(DOMAIN, "set_manual_level", set_manual_level)
hass.services.async_register(DOMAIN, "set_breeze", set_breeze)
hass.services.async_register(DOMAIN, "set_day_night_time", set_day_night_time)
hass.services.async_register(
DOMAIN, "set_pollution_settings", set_pollution_settings
)
hass.services.async_register(DOMAIN, "set_timer_level", set_timer_level)
hass.services.async_register(DOMAIN, "sync_time", sync_time)
18 changes: 0 additions & 18 deletions homeassistant/components/renson/services.yaml
Expand Up @@ -196,21 +196,3 @@ set_pollution_settings:
step: 50
unit_of_measurement: "ppm"
mode: slider

set_filter_days:
name: Set filter days
description: Indicates the recommended filter remaining time in case of filter change, in days
fields:
days:
name: Days
description: Indicates the recommended filter remaining time in case of filter change, in days
required: true
advanced: false
default: 90
selector:
number:
min: 0
max: 360
step: 1
unit_of_measurement: "days"
mode: slider

0 comments on commit 1753442

Please sign in to comment.