Kodi Community Forum

Full Version: Shutdown timer via a button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a shutdown option on Home couple people have asked for a shutdown timer as a submenu.

I didn't see that option in any other skins, and by the looks of it, closest I can come it to activate SettingsCategory.xml, is that correct?
is this what you're looking for?
Code:
<onclick>AlarmClock(shutdowntimer,Shutdown())</onclick>
Thx as always...
no worries, the code can be found in DialogButtonMenu.xml

in case you also want an option to reset the shutdown timer:
Code:
<onclick>CancelAlarm(ShutdownTimer)</onclick>

also, i seem to remember the extra brackets are not needed, so you might as well use:
Code:
<onclick>AlarmClock(shutdowntimer,Shutdown)</onclick>
Thx again...To take it one step farther could a visible be set for the cancel button? Like:

<visible>alarm clock is set</visible>
yup:
<visible>System.HasAlarm(ShutdownTimer)</visible>
ronie Wrote:no worries, the code can be found in DialogButtonMenu.xml
.......

And then there is always http://wiki.xbmc.org/?title=List_of_Built_In_Functions

Quote:AlarmClock(name,command,time[,silent]) Pops up a dialog asking for the length of time for the alarm (unless the parameter time is specified), and starts a timer. When the timer runs out, it'll execute the built-in command (the parameter command) if it is specified, otherwise it'll pop up an alarm notice. Set silent to true to hide the alarm notification.

Quote:CancelAlarm(name) Cancel a running alarm

and http://wiki.xbmc.org/?title=List_of_Boolean_Conditions
Quote:System.HasAlarm(alarm) Returns true if the system has the ?alarm? alarm set.
and
Quote:System.AlarmLessOrEqual(alarmname,seconds) Returns true if the alarm with ?alarmname? has less or equal to ?seconds? left. Standard use would be system.alarmlessorequal(shutdowntimer,119), which would return true when the shutdowntimer has less then 2 minutes left.