1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-22 07:00:12 +01:00

Add support for Broadlink SP4L-UK (0x7587) (#561)

* 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>
This commit is contained in:
Johnson Chin 2021-03-24 22:46:39 +08:00 committed by Felipe Martins Diel
parent de0cebc00f
commit f3e4edcad4
2 changed files with 3 additions and 2 deletions

View File

@ -44,6 +44,7 @@ SUPPORTED_TYPES = {
0x756F: (sp4, "MCB1", "Broadlink"), 0x756F: (sp4, "MCB1", "Broadlink"),
0x7579: (sp4, "SP4L-EU", "Broadlink"), 0x7579: (sp4, "SP4L-EU", "Broadlink"),
0x7583: (sp4, "SP mini 3", "Broadlink"), 0x7583: (sp4, "SP mini 3", "Broadlink"),
0x7587: (sp4, "SP4L-UK", "Broadlink"),
0x7D11: (sp4, "SP mini 3", "Broadlink"), 0x7D11: (sp4, "SP mini 3", "Broadlink"),
0xA56A: (sp4, "MCB1", "Broadlink"), 0xA56A: (sp4, "MCB1", "Broadlink"),
0xA589: (sp4, "SP4L-UK", "Broadlink"), 0xA589: (sp4, "SP4L-UK", "Broadlink"),

View File

@ -298,12 +298,12 @@ class sp4(device):
def check_power(self) -> bool: def check_power(self) -> bool:
"""Return the power state of the device.""" """Return the power state of the device."""
state = self.get_state() state = self.get_state()
return state["pwr"] return bool(state["pwr"])
def check_nightlight(self) -> bool: def check_nightlight(self) -> bool:
"""Return the state of the night light.""" """Return the state of the night light."""
state = self.get_state() state = self.get_state()
return state["ntlight"] return bool(state["ntlight"])
def get_state(self) -> dict: def get_state(self) -> dict:
"""Get full state of device.""" """Get full state of device."""