mcu-its-g5: decoded header as JSON on mcu-its-g5/decoded, 1 Hz per station
CI / YAML lint (push) Successful in 6s
CI / ESPHome config validation (push) Successful in 58s

Message type, station type and id, position, speed and heading from the
GeoNetworking header, so consumers don't need an ASN.1 decoder. Outside
its/<node>/#, so the EMQX bridge keeps it off OpenTrafficMap.
This commit is contained in:
randy committed 2026-11-19 00:24:44 +01:00
1 parent 3676c0bbcc
commit 547dea26e3
3 files changed
+39

No files matched your search

+12
View File
@@ -137,6 +137,18 @@ its_g5_receiver:
ESP_LOGD("its_g5", "%s from %s %.6f,%.6f %.0f km/h %.0f deg%s, rssi %.0f dBm",
its_g5_decode::port_name(i.port), its_g5_decode::station_name(i.station_type),
i.lat, i.lon, i.speed_kmh, i.heading, i.secured ? ", signed" : "", rssi);
// Decoded header for HA/maptool, 1 Hz per station (CAMs come up to 10 Hz per vehicle)
if (!its_g5_decode::due(i.addr, millis(), 1000))
return;
char json[192];
int n = snprintf(json, sizeof(json),
"{\"msg\":\"%s\",\"station\":\"%s\",\"id\":\"%016llx\",\"lat\":%.7f,\"lon\":%.7f,"
"\"speed\":%.1f,\"heading\":%.1f,\"secured\":%s,\"rssi\":%.0f}",
its_g5_decode::port_name(i.port), its_g5_decode::station_name(i.station_type),
(unsigned long long) i.addr, i.lat, i.lon, i.speed_kmh, i.heading,
i.secured ? "true" : "false", rssi);
// outside its/${node_id}/#, so the EMQX bridge keeps it off OpenTrafficMap
id(mqtt_client).publish("mcu-${device}/decoded", json, n, 0, false);
sensor:
- platform: its_g5_receiver