Make harmony handle IP address changes (#33173)

If the IP address of the harmony hub changed it would
not be rediscovered.  We now connect to get the
unique id and then update config entries with
the correct ip if it is already setup.
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-03-22 21:24:49 -07:00
1 parent 087b672449
commit 0b2a8bf79a
4 files changed
+70 -41

No files matched your search

+3 -3
View File
@@ -34,7 +34,6 @@ from .const import (
SERVICE_CHANGE_CHANNEL,
SERVICE_SYNC,
)
from .util import find_unique_id_for_remote
_LOGGER = logging.getLogger(__name__)
@@ -130,7 +129,7 @@ def register_services(hass):
class HarmonyRemote(remote.RemoteDevice):
"""Remote representation used to control a Harmony device."""
def __init__(self, name, host, activity, out_path, delay_secs):
def __init__(self, name, unique_id, host, activity, out_path, delay_secs):
"""Initialize HarmonyRemote class."""
self._name = name
self.host = host
@@ -141,6 +140,7 @@ class HarmonyRemote(remote.RemoteDevice):
self._config_path = out_path
self.delay_secs = delay_secs
self._available = False
self._unique_id = unique_id
self._undo_dispatch_subscription = None
@property
@@ -217,7 +217,7 @@ class HarmonyRemote(remote.RemoteDevice):
@property
def unique_id(self):
"""Return the unique id."""
return find_unique_id_for_remote(self._client)
return self._unique_id
@property
def name(self):