more G-Labs products

Author Topic: ApiCall or Raise Event from Scheduler Javascript  (Read 579 times)

October 10, 2016, 04:55:00 PM
Read 579 times

mad

  • *
  • Information
  • Newbie
  • Posts: 5
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!

October 10, 2016, 06:35:53 PM
Reply #1

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
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");

 
« Last Edit: October 10, 2016, 06:37:27 PM by dani »

October 10, 2016, 08:15:43 PM
Reply #2

mad

  • *
  • Information
  • Newbie
  • Posts: 5
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
« Last Edit: October 10, 2016, 08:23:22 PM by mad »

October 16, 2016, 07:10:59 PM
Reply #3

mad

  • *
  • Information
  • Newbie
  • Posts: 5
Problem solved with

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