Schrack: Add firmware version state

master
Michael Zanetti 2023-03-02 17:52:14 +01:00
parent 9096691950
commit 776736b8e4
3 changed files with 18 additions and 0 deletions

View File

@ -171,6 +171,16 @@
"readSchedule": "init", "readSchedule": "init",
"description": "DIP switch states", "description": "DIP switch states",
"access": "R" "access": "R"
},
{
"id": "firmwareVersion",
"address": 832,
"size": 16,
"type": "string",
"registerType": "holdingRegister",
"readSchedule": "init",
"description": "Firmware version",
"access": "R"
} }
] ]
} }

View File

@ -111,6 +111,7 @@ void IntegrationPluginSchrack::setupThing(ThingSetupInfo *info)
qCDebug(dcSchrack) << "DIP switche states:" << cionConnection->dipSwitches(); qCDebug(dcSchrack) << "DIP switche states:" << cionConnection->dipSwitches();
m_cionConnections.insert(thing, cionConnection); m_cionConnections.insert(thing, cionConnection);
info->finish(Thing::ThingErrorNoError); info->finish(Thing::ThingErrorNoError);
info->thing()->setStateValue(cionCurrentVersionStateTypeId, cionConnection->firmwareVersion());
} else { } else {
delete cionConnection; delete cionConnection;
info->finish(Thing::ThingErrorHardwareNotAvailable); info->finish(Thing::ThingErrorHardwareNotAvailable);

View File

@ -89,6 +89,13 @@
"displayNameEvent": "Charging started or stopped", "displayNameEvent": "Charging started or stopped",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false
},
{
"id": "33780b19-4855-4b5c-bd84-cec8400309be",
"name": "currentVersion",
"displayName": "Firmware version",
"type": "QString",
"defaultValue": ""
} }
] ]
} }