Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache control configuration and initialization #81

Merged
merged 4 commits into from
Jan 12, 2025

Conversation

Lenart12
Copy link
Contributor

@Lenart12 Lenart12 commented Jan 9, 2025

Implements #80

@wimaha
Copy link
Owner

wimaha commented Jan 12, 2025

Thank you! I think this could work. I uploaded the version including this PR to dev tag on docker. Could you test it?

@Lenart12
Copy link
Contributor Author

Lenart12 commented Jan 12, 2025

Tested dev branch (set cacheMaxAge=30 in env) together with master evcc branch

services:
  tesla-ble-http-proxy:
    image: wimaha/tesla-ble-http-proxy:dev
    environment:
      - cacheMaxAge=30 # Important to set this to anything more than 0
      - httpListenAddress=:5687
    container_name: tesla-ble-http-proxy
    volumes:
      - ~/TeslaBleHttpProxy/key:/key
      - /var/run/dbus:/var/run/dbus
    restart: always
    privileged: true
    network_mode: host
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
    ports:
      - "5687:8080"

and evcc snipet

# ...
interval: 3s
# ...
vehicles:
  - name: vehicle_1
    title: blauer e-Golf
    type: custom
    soc:
      source: http
      uri: http://etera:5687/api/1/vehicles/xxx/vehicle_data?endpoints=charge_state
      method: GET
      jq: .response.response.charge_state.battery_level
      timeout: 30s 
      # cache: 30s # <--- this is not set as it would only mess with the second layer of caching provided by evcc
    range:
      source: http
      uri: http://etera:5687/api/1/vehicles/xxx/vehicle_data?endpoints=charge_state
      method: GET
      jq: .response.response.charge_state.battery_range
      timeout: 30s 
    capacity: 44
# ...

And success, looks like caching is working :^)

image

It might be worth to consider the default value of cache max age, right now its 0 but maybe it would be good to either set it to maybe 5s; or add documentation how to run it with different settings.

@wimaha
Copy link
Owner

wimaha commented Jan 12, 2025

I will leave the cache to default 0 and updated the readme.

@wimaha
Copy link
Owner

wimaha commented Jan 12, 2025

Thank you for testing!

@wimaha wimaha merged commit 4d4c26c into wimaha:main Jan 12, 2025
2 checks passed
@wimaha wimaha mentioned this pull request Jan 12, 2025
@@ -4,7 +4,7 @@ You can optionally set environment variables to override the default behavior.

## logLevel

This is the log level. (Default: info)
This is the log level. Options: debug, info, warn, error, fatal (Default: info)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not only "debug" or ""?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, the other options are available but not implemented.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the readme. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants