@@ -62,6 +62,12 @@ bool BatteryStats::updateAvailable(uint32_t since) const
62
62
void BatteryStats::getLiveViewData (JsonVariant& root) const
63
63
{
64
64
root[" manufacturer" ] = _manufacturer;
65
+ if (!_fwversion.isEmpty ()) {
66
+ root[" fwversion" ] = _fwversion;
67
+ }
68
+ if (!_hwversion.isEmpty ()) {
69
+ root[" hwversion" ] = _hwversion;
70
+ }
65
71
root[" data_age" ] = getAgeSeconds ();
66
72
67
73
addLiveViewValue (root, " SoC" , _soc, " %" , _socPrecision);
@@ -375,20 +381,38 @@ void JkBmsBatteryStats::updateFrom(JkBms::DataPointContainer const& dp)
375
381
_cellVoltageTimestamp = millis ();
376
382
}
377
383
384
+ auto oVersion = _dataPoints.get <Label::BmsSoftwareVersion>();
385
+ if (oVersion.has_value ()) {
386
+ // raw: "11.XW_S11.262H_"
387
+ // => Hardware "V11.XW" (displayed in Android app)
388
+ // => Software "V11.262H" (displayed in Android app)
389
+ auto first = oVersion->find (' _' );
390
+ if (first != std::string::npos) {
391
+ _hwversion = oVersion->substr (0 , first).c_str ();
392
+
393
+ auto second = oVersion->find (' _' , first + 1 );
394
+
395
+ // the 'S' seems to be merely an indicator for "software"?
396
+ if (oVersion->at (first + 1 ) == ' S' ) { first++; }
397
+
398
+ _fwversion = oVersion->substr (first + 1 , second - first - 1 ).c_str ();
399
+ }
400
+ }
401
+
378
402
_lastUpdate = millis ();
379
403
}
380
404
381
405
void VictronSmartShuntStats::updateFrom (VeDirectShuntController::data_t const & shuntData) {
382
406
BatteryStats::setVoltage (shuntData.batteryVoltage_V_mV / 1000.0 , millis ());
383
407
BatteryStats::setSoC (static_cast <float >(shuntData.SOC ) / 10 , 1 /* precision*/ , millis ());
408
+ _fwversion = shuntData.getFwVersionFormatted ();
384
409
385
410
_current = static_cast <float >(shuntData.batteryCurrent_I_mA ) / 1000 ;
386
- _modelName = shuntData.getPidAsString ().data ();
387
411
_chargeCycles = shuntData.H4 ;
388
412
_timeToGo = shuntData.TTG / 60 ;
389
413
_chargedEnergy = static_cast <float >(shuntData.H18 ) / 100 ;
390
414
_dischargedEnergy = static_cast <float >(shuntData.H17 ) / 100 ;
391
- _manufacturer = " Victron " + _modelName ;
415
+ _manufacturer = String ( " Victron " ) + shuntData. getPidAsString (). data () ;
392
416
_temperature = shuntData.T ;
393
417
_tempPresent = shuntData.tempPresent ;
394
418
_midpointVoltage = static_cast <float >(shuntData.VM ) / 1000 ;
0 commit comments