Using AC Power restore even as a trigger.

Discuss RoboTask here
Post Reply
akagi82
Posts: 2
Joined: Thu Oct 29, 2020 10:47 pm

Using AC Power restore even as a trigger.

Post by akagi82 »

Hi there.

I would like my triggering event to be when my laptop which is on (not off/asleep/hibernated) detects that AC power is restored. This is logged as an EventViewer/System/Event 105. I have attatched a screencap here of the event. Can i create a custom trigger? or does one already exist? Is there another way?

(Didn't mean to do a double post. Last one was made without a proper title.)
image_2020-10-29_150104.png
image_2020-10-29_150104.png (101.17 KiB) Viewed 3790 times
Oleg
Site Admin
Posts: 3004
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Using AC Power restore even as a trigger.

Post by Oleg »

There is OnBattery variable. It returns True if computer/laptop on battery power and False otherwise.
You can check this variable every 10 sec (for example) and do some actions if OnBattery returns True
look at my example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Do not forget to enable the task after importing.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task1210"
Hide=INTEGER|0
ID=INTEGER|-964655590
LogOnAsUser=INTEGER|1
Name=STRING|"check power"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action1\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{OnBattery}"

[Actions\Action2]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Run some other task"
Params=FOLDER

[Actions\Action2\Params]
comment=STRING|"Run some other task"

[Actions\Action3]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_CYCLIC"
Name=STRING|"Cyclic (every 10 sec)"
Params=FOLDER
UniqueID=INTEGER|-662112480

[Events\Event1\Params]
interval=STRING|"10"
notsatrtatactivation=STRING|"0"
Oleg Yershov
akagi82
Posts: 2
Joined: Thu Oct 29, 2020 10:47 pm

Re: Using AC Power restore even as a trigger.

Post by akagi82 »

Thank you for your response.

The problem with this approach is that some power fluctuations that we are trying to detect only last for a second, therefore checking every 10 seconds will likely miss it. That momentary power bump is an actionable for us as there is other equipment that require remediation after such events.
Oleg
Site Admin
Posts: 3004
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Using AC Power restore even as a trigger.

Post by Oleg »

We'll add such trigger on next version.
We already work on it
Oleg Yershov
Post Reply