Difference between revisions of "JavaScript Callback Functions API"
Line 4: | Line 4: | ||
=== DaylightEvent === | === DaylightEvent === | ||
+ | |||
+ | DaylightEvent(day) | ||
Called at sunrise and sunset, according to the latitude and longitude values set in hsyco.ini, and the optional SunriseOffsetMinutes and SunsetOffsetMinutes parameters. | Called at sunrise and sunset, according to the latitude and longitude values set in hsyco.ini, and the optional SunriseOffsetMinutes and SunsetOffsetMinutes parameters. | ||
− | |||
− | |||
'''Parameters:''' | '''Parameters:''' | ||
Line 14: | Line 14: | ||
=== haActiveEvent === | === haActiveEvent === | ||
+ | |||
+ | haActiveEvent(active) | ||
Triggered by the change of state of an HSYCO server in a master/slave high availability configuration. | Triggered by the change of state of an HSYCO server in a master/slave high availability configuration. | ||
− | |||
− | |||
'''Parameters:''' | '''Parameters:''' | ||
Line 24: | Line 24: | ||
=== PowerEvent === | === PowerEvent === | ||
+ | |||
+ | PowerEvent(power) | ||
Triggered by a change of the current power load level, as set using the powerSet() Java API or the POWER action. | Triggered by a change of the current power load level, as set using the powerSet() Java API or the POWER action. | ||
Line 32: | Line 34: | ||
Thanks to this method it is possible to alter the power value shown in the Web interface, for example to aggregate power readings acquired from other sensors. | Thanks to this method it is possible to alter the power value shown in the Web interface, for example to aggregate power readings acquired from other sensors. | ||
− | |||
− | |||
'''Parameters:''' | '''Parameters:''' | ||
Line 40: | Line 40: | ||
=== programTimerEvent === | === programTimerEvent === | ||
+ | |||
+ | programTimerEvent(name) | ||
This method is called when a program timer is activated. | This method is called when a program timer is activated. | ||
Program timers are set using programTimerSet(), programTimerReset(), programTimerRepeat(), or using the corresponding actions in the EVENTS. | Program timers are set using programTimerSet(), programTimerReset(), programTimerRepeat(), or using the corresponding actions in the EVENTS. | ||
− | |||
− | |||
'''Parameters:''' | '''Parameters:''' |
Revision as of 18:54, 30 January 2014
Contents
Callback Functions
System Functions
DaylightEvent
DaylightEvent(day)
Called at sunrise and sunset, according to the latitude and longitude values set in hsyco.ini, and the optional SunriseOffsetMinutes and SunsetOffsetMinutes parameters.
Parameters:
- day: boolean - true at sunrise, false at sunset.
haActiveEvent
haActiveEvent(active)
Triggered by the change of state of an HSYCO server in a master/slave high availability configuration.
Parameters:
- active: boolean - true if the server is active, false if not active.
PowerEvent
PowerEvent(power)
Triggered by a change of the current power load level, as set using the powerSet() Java API or the POWER action.
If PowerEvent() returns -1 or if not defined, HSYCO status is updated with the detected power value, the value returned by PowerEvent() is otherwise used.
The JavaScript PowerEvent return value is used only if the Java PowerEvent callback is not defined or returned -1.
Thanks to this method it is possible to alter the power value shown in the Web interface, for example to aggregate power readings acquired from other sensors.
Parameters:
- power: numeric - the power level, in Watts.
programTimerEvent
programTimerEvent(name)
This method is called when a program timer is activated.
Program timers are set using programTimerSet(), programTimerReset(), programTimerRepeat(), or using the corresponding actions in the EVENTS.
Parameters:
- name: string - program timer name.