Commit 134b97a
committed
feat(tibber): add Tibber Data API bridge for VW Group vehicles
Optional vehicle telemetry source via Tibber's commercial API. Mirrors
evcc PR #30487. Triggered for any config.type=id/audi*/skoda*/seat/
seatcupra when tibberClientId+Secret are set; runs parallel to runEuDataAct
and the legacy login.
Pipeline:
- lib/tibber.js: OAuth2 auth-code+PKCE client, REST helpers for /homes,
/homes/{id}/devices, /homes/{id}/devices/{id}, capability extraction
(storage.stateOfCharge, storage.targetStateOfCharge, range.remaining,
connector.status, charging.status) per evcc.
- main.js: runTibber() exchanges the user's pasted authorize code on
first start, persists the rotating refresh_token in a runtime state
(info.tibberRefreshToken) — NOT in native config, otherwise every
rotation would restart the adapter. Clears native.tibberCode after
successful exchange.
- main.js: pollTibber() runs on its own this.tibberInterval timer
(default 5 min, configurable), caches the device discovery for an
hour to avoid N+1 listHomes/listDevices calls per cycle.
- admin/index_m.html: 4 new fields + inline JS that builds the Tibber
authorize URL using a fixed PKCE challenge baked into both lib and
admin. UI updates the URL live when the user types the client_id.
Codex review applied:
- HTTP timeout 30s on every Tibber request (P1-1).
- vinFromDevice now returns null for malformed external_ids (P1-4) so
the caller falls back to the device UUID — no colon in object IDs.
- Device cache to avoid N+1 calls per poll cycle (P1-3), refreshed
hourly so newly linked vehicles are picked up.
- Comment marking the PKCE-challenge duplication between lib and admin
with a grep recipe (P2-3).
Live-verified: code exchange + refresh-token rotation + listHomes work
against a real Tibber account. listDevices returns [] for accounts that
have not yet had Tibber's backend ingest the OEM connection — known
limitation, mirrors evcc's experience.1 parent 277b7df commit 134b97a
4 files changed
Lines changed: 713 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
195 | 301 | | |
196 | 302 | | |
197 | 303 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
| |||
0 commit comments