mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix for multiple camera switches naming of entity (#14028)
* Fix for multiple camera switches naming of entity appended camera name to the switch entity name. * Update amcrest.py * Update amcrest.py * Update amcrest.py * Update amcrest.py * Update amcrest.py * Update amcrest.py * Update amcrest.py * Update amcrest.py * Update amcrest.py * Update amcrest.py * Update amcrest.py * Add digest authentification * Update rest_command.py * Update config.py * Update rest_command.py * Update config.py
This commit is contained in:
parent
a29f867908
commit
86658f310d
@ -30,7 +30,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
all_switches = []
|
all_switches = []
|
||||||
|
|
||||||
for setting in switches:
|
for setting in switches:
|
||||||
all_switches.append(AmcrestSwitch(setting, camera))
|
all_switches.append(AmcrestSwitch(setting, camera, name))
|
||||||
|
|
||||||
async_add_devices(all_switches, True)
|
async_add_devices(all_switches, True)
|
||||||
|
|
||||||
@ -38,11 +38,11 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
class AmcrestSwitch(ToggleEntity):
|
class AmcrestSwitch(ToggleEntity):
|
||||||
"""Representation of an Amcrest IP camera switch."""
|
"""Representation of an Amcrest IP camera switch."""
|
||||||
|
|
||||||
def __init__(self, setting, camera):
|
def __init__(self, setting, camera, name):
|
||||||
"""Initialize the Amcrest switch."""
|
"""Initialize the Amcrest switch."""
|
||||||
self._setting = setting
|
self._setting = setting
|
||||||
self._camera = camera
|
self._camera = camera
|
||||||
self._name = SWITCHES[setting][0]
|
self._name = '{} {}'.format(SWITCHES[setting][0], name)
|
||||||
self._icon = SWITCHES[setting][1]
|
self._icon = SWITCHES[setting][1]
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user