Make devices and activities visible as harmony attributes (#37559)

* Make devices and activities visibile as harmony attributes

* Allow restoring previous activity, add tests

* fix test

* Kill activity_notify with fire

* remove trailing ,
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-07-07 09:02:22 -05:00
1 parent ae7d464878
commit 76be95d7e0
8 files changed
+140 -54

No files matched your search

+2 -9
View File
@@ -13,7 +13,7 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.dispatcher import async_dispatcher_send
from .const import ATTR_ACTIVITY_NOTIFY, DOMAIN, HARMONY_OPTIONS_UPDATE, PLATFORMS
from .const import DOMAIN, HARMONY_OPTIONS_UPDATE, PLATFORMS
from .remote import HarmonyRemote
_LOGGER = logging.getLogger(__name__)
@@ -38,18 +38,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
name = entry.data[CONF_NAME]
activity = entry.options.get(ATTR_ACTIVITY)
delay_secs = entry.options.get(ATTR_DELAY_SECS, DEFAULT_DELAY_SECS)
activity_notify = entry.options.get(ATTR_ACTIVITY_NOTIFY, False)
harmony_conf_file = hass.config.path(f"harmony_{entry.unique_id}.conf")
try:
device = HarmonyRemote(
name,
entry.unique_id,
address,
activity,
harmony_conf_file,
delay_secs,
activity_notify,
name, entry.unique_id, address, activity, harmony_conf_file, delay_secs
)
connected_ok = await device.connect()
except (asyncio.TimeoutError, ValueError, AttributeError):