PDA

View Full Version : OnPowerStatusChanged windows 7



yonu
September 29th, 2013, 06:30 PM
Does OnPowerStatusChanged work with windows 7 to be exact does the battery life payloads work and if so what is the best way to call them? will these be in G6 aswell?

Thanks,
yonu

yonu
October 3rd, 2013, 02:00 PM
ok it does work in 7 atleast the event shows up would anyone mind supplying an example of how to read the Payloads into variables?

Thanks,
yonu

Ron
October 3rd, 2013, 02:05 PM
if any, the payloads should be in pld1, pld2,...

yonu
October 3rd, 2013, 02:29 PM
right I get that but the issue I have is how to I access them into a variable the lua reference just doesn't make sense to me

Ron
October 3rd, 2013, 02:31 PM
I'm not entirely sure what you are trying to do. But here is a guess.

Add a script action. Attach the OnPowerStatusChanged event. Now in that script store any of the pld1,pld2, pld3 variables into a different variable of your choice so you can access them at any time.

yonu
October 3rd, 2013, 02:51 PM
ok I thank I get what you are saying and what I am trying to do is monitor the battery state and AC state on my girder server so that I can setup alearts based on the UPS state through girder

yonu
October 3rd, 2013, 05:34 PM
ok I found the payload example in the manual(should have looked there) however I am not totally sure what to do with it in the scripting action

from looking at it I assume I only need this part but I am not sure. just curious how far offbase I am.

MyCallbackID = gir.AddEventHandler(".*", 18, 18, MyCallback)

yonu
October 6th, 2013, 01:24 AM
ok I got to looking over the example in the manual and realized I need to whole script however I don't get anything in the lua console I have included the code I have just not sure what to put for device or payloads

function MyCallback(event, device, mod, payloads, id)
print(event); print(device); print(mod)
print ('test')
for i=1, 4 do print(payloads[i]) end
end
MyCallbackID = gir.AddEventHandler(".*", 18, 18, MyCallback)
-- And later in cleanup code:
gir.RemoveEventHandler(MyCallbackID); MyCallback = nil; MyCallbackID = nil

Thanks,
yonu

yonu
October 12th, 2013, 05:14 PM
hey question I finally figured out what I needed to read the payloads however I have a dumb question I ended-up doing with a xpl battery app to get more realtime readings however I need to know how to go about writing a single script that will read 3 separate events and act accordingly. sorry I am trying to cut down on actions.

Ron
October 13th, 2013, 12:08 PM
Well you could store the events in a table of your own and only do something when the script detects it has received all the info it needs.

yonu
October 13th, 2013, 12:11 PM
Thanks that works will try that when I get in this evening

Thanks,
Yonu