Added P1 counter.

This commit is contained in:
2022-10-23 21:19:38 +02:00
parent 834bb8474b
commit 7a4961060b

View File

@ -12,6 +12,11 @@ Requirements:
<param field="Address" label="IP Address" width="150px" required="true" /> <param field="Address" label="IP Address" width="150px" required="true" />
<param field="Port" label="Port Number" width="100px" required="true" default="502" /> <param field="Port" label="Port Number" width="100px" required="true" default="502" />
<param field="Mode3" label="Modbus address" width="100px" required="true" default="1" /> <param field="Mode3" label="Modbus address" width="100px" required="true" default="1" />
<param field="Mode5" label="Collect extended data" width="100px">
<options>
<option label="Enabled" value="Moredata"/>
<option label="Disabled" value="Regular" default="true" />
</options>
<param field="Mode6" label="Debug" width="100px"> <param field="Mode6" label="Debug" width="100px">
<options> <options>
<option label="True" value="Debug"/> <option label="True" value="Debug"/>
@ -154,6 +159,7 @@ class BasePlugin:
Domoticz.Device(Name="Export Energy", Unit=10, Type=243, Subtype=29, Used=0).Create() Domoticz.Device(Name="Export Energy", Unit=10, Type=243, Subtype=29, Used=0).Create()
# 11 will be not used Import Energy (Reactive) / kVArh # 11 will be not used Import Energy (Reactive) / kVArh
# 12 will be not used Export Energy (Reactive) / kVArh # 12 will be not used Export Energy (Reactive) / kVArh
# TODO: collect this only if it is really wanted
if 13 not in Devices: if 13 not in Devices:
Options = { "Custom": "1;W" } Options = { "Custom": "1;W" }
Domoticz.Device(Name="Total Demand Power", Unit=13, TypeName="Custom", Used=0, Options=Options).Create() Domoticz.Device(Name="Total Demand Power", Unit=13, TypeName="Custom", Used=0, Options=Options).Create()
@ -176,8 +182,10 @@ class BasePlugin:
Domoticz.Device(Name="Total Demand Current", Unit=19, TypeName="Current (Single)", Used=0).Create() Domoticz.Device(Name="Total Demand Current", Unit=19, TypeName="Current (Single)", Used=0).Create()
if 20 not in Devices: if 20 not in Devices:
Domoticz.Device(Name="Maximum Total Demand Current", Unit=20, TypeName="Current (Single)", Used=0).Create() Domoticz.Device(Name="Maximum Total Demand Current", Unit=20, TypeName="Current (Single)", Used=0).Create()
# End of TODO
if 21 not in Devices: if 21 not in Devices:
Domoticz.Device(Name="Total Energy (Active)", Unit=21, Type=243, Subtype=29, Used=0).Create() Domoticz.Device(Name="Total Energy (Active)", Unit=21, Type=0xfa, Subtype=0x01, Used=0).Create()
# 22 will not be used Total Energy (Reactive) # 22 will not be used Total Energy (Reactive)
return return
@ -257,20 +265,43 @@ class BasePlugin:
export_power = 0 export_power = 0
#Domoticz.Log("Import NRJ act : " + str(getmodbus(0x0048, client)) ) #Domoticz.Log("Import NRJ act : " + str(getmodbus(0x0048, client)) )
Devices[9].Update(1, sValue=str(import_power)+";"+str(getmodbus(0x0048, client)*1000)) import_e = str(getmodbus(0x0048, client)*1000)
Devices[9].Update(1, sValue=str(import_power)+";"+import_e)
#Domoticz.Log("Export NRJ act : " + str(getmodbus(0x004a, client)) ) #Domoticz.Log("Export NRJ act : " + str(getmodbus(0x004a, client)) )
Devices[10].Update(1, sValue=str(export_power)+";"+str(getmodbus(0x004a, client)*1000)) export_e = str(getmodbus(0x004a, client)*1000)
Devices[10].Update(1, sValue=str(export_power)+";"+export_e)
Domoticz.Log("Total Demand Pwr : " + str(getmodbus(0x0054, client)) ) #Domoticz.Log("Total Demand Pwr : " + str(getmodbus(0x0054, client)) )
Domoticz.Log("Max Demand Pwr : " + str(getmodbus(0x0056, client)) ) self.total_demand_power.update(getmodbus(0x0054, client))
Domoticz.Log("Input Demand Pwr : " + str(getmodbus(0x0058, client)) ) Devices[13].Update(1, self.total_demand_power.strget())
Domoticz.Log("Max Input Demand Pwr : " + str(getmodbus(0x005a, client)) )
Domoticz.Log("Export Demand Pwr : " + str(getmodbus(0x005c, client)) ) #Domoticz.Log("Max Demand Pwr : " + str(getmodbus(0x0056, client)) )
Domoticz.Log("Max Export Demand Pwr : " + str(getmodbus(0x005e, client)) ) Devices[14].Update(1, str(getmodbus(0x0056, client)))
Domoticz.Log("Total Demand Cur: " + str(getmodbus(0x0102, client)) )
Domoticz.Log("Max Total Demand Cur: " + str(getmodbus(0x0108, client)) ) #Domoticz.Log("Input Demand Pwr : " + str(getmodbus(0x0058, client)) )
Domoticz.Log("Total Energy Act: " + str(getmodbus(0x0156, client)) ) self.import_demand_power.update(getmodbus(0x0058, client))
Devices[15].Update(1, self.import_demand_power.strget())
#Domoticz.Log("Max Input Demand Pwr : " + str(getmodbus(0x005a, client)) )
Devices[16].Update(1, str(getmodbus(0x005a, client)))
#Domoticz.Log("Export Demand Pwr : " + str(getmodbus(0x005c, client)) )
self.import_demand_power.update(getmodbus(0x0058, client))
Devices[17].Update(1, self.import_demand_power.strget())
#Domoticz.Log("Max Export Demand Pwr : " + str(getmodbus(0x005e, client)) )
Devices[18].Update(1, str(getmodbus(0x005e, client)))
#Domoticz.Log("Total Demand Cur: " + str(getmodbus(0x0102, client)) )
self.total_demand_current.update(getmodbus(0x0102, client))
Devices[19].Update(1, self.total_demand_current.strget())
#Domoticz.Log("Max Total Demand Cur: " + str(getmodbus(0x0108, client)) )
Devices[20].Update(1, str(getmodbus(0x0108, client)))
#Domoticz.Log("Total Energy Act: " + str(getmodbus(0x0156, client)) )
Devices[21].Update(1, sValue=import_e+";0;"+export_e+";0;"+str(import_power)+";"+str(export_power))
global _plugin global _plugin