Bump aioambient to 1.1.0 (#33414)

This commit is contained in:
Aaron Bach 2020-03-29 16:28:37 -06:00 committed by GitHub
parent ef61118d49
commit fe0db80fb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 23 deletions

View file

@ -41,7 +41,6 @@ _LOGGER = logging.getLogger(__name__)
DATA_CONFIG = "config"
DEFAULT_SOCKET_MIN_RETRY = 15
DEFAULT_WATCHDOG_SECONDS = 5 * 60
TYPE_24HOURRAININ = "24hourrainin"
TYPE_BAROMABSIN = "baromabsin"
@ -342,7 +341,6 @@ class AmbientStation:
self._config_entry = config_entry
self._entry_setup_complete = False
self._hass = hass
self._watchdog_listener = None
self._ws_reconnect_delay = DEFAULT_SOCKET_MIN_RETRY
self.client = client
self.stations = {}
@ -359,21 +357,9 @@ class AmbientStation:
async def ws_connect(self):
"""Register handlers and connect to the websocket."""
async def _ws_reconnect(event_time):
"""Forcibly disconnect from and reconnect to the websocket."""
_LOGGER.debug("Watchdog expired; forcing socket reconnection")
await self.client.websocket.disconnect()
await self._attempt_connect()
def on_connect():
"""Define a handler to fire when the websocket is connected."""
_LOGGER.info("Connected to websocket")
_LOGGER.debug("Watchdog starting")
if self._watchdog_listener is not None:
self._watchdog_listener()
self._watchdog_listener = async_call_later(
self._hass, DEFAULT_WATCHDOG_SECONDS, _ws_reconnect
)
def on_data(data):
"""Define a handler to fire when the data is received."""
@ -385,12 +371,6 @@ class AmbientStation:
self._hass, f"ambient_station_data_update_{mac_address}"
)
_LOGGER.debug("Resetting watchdog")
self._watchdog_listener()
self._watchdog_listener = async_call_later(
self._hass, DEFAULT_WATCHDOG_SECONDS, _ws_reconnect
)
def on_disconnect():
"""Define a handler to fire when the websocket is disconnected."""
_LOGGER.info("Disconnected from websocket")

View file

@ -3,7 +3,7 @@
"name": "Ambient Weather Station",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/ambient_station",
"requirements": ["aioambient==1.0.4"],
"requirements": ["aioambient==1.1.0"],
"dependencies": [],
"codeowners": ["@bachya"]
}

View file

@ -140,7 +140,7 @@ aio_geojson_nsw_rfs_incidents==0.3
aio_georss_gdacs==0.3
# homeassistant.components.ambient_station
aioambient==1.0.4
aioambient==1.1.0
# homeassistant.components.asuswrt
aioasuswrt==1.2.3

View file

@ -47,7 +47,7 @@ aio_geojson_nsw_rfs_incidents==0.3
aio_georss_gdacs==0.3
# homeassistant.components.ambient_station
aioambient==1.0.4
aioambient==1.1.0
# homeassistant.components.asuswrt
aioasuswrt==1.2.3