Hello,
I’m trying to translate my old rules in the new OH3 rule engine, but is very difficult and I don’t know how can I do.
My old rule was
rule "Consumo Istantaneo"
when
Item Enel_Real_Power received update or
Item FV_Real_Power received update
then
if (Enel_Real_Power.state > 0 && FV_Real_Power.state > 0)
{
Ist_Consumo.postUpdate(FV_Real_Power.state as Number + Enel_Real_Power.state as Number)
Ist_Prelievo.postUpdate(Enel_Real_Power.state)
Ist_Immissione.postUpdate(0)
Ist_Autoconsumo.postUpdate(FV_Real_Power.state)
Ist_Produzione.postUpdate(FV_Real_Power.state)
}
end
I try to do with blocky rules but these new code not work…
if ('MQTTEnergymonitor_EnelPotenzaReale' > 0 && 'MQTTEnergymonitor_PannelliPotenzaReale' > 0) {
events.postUpdate('Ist_Consumo', ('MQTTEnergymonitor_EnelPotenzaReale' + 'MQTTEnergymonitor_PannelliPotenzaReale'));
}
Can you help me to see the light at the end ?
thank you