From b51ac2d58882d64c63b1afc752bf65bf2737d78e Mon Sep 17 00:00:00 2001 From: Till Steinbach Date: Thu, 14 Jul 2022 18:35:13 +0200 Subject: [PATCH] force relogin after 6 hours and refactor out to use as a library inside VWsFriend --- CHANGELOG.md | 10 +++++++++- requirements.txt | 2 +- weconnect_mqtt/weconnect_mqtt_base.py | 11 ++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 173cc60..3442a29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - No unreleased changes so far +## [0.38.0] - 2022-07-14 +### Fixed +- Regular relogin to fix problem with data not showing anymore + +### Changed +- Refactoring to use WeConnect-mqtt from inside VWsFriend + ## [0.37.2] - 2022-06-28 ### Fixed - Fixed error with warning light icon @@ -619,7 +626,8 @@ Send empty message when topic is disabled ## [0.1.0] - 2021-05-27 Initial release -[unreleased]: https://github.com/tillsteinbach/WeConnect-mqtt/compare/v0.37.2...HEAD +[unreleased]: https://github.com/tillsteinbach/WeConnect-mqtt/compare/v0.38.0...HEAD +[0.37.2]: https://github.com/tillsteinbach/WeConnect-mqtt/releases/tag/v0.38.0 [0.37.2]: https://github.com/tillsteinbach/WeConnect-mqtt/releases/tag/v0.37.2 [0.37.1]: https://github.com/tillsteinbach/WeConnect-mqtt/releases/tag/v0.37.1 [0.37.0]: https://github.com/tillsteinbach/WeConnect-mqtt/releases/tag/v0.37.0 diff --git a/requirements.txt b/requirements.txt index 840b686..4b12f35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -weconnect[Images]~=0.45.0.dev2 +weconnect[Images]~=0.45.0 paho-mqtt~=1.6.1 python-dateutil~=2.8.2 \ No newline at end of file diff --git a/weconnect_mqtt/weconnect_mqtt_base.py b/weconnect_mqtt/weconnect_mqtt_base.py index ad658a1..b6ecf2f 100644 --- a/weconnect_mqtt/weconnect_mqtt_base.py +++ b/weconnect_mqtt/weconnect_mqtt_base.py @@ -268,7 +268,10 @@ def main(): # noqa: C901 # pylint: disable=too-many-branches,too-many-statemen try: while True: try: - mqttCLient.connectWeConnect(username=username, password=password, maxAgePictures=args.pictureCache) + weConnect = weconnect.WeConnect(username=username, password=password, updateAfterLogin=False, updateCapabilities=mqttCLient.updateCapabilities, + updatePictures=mqttCLient.updatePictures, maxAgePictures=args.pictureCache, selective=mqttCLient.selective, + forceReloginAfter=21600) + mqttCLient.connectWeConnect(weConnect) break except exceptions.ConnectionError as e: LOG.error('Could not connect to VW-Server: %s, will retry in 10 seconds', e) @@ -387,11 +390,9 @@ def disconnect(self, reasoncode=None, properties=None): pass super().disconnect(reasoncode, properties) - def connectWeConnect(self, username, password, maxAgePictures): + def connectWeConnect(self, weConnect): LOG.info('Connect to WeConnect') - self.weConnect = weconnect.WeConnect(username=username, password=password, updateAfterLogin=False, updateCapabilities=self.updateCapabilities, - updatePictures=self.updatePictures, maxAgePictures=maxAgePictures, selective=self.selective, - forceReloginAfter=21600) + self.weConnect = weConnect self.weConnect.enableTracker() if self.republishOnUpdate: flags = addressable.AddressableLeaf.ObserverEvent.UPDATED_FROM_SERVER | addressable.AddressableLeaf.ObserverEvent.ENABLED \