Logic Machine Forum
Convert from Wh to Kwh - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Convert from Wh to Kwh (/showthread.php?tid=1228)



Convert from Wh to Kwh - Domoticatorino - 10.02.2018

Hi there,
what's wrong with this below?

Consumo_impianto = grp.getvalue('3/3/30')
os.sleep(0.5)
Consumo_ftv_fase_1 = grp.getvalue('3/3/24')
os.sleep(0.5)
Consumo_ftv_fase_2 = grp.getvalue('3/3/25')
os.sleep(0.5)
Consumo_ftv_fase_1 = grp.getvalue('3/3/26')
os.sleep(0.5)
Consumo_pdc = grp.getvalue('3/3/27')
os.sleep(0.5)
Consumo_impianto_kwh = (Consumo_impianto / 1000)
os.sleep(0.5)
Consumo_ftv_fase_1_kwh = (Consumo_ftv_fase_1 / 1000)
os.sleep(0.5)
Consumo_ftv_fase_2_kwh = (Consumo_ftv_fase_2 / 1000)
os.sleep(0.5)
Consumo_ftv_fase_3_kwh = (Consumo_ftv_fase_3 / 1000)
os.sleep(0.5)
Consumo_pdc_kwh = (Consumo_pdc / 1000)
os.sleep(0.5)
grp.write ('3/3/121', Consumo_impianto_kwh)
os.sleep(0.5)
grp.write ('3/3/124', Consumo_ftv_fase_1_kwh)
os.sleep(0.5)
grp.write ('3/3/125', Consumo_ftv_fase_2_kwh)
os.sleep(0.5)
grp.write ('3/3/126', Consumo_ftv_fase_3_kwh)
os.sleep(0.5)
grp.write ('3/3/127', Consumo_pdc_kwh)

Nothing write.

Thanks.


RE: Convert from Wh to Kwh - Erwin van der Zwart - 10.02.2018

Hi,

Are you using modbus templates? If yes you can add a scale factor in the template.

BR,

Erwin


RE: Convert from Wh to Kwh - Domoticatorino - 10.02.2018

Hi Erwing,
no. Data comes from KNX (4 byte integer). Active Energy.

I remember that with an old version of Logic Machine there was not any problem. I cannot explain it.

Thanks.


RE: Convert from Wh to Kwh - Erwin van der Zwart - 10.02.2018

Have you logged the outcome?

Maybe you need to round it with math.round(value, 0)

You can also remove the delay’s on all items that are not grp.write related.

BR,

Erwin


RE: Convert from Wh to Kwh - Domoticatorino - 10.02.2018

OK Done. Thank you!!