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
pull/31376/head
Aaron Bach 2020-02-03 12:23:51 -07:00 committed by GitHub
parent 30e803d70b
commit bea7aae8cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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):

View File

@ -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"