diff --git a/csharp/App/VrmGrabber/Controller.cs b/csharp/App/VrmGrabber/Controller.cs
index 1ae88e2dd..9e699796c 100644
--- a/csharp/App/VrmGrabber/Controller.cs
+++ b/csharp/App/VrmGrabber/Controller.cs
@@ -18,7 +18,7 @@ public record InstallationToHtmlInterface(
String EscapedName,
String Online,
String LastSeen,
- Int64 NumBatteries,
+ String NumBatteries,
String BatteryVersion,
String ServerIp = "10.2.0.1", //TODO MAKE ME DYNAMIC
String FirmwareVersion = "AF09" //Todo automatically grab newest version?
@@ -42,7 +42,27 @@ public class Controller : ControllerBase
tbody {
background-color: #e4f0f5;
}
-
+
+
+tbody tr:nth-child(odd) {
+ background-color: #ECE9E9;
+}
+
+th, td { /* cell */
+ padding: 0.75rem;
+ font-size: 0.9375rem;
+}
+
+th { /* header cell */
+ font-weight: 700;
+ text-align: left;
+ color: #272838;
+ border-bottom: 2px solid #EB9486;
+
+ position: sticky;
+ top: 0;
+ background-color: #F9F8F8;
+}
table {
border-collapse: collapse;
width: 100%;
@@ -50,16 +70,17 @@ public class Controller : ControllerBase
letter-spacing: 1px;
font-family: sans-serif;
font-size: 0.8rem;
- position: relative; top: 0; bottom: 0; left: 0; right: 0;
+ position: absolute; top: 0; bottom: 0; left: 0; right: 0;
}
- td,
- th {
+ thead th {
border: 1px solid rgb(190, 190, 190);
padding: 5px 10px;
position: sticky;
+ position: -webkit-sticky;
top: 0px;
background: white;
+ z-index: 999;
}
td {
@@ -82,6 +103,7 @@ public class Controller : ControllerBase
Serial |
#Batteries |
Firmware-Version |
+ Update |
{{#inst}}
{{> installations}}
@@ -146,7 +168,7 @@ public class Controller : ControllerBase
//We need the DeviceName of the battery (ttyUSB?)
var pathToBattery = await Db.ExecuteBufferedAsyncCommandOnIp(installationIp, "dbus-send --system --dest=com.victronenergy.system --type=method_call --print-reply /ServiceMapping/com_victronenergy_battery_1 com.victronenergy.BusItem.GetText");
- if (pathToBattery.Split('"')[1] == "Failed") return "Update failed";
+ if (pathToBattery.Split('"')[1] == "Failed" || pathToBattery.Split(' ')[0] == "Error") return "Update failed";
SendNewBatteryFirmware(installationIp);
@@ -155,7 +177,7 @@ public class Controller : ControllerBase
var batteryTtyName = pathToBattery.Split('"')[1].Split(".").Last();
var localCommand = $"/opt/innovenergy/scripts/upload-bms-firmware {batteryTtyName} {batteryId} /opt/innovenergy/bms-firmware/{FirmwareVersion}.bin";
- var remoteUpdateCommandResult = Db.ExecuteBufferedAsyncCommandOnIp(installationIp, localCommand);
+ var remoteUpdateCommandResult = await Db.ExecuteBufferedAsyncCommandOnIp(installationIp, localCommand);
// Console.WriteLine(remoteUpdateCommandResult);
}
return "Battery update is successfully initiated! You can close this page now.";
diff --git a/csharp/App/VrmGrabber/DataTypes/Installation.cs b/csharp/App/VrmGrabber/DataTypes/Installation.cs
index 86faf3d74..977ce1d59 100644
--- a/csharp/App/VrmGrabber/DataTypes/Installation.cs
+++ b/csharp/App/VrmGrabber/DataTypes/Installation.cs
@@ -6,7 +6,7 @@ namespace InnovEnergy.App.VrmGrabber.DataTypes;
public class Installation
{
- public Installation(String? argName, String? argIp, Int64 argVrm, String? argIdentifier, String? serial, String? urlEncode, String? online, String? lastSeen, String details, Int64 numberOfBatteries, String batteryFirmwareVersion)
+ public Installation(String? argName, String? argIp, Int64 argVrm, String? argIdentifier, String? serial, String? urlEncode, String? online, String? lastSeen, String details, String numberOfBatteries, String batteryFirmwareVersion)
{
Name = argName;
Ip = argIp;
@@ -35,7 +35,7 @@ public class Installation
public String? EscapedName { get; set;}
public String? Online { get; set;}
public String? LastSeen { get; set;}
- public Int64 NumberOfBatteries { get; set;}
+ public String? NumberOfBatteries { get; set;}
public String? BatteryFirmwareVersion { get; set;}
public String? Details { get; set; } //JSON
diff --git a/csharp/App/VrmGrabber/Database/Db.cs b/csharp/App/VrmGrabber/Database/Db.cs
index a02088753..9a47a977c 100644
--- a/csharp/App/VrmGrabber/Database/Db.cs
+++ b/csharp/App/VrmGrabber/Database/Db.cs
@@ -73,7 +73,7 @@ public static partial class Db
var installations = await user.GetInstallations();
// var returnDictionary = new Dictionary();
- foreach (var installation in installations)
+ foreach (var installation in installations) //Todo remove Skip
{
Console.WriteLine(installation.Name);
var details = await GetInstallationDetails(installation);
@@ -115,19 +115,20 @@ public static partial class Db
var command = $"dbus-send --system --dest={pathToBattery.Split('"')[1]} --type=method_call --print-reply /FirmwareVersion com.victronenergy.BusItem.GetText";
var returnString = await ExecuteBufferedAsyncCommandOnIp(ip, command);
- return returnString.Split('"')[1];
+ var returnStringShortened = returnString.Split('"')[1];
+ return returnStringShortened.Length > 5 ? "Unknown" : returnStringShortened;
}
- private static async Task NumberOfBatteries(String? ip, String? online)
+ private static async Task NumberOfBatteries(String? ip, String? online)
{
- if (ip is null or "Unknown" || online == "❌") return 0;
+ if (ip is null or "Unknown" || online == "❌") return "Failed";
var pathToBattery = await ExecuteBufferedAsyncCommandOnIp(ip, "dbus-send --system --dest=com.victronenergy.system --type=method_call --print-reply /ServiceMapping/com_victronenergy_battery_1 com.victronenergy.BusItem.GetText");
- if (pathToBattery.Split('"')[1].StartsWith("Error")) return 0;
+ if (pathToBattery.Split('"')[1].StartsWith("Error")) return "Failed";
var cmd = await ExecuteBufferedAsyncCommandOnIp(ip,$"dbus-send --system --dest={pathToBattery.Split('"')[1]} --type=method_call --print-reply /NbOfBatteries com.victronenergy.BusItem.GetText" );
-
- return cmd.Split('"')[1] == "Failed" ? 0 : Int64.Parse(cmd.Split('"')[1]); //No Batteries can be found
+ var cmdResult = cmd.Split('"')[1];
+ return cmdResult; //No Batteries can be found
}
@@ -258,6 +259,4 @@ public class AccToken
/*
dbus-send --system --dest=com.victronenergy.battery.ttyUSB1 --print-reply /FirmwareVersion \
org.freedesktop.DBus.Properties.Get string:com.victronenergy.battery.ttyUSB1
- *
- *
*/