Skip to content

Commit

Permalink
force relogin after 6 hours and refactor out to use as a library insi…
Browse files Browse the repository at this point in the history
…de VWsFriend
  • Loading branch information
tillsteinbach committed Jul 14, 2022
1 parent be21f29 commit b51ac2d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
11 changes: 6 additions & 5 deletions weconnect_mqtt/weconnect_mqtt_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit b51ac2d

Please sign in to comment.