mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix call to parent broadlink switch (#13906)
* Broadlink switch, fixes issue #13799 * slugify
This commit is contained in:
parent
e472436b84
commit
08f545d67b
@ -19,7 +19,7 @@ from homeassistant.const import (
|
||||
CONF_COMMAND_OFF, CONF_COMMAND_ON, CONF_FRIENDLY_NAME, CONF_HOST, CONF_MAC,
|
||||
CONF_SWITCHES, CONF_TIMEOUT, CONF_TYPE)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util import Throttle
|
||||
from homeassistant.util import Throttle, slugify
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
REQUIREMENTS = ['broadlink==0.8.0']
|
||||
@ -187,7 +187,7 @@ class BroadlinkRMSwitch(SwitchDevice):
|
||||
|
||||
def __init__(self, name, friendly_name, device, command_on, command_off):
|
||||
"""Initialize the switch."""
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(name)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(slugify(name))
|
||||
self._name = friendly_name
|
||||
self._state = False
|
||||
self._command_on = b64decode(command_on) if command_on else None
|
||||
@ -257,7 +257,7 @@ class BroadlinkSP1Switch(BroadlinkRMSwitch):
|
||||
|
||||
def __init__(self, friendly_name, device):
|
||||
"""Initialize the switch."""
|
||||
super().__init__(friendly_name, device, None, None)
|
||||
super().__init__(friendly_name, friendly_name, device, None, None)
|
||||
self._command_on = 1
|
||||
self._command_off = 0
|
||||
|
||||
@ -313,7 +313,7 @@ class BroadlinkMP1Slot(BroadlinkRMSwitch):
|
||||
|
||||
def __init__(self, friendly_name, device, slot, parent_device):
|
||||
"""Initialize the slot of switch."""
|
||||
super().__init__(friendly_name, device, None, None)
|
||||
super().__init__(friendly_name, friendly_name, device, None, None)
|
||||
self._command_on = 1
|
||||
self._command_off = 0
|
||||
self._slot = slot
|
||||
|
Loading…
x
Reference in New Issue
Block a user