From 86658f310d0c6579c706bce1013e08a42d507609 Mon Sep 17 00:00:00 2001 From: rafale77 Date: Thu, 9 Aug 2018 21:59:23 +0800 Subject: [PATCH] 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 --- homeassistant/components/switch/amcrest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/switch/amcrest.py b/homeassistant/components/switch/amcrest.py index 0b93bc98b10..cfe33562f9f 100644 --- a/homeassistant/components/switch/amcrest.py +++ b/homeassistant/components/switch/amcrest.py @@ -30,7 +30,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): all_switches = [] for setting in switches: - all_switches.append(AmcrestSwitch(setting, camera)) + all_switches.append(AmcrestSwitch(setting, camera, name)) 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): """Representation of an Amcrest IP camera switch.""" - def __init__(self, setting, camera): + def __init__(self, setting, camera, name): """Initialize the Amcrest switch.""" self._setting = setting self._camera = camera - self._name = SWITCHES[setting][0] + self._name = '{} {}'.format(SWITCHES[setting][0], name) self._icon = SWITCHES[setting][1] self._state = None