Update clients, docs, and install for CarConnectivity migration
- gui_client: update _TRACE_LABELS paths to new flat snapshot structure - README: update library name, pip command, domain list, credentials template, output example, and module reference - install.sh: update credentials template and systemd service description - client.py: update docstring - data_model: Kelvin→Celsius conversion for battery temps (CarConnectivity returns Kelvin); round range_estimated_full to 1 decimal - jay_diff: fix merge when old value is not a dict; skip empty-dict branches in delete Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# we_monitor
|
||||
|
||||
Periodically polls a VW WeConnect vehicle via the `weconnect` library, stores
|
||||
Periodically polls a VW vehicle via the `carconnectivity` library, stores
|
||||
timestamped records as JSON, and pushes live data to connected TCP clients.
|
||||
A PyQt5 GUI client visualises the data in real time.
|
||||
|
||||
@@ -14,7 +14,7 @@ server/
|
||||
data_model.py — domain extractors, collect_snapshot()
|
||||
network.py — TCP push server (accept loop + broadcast)
|
||||
storage_helpers.py — load / save JSON store, midnight rotation helpers
|
||||
we_connect.py — WeConnect login and vehicle selection
|
||||
we_connect.py — CarConnectivity login and vehicle selection
|
||||
log_config.py — logging setup
|
||||
utils/
|
||||
jay_diff.py — JSON diff / merge library
|
||||
@@ -25,7 +25,7 @@ requirements.txt
|
||||
## Requirements
|
||||
|
||||
```
|
||||
pip install weconnect PyQt5 pyqtgraph
|
||||
pip install carconnectivity carconnectivity-connector-volkswagen PyQt5 pyqtgraph
|
||||
```
|
||||
|
||||
Or use the installer which also sets up a systemd user service:
|
||||
@@ -38,7 +38,7 @@ Or use the installer which also sets up a systemd user service:
|
||||
|
||||
## Collector (`collect.py`)
|
||||
|
||||
Connects to WeConnect, polls selected domains at a configurable interval, and
|
||||
Connects via CarConnectivity, polls selected domains at a configurable interval, and
|
||||
appends timestamped records to a rotating JSON log. Simultaneously runs a TCP
|
||||
push server so clients receive every new snapshot the moment it is collected.
|
||||
|
||||
@@ -68,7 +68,7 @@ All connection and collection settings live in a single JSON file:
|
||||
"password": "secret"
|
||||
},
|
||||
"vin": "WVWZZZE1ZMP000000",
|
||||
"domains": ["charging", "measurements", "readiness"],
|
||||
"domains": ["charging", "electric_drive", "connectivity"],
|
||||
"interval_s": 300,
|
||||
"host": "0.0.0.0",
|
||||
"port": 9999,
|
||||
@@ -79,10 +79,10 @@ All connection and collection settings live in a single JSON file:
|
||||
|
||||
| Key | Default | Description |
|
||||
|-----|---------|-------------|
|
||||
| `credentials.username` | — | WeConnect / MyVolkswagen email |
|
||||
| `credentials.password` | — | WeConnect password |
|
||||
| `credentials.username` | — | MyVolkswagen email |
|
||||
| `credentials.password` | — | MyVolkswagen password |
|
||||
| `vin` | first vehicle | Target VIN |
|
||||
| `domains` | `["charging","measurements","readiness"]` | Domains to collect (list or `"all"`) |
|
||||
| `domains` | `["charging","electric_drive","connectivity"]` | Domains to collect (list or `"all"`) |
|
||||
| `interval_s` | `300` | Collection interval in seconds |
|
||||
| `host` | `"0.0.0.0"` | Push server bind address |
|
||||
| `port` | `9999` | Push server TCP port |
|
||||
@@ -104,12 +104,12 @@ CLI flags override the corresponding credentials-file value when given.
|
||||
| `--log-dir DIR` | `log_dir` | Directory for rotating log files |
|
||||
| `--max-records N` | — | Keep only the last N records per file (default: unlimited) |
|
||||
| `--diff` | `diff` | Enable diff-mode on the push server |
|
||||
| `--dry` | — | Skip WeConnect login; run push server only (useful for GUI testing) |
|
||||
| `--dry` | — | Skip CarConnectivity login; run push server only (useful for GUI testing) |
|
||||
| `-v` | — | Verbose / debug logging |
|
||||
| `--list-domains` | — | Print available domains and exit |
|
||||
|
||||
**Available domains:** `charging`, `climatisation`, `measurements`,
|
||||
`readiness`, `parking`, `access`
|
||||
**Available domains:** `charging`, `climatisation`, `electric_drive`,
|
||||
`connectivity`, `vehicle`, `position`, `doors`
|
||||
|
||||
### Log rotation
|
||||
|
||||
@@ -129,10 +129,12 @@ Log files are named `YYYY_MM_DD_HH_MM_SS_<VIN>.json` and contain:
|
||||
{
|
||||
"ts": "2025-05-25T10:00:00+00:00",
|
||||
"charging": {
|
||||
"batteryStatus": {
|
||||
"currentSOC": { "value": 80, "unit": "%" },
|
||||
"cruisingRangeElectric": { "value": 310, "unit": "km" }
|
||||
}
|
||||
"state": "readyForCharging",
|
||||
"power": { "value": 11.0, "unit": "kW" }
|
||||
},
|
||||
"electric_drive": {
|
||||
"range": { "value": 310, "unit": "km" },
|
||||
"battery": { "soc": { "value": 80, "unit": "%" } }
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -259,14 +261,14 @@ pretty-printed JSON with a running record counter.
|
||||
### `collect.py`
|
||||
|
||||
Entry point for the collector daemon. Parses CLI / credentials-file arguments,
|
||||
establishes the WeConnect session, starts the push server, and runs the main
|
||||
establishes the CarConnectivity session, starts the push server, and runs the main
|
||||
poll loop.
|
||||
|
||||
### `server/data_model.py`
|
||||
|
||||
`collect_snapshot(vehicle, domains) → dict`
|
||||
Iterates over the requested domains on a `weconnect.Vehicle` and extracts every
|
||||
`Status` attribute into a flat-ish dict keyed by domain and status-object name.
|
||||
Iterates over the requested domains on a CarConnectivity vehicle object and extracts
|
||||
fields into a flat dict keyed by domain.
|
||||
Physical values are normalised to `{"value": …, "unit": …}`. Returns a record
|
||||
with a top-level `"ts"` ISO-8601 timestamp.
|
||||
|
||||
@@ -307,8 +309,8 @@ the last 24 hours, and returns them sorted by timestamp.
|
||||
|
||||
### `server/we_connect.py`
|
||||
|
||||
`connect(username, password) → WeConnect`
|
||||
Authenticates and returns a connected `WeConnect` instance.
|
||||
`connect(username, password) → CarConnectivity`
|
||||
Authenticates and returns a connected `CarConnectivity` instance.
|
||||
|
||||
`select_vehicle(wc, vin) → (vehicle, error)`
|
||||
Returns the target vehicle (first available if `vin` is empty) or an error string.
|
||||
|
||||
Reference in New Issue
Block a user