From bea7aae8cd87aaef58359383d8c0ac0c34ef6abd Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Mon, 3 Feb 2020 12:23:51 -0700 Subject: [PATCH] Fix issues with Ambient PWS dispatcher topic (#31439) * Correct over-broad Ambient PWS data updates * Make sure we provide a callable * Don't use a partial --- homeassistant/components/ambient_station/__init__.py | 4 ++-- homeassistant/components/ambient_station/const.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/ambient_station/__init__.py b/homeassistant/components/ambient_station/__init__.py index c61e15dfeb5..0bbb7a760fe 100644 --- a/homeassistant/components/ambient_station/__init__.py +++ b/homeassistant/components/ambient_station/__init__.py @@ -378,7 +378,7 @@ class AmbientStation: if data != self.stations[mac_address][ATTR_LAST_DATA]: _LOGGER.debug("New data received: %s", data) self.stations[mac_address][ATTR_LAST_DATA] = data - async_dispatcher_send(self._hass, TOPIC_UPDATE) + async_dispatcher_send(self._hass, TOPIC_UPDATE.format(mac_address)) _LOGGER.debug("Resetting watchdog") self._watchdog_listener() @@ -518,7 +518,7 @@ class AmbientWeatherEntity(Entity): self.async_schedule_update_ha_state(True) self._async_unsub_dispatcher_connect = async_dispatcher_connect( - self.hass, TOPIC_UPDATE, update + self.hass, TOPIC_UPDATE.format(self._mac_address), update ) async def async_will_remove_from_hass(self): diff --git a/homeassistant/components/ambient_station/const.py b/homeassistant/components/ambient_station/const.py index 21a6e514b30..4f94e1cfe88 100644 --- a/homeassistant/components/ambient_station/const.py +++ b/homeassistant/components/ambient_station/const.py @@ -8,7 +8,7 @@ CONF_APP_KEY = "app_key" DATA_CLIENT = "data_client" -TOPIC_UPDATE = "update" +TOPIC_UPDATE = "ambient_station_data_update_{0}" TYPE_BINARY_SENSOR = "binary_sensor" TYPE_SENSOR = "sensor"