From ef112e24990c5e5cdf9b6ca4759bf7caf3cb44e9 Mon Sep 17 00:00:00 2001 From: Jens Date: Mon, 5 Oct 2020 19:30:43 +0200 Subject: [PATCH] Filter alarm support --- custom_components/dukaone/fan.py | 17 ++++++++++++++++- custom_components/dukaone/manifest.json | 2 +- custom_components/dukaone/services.yaml | 10 ++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/custom_components/dukaone/fan.py b/custom_components/dukaone/fan.py index ebfb9ee..5c62cdd 100644 --- a/custom_components/dukaone/fan.py +++ b/custom_components/dukaone/fan.py @@ -57,6 +57,9 @@ vol.Required(ATTR_ENTITY_ID): cv.entity_ids, vol.Required(ATTR_MODE): VALID_MODE }) +RESET_FILTER_TIMER_SCHEMA = vol.Schema({ + vol.Required(ATTR_ENTITY_ID): cv.entity_ids +}) @@ -91,6 +94,9 @@ async def async_setup_entry( platform.async_register_entity_service( "set_mode", SET_MODE_SCHEMA,"set_mode" ) + platform.async_register_entity_service( + "reset_filter_timer", RESET_FILTER_TIMER_SCHEMA,"reset_filter_timer" + ) class DukaOneFan(FanEntity): @@ -186,7 +192,11 @@ def supported_features(self) -> int: @property def device_state_attributes(self): """Return the state attributes.""" - return {"mode": self.mode} + return { + "mode": self.mode, + "filter_alarm": self._device.filter_alarm, + "filter_timer": self._device.filter_timer + } @property def speed(self): @@ -239,6 +249,11 @@ def turn_off(self, **kwargs) -> None: self.the_client.turn_off(self._device) return + def reset_filter_timer(self): + """REset the filter timer to 90 days""" + self.the_client.reset_filter_alarm(self._device) + return + @property def device_info(self): """Return device information.""" diff --git a/custom_components/dukaone/manifest.json b/custom_components/dukaone/manifest.json index aec5a06..e2d3914 100644 --- a/custom_components/dukaone/manifest.json +++ b/custom_components/dukaone/manifest.json @@ -16,6 +16,6 @@ "homekit": {}, "documentation": "https://www.dingus.dk", "requirements": [ - "dukaonesdk==0.9.7" + "dukaonesdk==0.9.8" ] } diff --git a/custom_components/dukaone/services.yaml b/custom_components/dukaone/services.yaml index d07d7f0..3856c4c 100644 --- a/custom_components/dukaone/services.yaml +++ b/custom_components/dukaone/services.yaml @@ -2,8 +2,14 @@ set_mode: description: Sets duka fan mode. fields: entity_id: - description: Name(s) of the entities to set + description: Name of the entity to set example: "fan.dukeone" mode: description: Mode in,out,inout - example: "inout" \ No newline at end of file + example: "inout" +reset_filter_timer: + description: Reset the filter timer to 90 days + fields: + entity_id: + description: Name of the entity to reset + example: "fan.dukeone"