HomeGenie Forum
Automation Program Plugins and Wizard Scripting => Help => Topic started by: codedmind on November 26, 2015, 10:37:00 PM
-
Hy there,
I have a shell script that will get the following information
Energy:25860668 Wh
Power:510 W
Current: 2215 mA
Voltage:230 V
How can i put this information in the energy widget, what is the difference off load and and counter
What is what?
-
Hi codemind,
to push metering data in the system you have to call the following instruction
Pseudo code:
var instantWattReading = [the field that holds the value Power:510 W]; // a string representing a decimal number eg. 510.40
Program.RaiseEvent("Meter.Watts", instantWattReading, "My Meter");
this should be called every minute or 30 seconds to have accurate results in the energy monitor widget.
The energy monitor widget indicates with Load the sum of instant watt reading for all active devices, with Counter the kW/h energy consumption counter (the one you see in the bills).
g.
-
Great.
Thanks gene
-
I have made the changes, but won't work 100% my font information is only updated from 5 to 5 minutes
Even if i code hg to read the script from 30 to 30 seconds the value always be the same... do you think that is better ?
In this moment the energy widget only show the load
-
Hi codemind,
this is correct that is resampled every 5 minutes. You should se the counter increasing after some time. For example if you keep a light consuming 45W switched on for one hour, then the counter should increase by 0.045 (because it is expressed in kW/hour).
g.
-
Gene i have done that, the only difference is the time of the read, 5 to 5 minutes, but the widget never update the counter (i'm guessing the counter is the center value that like you said is in kw), only the load (upper left corner of the widget)
-
As said in my previous message reading must be every 30 seconds or every minute in order to be accurate. In a real situation this is supposed to be a continuos read value, but in this case we can take some Watt sample periodically (that's why is called WattS), then all collected samples will be averaged every 5 minutes and stored in the DB. Having only one sample every 5 minutes won't work.
g.
-
I have the script in hg reading in every 1 minute, however the value only change after 5 minutes... because the source... But in the widget that should be the trick to increment the counters.... or not?
-
Can you please me show the code where you read the value and put it into "Meter.Watts" parameter?
g.
-
This is the module.
I have a scheduler cron to exec it every minute
The module exec a python script that output one line (ex: 25860668;510)
-
Hi codemind,
this program is missing a couple of things:
1) Program.Run() instruction in the startup code
2) a while (Program.IsEnabled) loop (with a Pause(60) between each iteration), "polling" the watt value from the script and raising the event
Cheers,
g.
-
I gene
I have done thatm however the "problem" is the same, i don't have total in the widget always 0 KW
-
The attacched program is working fine.
g.