HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: mad on October 10, 2016, 04:55:00 PM

Title: ApiCall or Raise Event from Scheduler Javascript
Post by: mad on October 10, 2016, 04:55:00 PM
Hi,

 I'm trying calling my program from Scheduler handler. What is the best way to communicate from scheduler to my program?

I try this method without effect:

Code: [Select]
$$.control.ApiCall("HomeAutomation.MAdThermostat", 1000, "Thermostat.SetPointValve" , "option1/option2", function(response){} );
  And second question, how debug the javascript code starting from scheduler?

 Finally, what is right syntax in javascript: $$.boundModules.each.Address.join('-') ?


Thank you very much!
Title: Re: ApiCall or Raise Event from Scheduler Javascript
Post by: dani on October 10, 2016, 06:35:53 PM
You can look at that sample for Alarm module.

Replace "HomeAutomation.HomeGenieAutomation" and "90" by your domain name and module number. then you get a pointer to your module. And then perhaps you can try :
Alarm.Thermostat.SetPointValve("Value");

 
Title: Re: ApiCall or Raise Event from Scheduler Javascript
Post by: mad on October 10, 2016, 08:15:43 PM
Event "When.ModuleParameterChanged" looks good, but there is a way raise from scheduler?

Event is fired after Command.Execute() call. I need call event before (and hit the command.execute from program)

There isn't javascript command $$.program.RaiseEvent
Title: Re: ApiCall or Raise Event from Scheduler Javascript
Post by: mad on October 16, 2016, 07:10:59 PM
Problem solved with

Code: [Select]
$$.program.WithAddress(1000).RaiseEvent
I sent pull request to fix this function.