Skip to content

Commit

Permalink
Add support for Broadlink SP4L-UK (0x7587) (mjg59#561)
Browse files Browse the repository at this point in the history
* Add new SP4L-UK type

* Switch: SP4 check power and nightlight to return as boolean

Co-authored-by: Felipe Martins Diel <41558831+felipediel@users.noreply.github.com>
  • Loading branch information
joh90 and felipediel committed Apr 26, 2021
1 parent de0cebc commit f3e4edc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions broadlink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
0x756F: (sp4, "MCB1", "Broadlink"),
0x7579: (sp4, "SP4L-EU", "Broadlink"),
0x7583: (sp4, "SP mini 3", "Broadlink"),
0x7587: (sp4, "SP4L-UK", "Broadlink"),
0x7D11: (sp4, "SP mini 3", "Broadlink"),
0xA56A: (sp4, "MCB1", "Broadlink"),
0xA589: (sp4, "SP4L-UK", "Broadlink"),
Expand Down
4 changes: 2 additions & 2 deletions broadlink/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ def set_state(
def check_power(self) -> bool:
"""Return the power state of the device."""
state = self.get_state()
return state["pwr"]
return bool(state["pwr"])

def check_nightlight(self) -> bool:
"""Return the state of the night light."""
state = self.get_state()
return state["ntlight"]
return bool(state["ntlight"])

def get_state(self) -> dict:
"""Get full state of device."""
Expand Down

0 comments on commit f3e4edc

Please sign in to comment.