power
The sos.management.power
API groups together methods related to the power state of the device. Such as rebooting, shutting down,
setting timers.
Methods
appRestart()
The appRestart()
method initializes a restart of the signageOS app.
appRestart(): Promise<void>;
Example
await sos.management.power.appRestart();
clearScheduledReboots()
Removes all scheduled reboot rules from the device.
clearScheduledReboots(): Promise<void>;
Example
await sos.management.power.clearScheduledReboots();
getProprietaryTimers()
The getProprietaryTimers()
method returns a list of currently set
proprietary timers.
getProprietaryTimers(): Promise<IProprietaryTimer[]>;
Example
const timers = await sos.management.power.getProprietaryTimers();
getScheduledReboots()
Returns all scheduled reboot rules on the device.
getScheduledReboots(): Promise<IScheduledRebootActions[]>;
Example
await sos.management.power.getScheduledReboots();
getTimers()
The getTimers()
method returns a list of currently set native timers.
getTimers(): Promise<ITimer[]>;
Example
const timers = await sos.management.power.getTimers();
removeScheduledReboot()
Removes scheduled reboot rule from the device.
removeScheduledReboot(id: string): Promise<void>;
Params
Name | Type | Description |
---|---|---|
id | string | - ID of the rule to be removed. |
Example
// Get scheduled reboots
const scheduledReboots = await sos.management.power.getScheduledReboots();
// Remove scheduled reboot
await sos.management.power.removeScheduledReboot(scheduledReboots[0].id);
setProprietaryTimer()
The setProprietaryTimer()
method creates or updates a
proprietary timer.
setProprietaryTimer(type: ProprietaryTimerType, timeOn: string | null, timeOff: string | null, weekdays: string[], keepAppletRunning?: boolean): Promise<void>;
Params
Name | Type | Description |
---|---|---|
type | TIMER_${number} | The type of the timer (TIMER_1 , ..., TIMER_7 ). |
timeOn | string | null | The time when the device should turn on. |
timeOff | string | null | The time when the device should turn off. |
weekdays | string[] | The days of the week when the timer should be active (mon , ..., sun ). |
keepAppletRunning (optional) | boolean | If true , the applet will be kept running when the timer is active on certain devices. |
Example
await sos.management.power.setProprietaryTimer("TIMER_20", "08:00", "22:00", ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], 30);
setScheduledReboot()
Schedule automatic reboot on the device. Calling this function will create one rule.
It is possible to set multiple rules, which can be later obtained by getScheduledReboots
function.
- Setting new scheduled reboot on device might take up to 10 minutes to show in Box.
- Every new scheduled reboot rule gets unique identifier generated by device, it might be later returned by
getScheduledReboots()
.
setScheduledReboot(weekdays: WeekdayType[], time: string): Promise<void>;
Params
Name | Type | Description |
---|---|---|
weekdays | WeekdayType[] | |
time | string | - Time when the reboot should be executed. Format is HH:mm:ss . |
Example
// Schedule reboot every Monday at 3:00 AM
await sos.management.power.setScheduledReboot(["MONDAY"], "03:00:00");
// Schedule reboot every Monday and Friday at 7:30 PM / 19:30
await sos.management.power.setScheduledReboot(["MONDAY", "FRIDAY"], "19:30:00");
setTimer()
The setTimers()
method creates or updates a native timer.
setTimer(type: keyof typeof TimerType, timeOn: string | null, timeOff: string | null, weekdays: string[], volume: number): Promise<void>;
Params
Name | Type | Description |
---|---|---|
type | "TIMER_1" | "TIMER_2" | "TIMER_3" | "TIMER_4" | "TIMER_5" | "TIMER_6" | "TIMER_7" | The type of the timer (TIMER_1 , ..., TIMER_7 ). |
timeOn | string | null | The time when the device should turn on. |
timeOff | string | null | The time when the device should turn off. |
weekdays | string[] | The days of the week when the timer should be active (mon , ..., sun ). |
volume | number | The volume level set when the device is turned on. |
Example
await sos.management.power.setTimer("TIMER_1", "08:00", "22:00", ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], 30);
systemReboot()
The systemReboot()
method initializes a system reboot.
systemReboot(): Promise<void>;
Example
await sos.management.power.systemReboot();
unsetProprietaryTimer()
The unsetProprietaryTimer()
method removes the specified
proprietary timer.
unsetProprietaryTimer(type: ProprietaryTimerType): Promise<void>;
Params
Name | Type | Description |
---|---|---|
type | TIMER_${number} | The type of the timer (TIMER_1 , ..., TIMER_7 ). |
Example
await sos.management.power.unsetProprietaryTimer("TIMER_2");
unsetTimer()
The unsetTimer()
method removes the specified native timer.
unsetTimer(type: keyof typeof TimerType): Promise<void>;
Params
Name | Type | Description |
---|---|---|
type | "TIMER_1" | "TIMER_2" | "TIMER_3" | "TIMER_4" | "TIMER_5" | "TIMER_6" | "TIMER_7" | The type of the timer (TIMER_1 , ..., TIMER_7 ). |
Example
await sos.management.power.unsetTimer("TIMER_2");