Skip to content

Commit

Permalink
allow to set caching time for pictures seperately
Browse files Browse the repository at this point in the history
  • Loading branch information
tillsteinbach committed Aug 15, 2021
1 parent 94adaef commit cd093c2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 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.14.0] - 2021-08-15
### Added
- Possibility to set caching time for picture downloads seperately

### Changed
- Longer caching (24h default) for picture downloads

## [0.13.2] - 2021-08-14
### Fixed
- Bug when downloading pictures fails
Expand Down Expand Up @@ -177,7 +184,8 @@ All notable changes to this project will be documented in this file.
## [0.1.0] - 2021-05-26
Initial release

[unreleased]: https://github.com/tillsteinbach/WeConnect-cli/compare/v0.13.2..HEAD
[unreleased]: https://github.com/tillsteinbach/WeConnect-cli/compare/v0.14.0..HEAD
[0.14.0]: https://github.com/tillsteinbach/WeConnect-cli/releases/tag/v0.14.0
[0.13.2]: https://github.com/tillsteinbach/WeConnect-cli/releases/tag/v0.13.2
[0.13.1]: https://github.com/tillsteinbach/WeConnect-cli/releases/tag/v0.13.1
[0.13.0]: https://github.com/tillsteinbach/WeConnect-cli/releases/tag/v0.13.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
weconnect==0.18.3
weconnect==0.19.0
ascii_magic>=1.5.5
7 changes: 5 additions & 2 deletions weconnect_cli/weconnect_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def main(): # noqa: C901 # pylint: disable=too-many-statements,too-many-branche
default=defaultCacheTemp)
parser.add_argument('-i', '--interval', help='Query interval in seconds, used for cache and events',
type=NumberRangeArgument(1), required=False, default=300)
parser.add_argument('--picture-cache-interval', dest='pictureCache', help='Picture download interval in seconds, this does not influence the interval in'
' which the status picture is updated', type=NumberRangeArgument(1), required=False, default=86400)
parser.add_argument('-l', '--chargingLocation', nargs=2, metavar=('latitude', 'longitude'), type=float,
help='If set charging locations will be added to the result around the given coordinates')
parser.add_argument('--chargingLocationRadius', type=NumberRangeArgument(0, 100000),
Expand Down Expand Up @@ -151,7 +153,7 @@ def main(): # noqa: C901 # pylint: disable=too-many-statements,too-many-branche
if args.noCache or not os.path.isfile(args.cachefile):
weConnect.login()
else:
weConnect.fillCacheFromJson(args.cachefile, maxAge=args.interval)
weConnect.fillCacheFromJson(args.cachefile, maxAge=args.interval, maxAgePictures=args.pictureCache)

if args.chargingLocation is not None:
latitude, longitude = args.chargingLocation
Expand All @@ -169,7 +171,8 @@ def main(): # noqa: C901 # pylint: disable=too-many-statements,too-many-branche
try:
weConnect.update(updateCapabilities=(not args.noCapabilities), updatePictures=(not args.noPictures))
# disable caching
weConnect.clearCache(maxAge=None)
weConnect.maxAge = None
weConnect.clearCache()
WeConnectShell(weConnect, noCapabilities=args.noCapabilities, noPictures=args.noPictures).cmdloop()
except KeyboardInterrupt:
pass
Expand Down

0 comments on commit cd093c2

Please sign in to comment.