Fix storage state and add endianness param to generic connection
parent
8a3dfb57e3
commit
751fdb33a0
|
|
@ -508,7 +508,12 @@ void IntegrationPluginSunSpec::setupConnection(ThingSetupInfo *info)
|
||||||
// of little endian as specified in sunspec and even solar edge documentation
|
// of little endian as specified in sunspec and even solar edge documentation
|
||||||
connection = new SunSpecConnection(address, port, slaveId, SunSpecDataPoint::ByteOrderBigEndian, this);
|
connection = new SunSpecConnection(address, port, slaveId, SunSpecDataPoint::ByteOrderBigEndian, this);
|
||||||
} else {
|
} else {
|
||||||
connection = new SunSpecConnection(address, port, slaveId, this);
|
SunSpecDataPoint::ByteOrder endianness = SunSpecDataPoint::ByteOrderLittleEndian;
|
||||||
|
QString endiannessParam = thing->paramValue("endianness").toString();
|
||||||
|
if (endiannessParam == "Big Endian")
|
||||||
|
endianness = SunSpecDataPoint::ByteOrderBigEndian;
|
||||||
|
|
||||||
|
connection = new SunSpecConnection(address, port, slaveId, endianness, this);
|
||||||
}
|
}
|
||||||
connection->setTimeout(configValue(sunSpecPluginTimeoutParamTypeId).toUInt());
|
connection->setTimeout(configValue(sunSpecPluginTimeoutParamTypeId).toUInt());
|
||||||
connection->setNumberOfRetries(configValue(sunSpecPluginNumberOfRetriesParamTypeId).toUInt());
|
connection->setNumberOfRetries(configValue(sunSpecPluginNumberOfRetriesParamTypeId).toUInt());
|
||||||
|
|
@ -1347,31 +1352,31 @@ void IntegrationPluginSunSpec::onStorageBlockUpdated()
|
||||||
|
|
||||||
switch (storage->chaSt()) {
|
switch (storage->chaSt()) {
|
||||||
case SunSpecStorageModel::ChastOff:
|
case SunSpecStorageModel::ChastOff:
|
||||||
thing->setStateValue(sunspecStorageBatteryLevelStateTypeId, "Off");
|
thing->setStateValue(sunspecStorageStorageStatusStateTypeId, "Off");
|
||||||
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
||||||
break;
|
break;
|
||||||
case SunSpecStorageModel::ChastEmpty:
|
case SunSpecStorageModel::ChastEmpty:
|
||||||
thing->setStateValue(sunspecStorageBatteryLevelStateTypeId, "Empty");
|
thing->setStateValue(sunspecStorageStorageStatusStateTypeId, "Empty");
|
||||||
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
||||||
break;
|
break;
|
||||||
case SunSpecStorageModel::ChastDischarging:
|
case SunSpecStorageModel::ChastDischarging:
|
||||||
thing->setStateValue(sunspecStorageBatteryLevelStateTypeId, "Discharging");
|
thing->setStateValue(sunspecStorageStorageStatusStateTypeId, "Discharging");
|
||||||
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "discharging");
|
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "discharging");
|
||||||
break;
|
break;
|
||||||
case SunSpecStorageModel::ChastCharging:
|
case SunSpecStorageModel::ChastCharging:
|
||||||
thing->setStateValue(sunspecStorageBatteryLevelStateTypeId, "Charging");
|
thing->setStateValue(sunspecStorageStorageStatusStateTypeId, "Charging");
|
||||||
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "charging");
|
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "charging");
|
||||||
break;
|
break;
|
||||||
case SunSpecStorageModel::ChastFull:
|
case SunSpecStorageModel::ChastFull:
|
||||||
thing->setStateValue(sunspecStorageBatteryLevelStateTypeId, "Full");
|
thing->setStateValue(sunspecStorageStorageStatusStateTypeId, "Full");
|
||||||
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
||||||
break;
|
break;
|
||||||
case SunSpecStorageModel::ChastHolding:
|
case SunSpecStorageModel::ChastHolding:
|
||||||
thing->setStateValue(sunspecStorageBatteryLevelStateTypeId, "Holding");
|
thing->setStateValue(sunspecStorageStorageStatusStateTypeId, "Holding");
|
||||||
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
||||||
break;
|
break;
|
||||||
case SunSpecStorageModel::ChastTesting:
|
case SunSpecStorageModel::ChastTesting:
|
||||||
thing->setStateValue(sunspecStorageBatteryLevelStateTypeId, "Testing");
|
thing->setStateValue(sunspecStorageStorageStatusStateTypeId, "Testing");
|
||||||
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
thing->setStateValue(sunspecStorageChargingStateStateTypeId, "idle");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,17 @@
|
||||||
"displayName": "Slave ID",
|
"displayName": "Slave ID",
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"defaultValue": 1
|
"defaultValue": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "38082ecf-23bf-47d1-beba-f816c978c823",
|
||||||
|
"name":"endianness",
|
||||||
|
"displayName": "Endianness",
|
||||||
|
"type": "QString",
|
||||||
|
"allowedValues": [
|
||||||
|
"Big Endian",
|
||||||
|
"Little Endian"
|
||||||
|
],
|
||||||
|
"defaultValue": "Big Endian"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateTypes":[
|
"stateTypes":[
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue