Add MainPowerOutlet to power socket generic class

This commit is contained in:
Simon Stürz 2020-12-29 23:15:41 +01:00
parent cdff51655f
commit 99c10bb191

View File

@ -95,7 +95,9 @@ bool IntegrationPluginZigbeeGeneric::handleNode(ZigbeeNode *node, const QUuid &n
if ((endpoint->profile() == Zigbee::ZigbeeProfile::ZigbeeProfileLightLink && if ((endpoint->profile() == Zigbee::ZigbeeProfile::ZigbeeProfileLightLink &&
endpoint->deviceId() == Zigbee::LightLinkDevice::LightLinkDeviceOnOffPlugin) || endpoint->deviceId() == Zigbee::LightLinkDevice::LightLinkDeviceOnOffPlugin) ||
(endpoint->profile() == Zigbee::ZigbeeProfile::ZigbeeProfileHomeAutomation && (endpoint->profile() == Zigbee::ZigbeeProfile::ZigbeeProfileHomeAutomation &&
endpoint->deviceId() == Zigbee::HomeAutomationDeviceOnOffPlugin)) { endpoint->deviceId() == Zigbee::HomeAutomationDeviceOnOffPlugin) ||
(endpoint->profile() == Zigbee::ZigbeeProfile::ZigbeeProfileHomeAutomation &&
endpoint->deviceId() == Zigbee::HomeAutomationDeviceMainPowerOutlet)) {
qCDebug(dcZigbeeGeneric()) << "Handeling power socket endpoint for" << node << endpoint; qCDebug(dcZigbeeGeneric()) << "Handeling power socket endpoint for" << node << endpoint;
createThing(powerSocketThingClassId, networkUuid, node, endpoint); createThing(powerSocketThingClassId, networkUuid, node, endpoint);
@ -187,7 +189,7 @@ void IntegrationPluginZigbeeGeneric::setupThing(ThingSetupInfo *info)
qCWarning(dcZigbeeGeneric()) << "Failed to read thermostat cluster"; qCWarning(dcZigbeeGeneric()) << "Failed to read thermostat cluster";
return; return;
} }
// thermostatCluster->attribute(ZigbeeClusterLibrary::ClusterIdThermostat); // thermostatCluster->attribute(ZigbeeClusterLibrary::ClusterIdThermostat);
// We need to read them from the lamp // We need to read them from the lamp
ZigbeeClusterReply *reply = thermostatCluster->readAttributes({ZigbeeClusterThermostat::AttributeLocalTemperature, ZigbeeClusterThermostat::AttributeOccupiedHeatingSetpoint}); ZigbeeClusterReply *reply = thermostatCluster->readAttributes({ZigbeeClusterThermostat::AttributeLocalTemperature, ZigbeeClusterThermostat::AttributeOccupiedHeatingSetpoint});
@ -239,15 +241,15 @@ void IntegrationPluginZigbeeGeneric::setupThing(ThingSetupInfo *info)
}); });
connect(node, &ZigbeeNode::reachableChanged, thing, [=](bool reachable){ connect(node, &ZigbeeNode::reachableChanged, thing, [=](bool reachable){
if (reachable) { if (reachable) {
ZigbeeClusterReply *reply = onOffCluster->readAttributes({ZigbeeClusterOnOff::AttributeOnOff}); ZigbeeClusterReply *reply = onOffCluster->readAttributes({ZigbeeClusterOnOff::AttributeOnOff});
connect(reply, &ZigbeeClusterReply::finished, thing, [=](){ connect(reply, &ZigbeeClusterReply::finished, thing, [=](){
if (reply->error() != ZigbeeClusterReply::ErrorNoError) { if (reply->error() != ZigbeeClusterReply::ErrorNoError) {
qCWarning(dcZigbeeGeneric()) << "Reading attribute from" << thing << "finished with error" << reply->error(); qCWarning(dcZigbeeGeneric()) << "Reading attribute from" << thing << "finished with error" << reply->error();
} }
// Note: the state will be updated using the power changed signal from the cluster // Note: the state will be updated using the power changed signal from the cluster
}); });
} }
}); });
} else { } else {
qCWarning(dcZigbeeGeneric()) << "Could not find the OnOff input cluster on" << thing << endpoint; qCWarning(dcZigbeeGeneric()) << "Could not find the OnOff input cluster on" << thing << endpoint;