feat: align car monitor with Gen5W entities
This commit is contained in:
1 parent
41a3e90393
commit
5aac4bc208
3 files changed
+194
-588
No files matched your search
@@ -23,31 +23,44 @@ $summary = NiroTelemetrySnapshot::summarize([
|
||||
'state' => [
|
||||
'_sample_epoch' => $now - 3,
|
||||
'ignition' => 'true',
|
||||
'hev_ready' => 'true',
|
||||
'engine_running' => 'false',
|
||||
'parked' => 'false',
|
||||
'speed' => '27',
|
||||
'gear_code' => '5',
|
||||
'parking_brake' => 'false',
|
||||
'battery_soc_12v' => '93',
|
||||
'hev_battery_soc' => '61',
|
||||
'total_distance_to_empty' => '761',
|
||||
'electric_distance_to_empty' => '18',
|
||||
'gas_distance_to_empty' => '743',
|
||||
'odometer' => '259653.7',
|
||||
'driver_door' => 'false',
|
||||
'hood' => 'false',
|
||||
'discharge_alert' => 'false',
|
||||
'outside_temperature' => '25.0',
|
||||
'audio_mode' => '54',
|
||||
'hev_mode_code' => '2',
|
||||
'head_unit_power' => '0',
|
||||
'rear_temperature' => '22.0',
|
||||
],
|
||||
], ['stale_after' => 20]);
|
||||
|
||||
check($summary['available'] === true, 'snapshot is available');
|
||||
check($summary['online'] === true, 'availability topic is respected');
|
||||
check($summary['stale'] === false, 'fresh sample is not stale');
|
||||
check($summary['metric_count'] === 11, 'only mapped supported metrics are counted');
|
||||
check($summary['services'] === ['available' => 6, 'total' => 6], 'source families are counted');
|
||||
check($summary['metric_count'] === 18, 'only mapped supported metrics are counted');
|
||||
check($summary['services'] === ['available' => 4, 'total' => 4], 'source families are counted');
|
||||
check($summary['metrics']['speed']['value'] === '27', 'speed mapping');
|
||||
check($summary['metrics']['gear']['value'] === '5', 'live root gear mapping');
|
||||
check($summary['metrics']['outside_temperature']['value'] === '25.0', 'climate mapping');
|
||||
check($summary['metrics']['driver_door']['supported'] === true, 'zero is supported');
|
||||
check($summary['metrics']['distance_to_empty']['value'] === '761', 'live HEV range mapping');
|
||||
check($summary['metrics']['electric_distance_to_empty']['value'] === '18', 'electric range mapping');
|
||||
check($summary['metrics']['gas_distance_to_empty']['value'] === '743', 'engine range mapping');
|
||||
check($summary['metrics']['hev_battery_soc']['value'] === '61', 'HEV battery mapping');
|
||||
check($summary['metrics']['hev_ready']['value'] === 'true', 'HEV ready mapping');
|
||||
check($summary['metrics']['hood']['value'] === 'false', 'hood mapping');
|
||||
check($summary['metrics']['discharge_alert']['value'] === 'false', 'discharge alert mapping');
|
||||
check($summary['metrics']['rear_temperature']['value'] === '22.0', 'rear temperature mapping');
|
||||
check($summary['metrics']['odometer']['value'] === '259653.7', 'odometer is already km');
|
||||
check($summary['metrics']['route_guide']['supported'] === false, 'removed raw route value stays unsupported');
|
||||
check(!array_key_exists('state', $summary), 'raw snapshot is not exposed');
|
||||
|
||||
$stale = NiroTelemetrySnapshot::summarize([
|
||||
|
||||
Reference in new issue
Block a user