mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
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
This commit is contained in:
parent
c1ca13d613
commit
b9fd4919b3
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user