Add Off-peak power control to Roborock (#97307)

* add off-peak switch and time

* Make off_peak disabled by default
This commit is contained in:
Luke 2023-08-09 16:04:01 -04:00 committed by GitHub
parent 02c27d8ad2
commit 2841cbbed2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 0 deletions

View file

@ -84,6 +84,25 @@ SWITCH_DESCRIPTIONS: list[RoborockSwitchDescription] = [
icon="mdi:bell-cancel",
entity_category=EntityCategory.CONFIG,
),
RoborockSwitchDescription(
cache_key=CacheableAttribute.valley_electricity_timer,
update_value=lambda cache, value: cache.update_value(
[
cache.value.get("start_hour"),
cache.value.get("start_minute"),
cache.value.get("end_hour"),
cache.value.get("end_minute"),
]
)
if value
else cache.close_value(),
attribute="enabled",
key="off_peak_switch",
translation_key="off_peak_switch",
icon="mdi:power-plug",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
),
]