process power factor
This commit is contained in:
parent
8ce779b258
commit
33a1934ef3
@ -1146,6 +1146,7 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr
|
|||||||
QVariant value = payload;
|
QVariant value = payload;
|
||||||
QHash<QString, StateTypeId> stateTypeIdMap;
|
QHash<QString, StateTypeId> stateTypeIdMap;
|
||||||
stateTypeIdMap["power"] = shellyEmChannelCurrentPowerStateTypeId;
|
stateTypeIdMap["power"] = shellyEmChannelCurrentPowerStateTypeId;
|
||||||
|
stateTypeIdMap["pf"] = shellyEmChannelPowerFactorPhaseAStateTypeId;
|
||||||
stateTypeIdMap["reactive_power"] = shellyEmChannelReactivePowerPhaseAStateTypeId;
|
stateTypeIdMap["reactive_power"] = shellyEmChannelReactivePowerPhaseAStateTypeId;
|
||||||
stateTypeIdMap["voltage"] = shellyEmChannelVoltagePhaseAStateTypeId;
|
stateTypeIdMap["voltage"] = shellyEmChannelVoltagePhaseAStateTypeId;
|
||||||
stateTypeIdMap["total"] = shellyEmChannelTotalEnergyConsumedStateTypeId;
|
stateTypeIdMap["total"] = shellyEmChannelTotalEnergyConsumedStateTypeId;
|
||||||
@ -1182,14 +1183,14 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr
|
|||||||
} else {
|
} else {
|
||||||
child->setStateValue(shellyEmChannelCurrentPhaseAStateTypeId, 0);
|
child->setStateValue(shellyEmChannelCurrentPhaseAStateTypeId, 0);
|
||||||
}
|
}
|
||||||
double reactivePower = child->stateValue(shellyEmChannelReactivePowerPhaseAStateTypeId).toDouble();
|
/*double reactivePower = child->stateValue(shellyEmChannelReactivePowerPhaseAStateTypeId).toDouble();
|
||||||
double root = qSqrt(power*power + reactivePower*reactivePower);
|
double root = qSqrt(power*power + reactivePower*reactivePower);
|
||||||
if (qFuzzyCompare(root, 0) == false) {
|
if (qFuzzyCompare(root, 0) == false) {
|
||||||
double calcPf = power/root;
|
double calcPf = power/root;
|
||||||
child->setStateValue(shellyEmChannelPowerFactorPhaseAStateTypeId, calcPf);
|
child->setStateValue(shellyEmChannelPowerFactorPhaseAStateTypeId, calcPf);
|
||||||
} else {
|
} else {
|
||||||
child->setStateValue(shellyEmChannelPowerFactorPhaseAStateTypeId, 0);
|
child->setStateValue(shellyEmChannelPowerFactorPhaseAStateTypeId, 0);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user