Skip to content

Commit

Permalink
Filter alarm support
Browse files Browse the repository at this point in the history
  • Loading branch information
dingusdk committed Oct 5, 2020
1 parent 27e7ceb commit ef112e2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
17 changes: 16 additions & 1 deletion custom_components/dukaone/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
})



Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/dukaone/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"homekit": {},
"documentation": "https://www.dingus.dk",
"requirements": [
"dukaonesdk==0.9.7"
"dukaonesdk==0.9.8"
]
}
10 changes: 8 additions & 2 deletions custom_components/dukaone/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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"

0 comments on commit ef112e2

Please sign in to comment.