diff --git a/plugin.py b/plugin.py
index 0f7cf3e..a12e922 100644
--- a/plugin.py
+++ b/plugin.py
@@ -12,6 +12,11 @@ Requirements:
+
+
+
+
+
@@ -154,6 +159,7 @@ class BasePlugin:
Domoticz.Device(Name="Export Energy", Unit=10, Type=243, Subtype=29, Used=0).Create()
# 11 will be not used Import 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:
Options = { "Custom": "1;W" }
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()
if 20 not in Devices:
Domoticz.Device(Name="Maximum Total Demand Current", Unit=20, TypeName="Current (Single)", Used=0).Create()
+ # End of TODO
+
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)
return
@@ -257,20 +265,43 @@ class BasePlugin:
export_power = 0
#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)) )
- 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("Max Demand Pwr : " + str(getmodbus(0x0056, client)) )
- Domoticz.Log("Input Demand Pwr : " + str(getmodbus(0x0058, client)) )
- Domoticz.Log("Max Input Demand Pwr : " + str(getmodbus(0x005a, client)) )
- Domoticz.Log("Export Demand Pwr : " + str(getmodbus(0x005c, client)) )
- Domoticz.Log("Max Export Demand Pwr : " + str(getmodbus(0x005e, client)) )
- Domoticz.Log("Total Demand Cur: " + str(getmodbus(0x0102, client)) )
- Domoticz.Log("Max Total Demand Cur: " + str(getmodbus(0x0108, client)) )
- Domoticz.Log("Total Energy Act: " + str(getmodbus(0x0156, client)) )
+ #Domoticz.Log("Total Demand Pwr : " + str(getmodbus(0x0054, client)) )
+ self.total_demand_power.update(getmodbus(0x0054, client))
+ Devices[13].Update(1, self.total_demand_power.strget())
+
+ #Domoticz.Log("Max Demand Pwr : " + str(getmodbus(0x0056, client)) )
+ Devices[14].Update(1, str(getmodbus(0x0056, client)))
+
+ #Domoticz.Log("Input Demand Pwr : " + str(getmodbus(0x0058, 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