From b9fd4919b3f48c3e63fd88d1177d86e55aceb0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chema=20Garc=C3=ADa?= Date: Tue, 19 Apr 2016 17:19:27 +0200 Subject: [PATCH] Set name to hyperion assets (#1822) * set name to hyperion assets by specifying the name in the configuration: light kodi_xxx: name: "Kodi XXX" platform: hyperion host: 192.168.1.222 port: 19444 * Update hyperion.py fix extra space --- homeassistant/components/light/hyperion.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/light/hyperion.py b/homeassistant/components/light/hyperion.py index 93e6e490e80..cfbe11a07bd 100644 --- a/homeassistant/components/light/hyperion.py +++ b/homeassistant/components/light/hyperion.py @@ -19,7 +19,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): """Setup a Hyperion server remote.""" host = config.get(CONF_HOST, None) port = config.get("port", 19444) - device = Hyperion(host, port) + device = Hyperion(config.get('name', host), host, port) if device.setup(): add_devices_callback([device]) return True @@ -30,11 +30,11 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): class Hyperion(Light): """Representation of a Hyperion remote.""" - def __init__(self, host, port): + def __init__(self, name, host, port): """Initialize the light.""" self._host = host self._port = port - self._name = host + self._name = name self._is_available = True self._rgb_color = [255, 255, 255] @@ -75,7 +75,8 @@ class Hyperion(Light): """Get the hostname of the remote.""" response = self.json_request({"command": "serverinfo"}) if response: - self._name = response["info"]["hostname"] + if self._name == self._host: + self._name = response["info"]["hostname"] return True return False