actual temperature from wall thermostat finally decoded (was a hard part....puh)
This commit is contained in:
parent
c333ffd625
commit
f63e7885e0
@ -29,7 +29,7 @@ VendorId maxVendorId = VendorId("2cac0645-855e-44fa-837e-1cab0ae4304c");
|
||||
PluginId eq3PluginUuid = PluginId("f324c43c-9680-48d8-852a-93b2227139b9");
|
||||
|
||||
DeviceClassId cubeDeviceClassId = DeviceClassId("1e892268-8bd7-442c-a001-bd4e2e6b2949");
|
||||
StateTypeId dateTimeStateTypeId = StateTypeId("78aed123-ca8e-4e11-a823-52043c4a4370");
|
||||
StateTypeId connectionStateTypeId = StateTypeId("d0a9a369-cf8c-47c4-a12e-f2d076bf12fd");
|
||||
|
||||
DevicePluginEQ3::DevicePluginEQ3()
|
||||
{
|
||||
@ -74,11 +74,11 @@ QList<DeviceClass> DevicePluginEQ3::supportedDevices() const
|
||||
|
||||
// States
|
||||
QList<StateType> states;
|
||||
StateType dateTimeState(dateTimeStateTypeId);
|
||||
dateTimeState.setName("cube time [unixtime]");
|
||||
dateTimeState.setType(QVariant::UInt);
|
||||
dateTimeState.setDefaultValue(0);
|
||||
states.append(dateTimeState);
|
||||
StateType connected(connectionStateTypeId);
|
||||
connected.setName("connected");
|
||||
connected.setType(QVariant::Bool);
|
||||
connected.setDefaultValue(false);
|
||||
states.append(connected);
|
||||
|
||||
cubeDeviceClass.setStateTypes(states);
|
||||
|
||||
@ -171,8 +171,16 @@ void DevicePluginEQ3::cubeConnectionStatusChanged(const bool &connected)
|
||||
if (m_cubes.contains(cube)) {
|
||||
device = m_cubes.value(cube);
|
||||
device->setName("Max! Cube " + cube->serialNumber());
|
||||
device->setStateValue(connectionStateTypeId,true);
|
||||
emit deviceSetupFinished(device, DeviceManager::DeviceSetupStatusSuccess, QString());
|
||||
}
|
||||
}else{
|
||||
MaxCube *cube = static_cast<MaxCube*>(sender());
|
||||
Device *device;
|
||||
if (m_cubes.contains(cube)){
|
||||
device = m_cubes.value(cube);
|
||||
device->setStateValue(connectionStateTypeId,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,6 @@ public:
|
||||
QPair<DeviceManager::DeviceSetupStatus, QString> setupDevice(Device *device) override;
|
||||
void deviceRemoved(Device *device) override;
|
||||
|
||||
|
||||
void guhTimer() override;
|
||||
|
||||
private:
|
||||
|
||||
@ -392,8 +392,18 @@ void MaxCube::decodeDevicelistMessage(QByteArray data)
|
||||
message.setDeviceMode(statusCode.right(2).toInt(0,2));
|
||||
|
||||
message.setValvePosition((double)rawData.mid(12,2).toInt(0,16));
|
||||
message.setSetpointTemperatre((double)rawData.mid(14,2).toInt(0,16)/ 2.0);
|
||||
message.setDateTime(calculateDateTime(rawData.mid(18,4), rawData.mid(22,2)));
|
||||
|
||||
// calculate current temperature and setpoint temperature
|
||||
// 00 00 00 00
|
||||
// 10
|
||||
QByteArray tempCode = fillBin(QByteArray::number(rawData.mid(14,2).toInt(0,16),2),8);
|
||||
message.setSetpointTemperatre((double)tempCode.right(6).toInt(0,2) / 2.0);
|
||||
double currentTemperature;
|
||||
if(tempCode.left(2) == "10"){
|
||||
currentTemperature = ((double)rawData.right(2).toInt(0,16) / 10.0) + 25.6;
|
||||
}else{
|
||||
currentTemperature = (double)rawData.right(2).toInt(0,16) / 10.0;
|
||||
}
|
||||
|
||||
qDebug() << " raw data | " << rawData;
|
||||
qDebug() << " device type | " << device->deviceTypeString();
|
||||
@ -412,8 +422,10 @@ void MaxCube::decodeDevicelistMessage(QByteArray data)
|
||||
qDebug() << " gateway known | " << message.gatewayKnown();
|
||||
qDebug() << " DST settings active | " << message.dtsActive();
|
||||
qDebug() << " device mode | " << message.deviceModeString();
|
||||
qDebug() << " temp Code | " << tempCode;
|
||||
qDebug() << " Temperatur Setpoint | " << message.setpointTemperature();
|
||||
qDebug() << " Current Temp | " << currentTemperature;
|
||||
qDebug() << " unknown | " << rawData.right(rawData.length() - 12);
|
||||
qDebug() << " measured temp. 0b | " << fillBin(QByteArray::number(rawData.left(2).toInt(0,16),2),8);
|
||||
qDebug() << "-------------------------|-------------------------";
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user