Turns out setting an alarm from the command line is now extremely simple thanks to PMs executeAction method. Was that always there? Here is a simple script that takes seconds as an argument. If you don't give it anything it defaults to 60 seconds. If you give it something that isn't a number it will fail with ValueError exception. Title, snooze and sound can, of course, be modified from within the script. python and python-dbus need to be installed (apt-get install python python-dbus as root) Argument is given simply with: python /path/to/script.py 120 This will set an alarm 120 seconds from now. Code: #!/usr/bin/python import dbus import sys bus = dbus.SessionBus() pm_obj = bus.get_object('org.ajalkane.profilematic', '/org/ajalkane/profilematic') pm_intf = dbus.Interface(pm_obj, 'org.ajalkane.profilematic') actions_struct = ['', 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, '', '', dbus.Array([], signature=dbus.Signature('(usis)')), '', 0, 1, [dbus.Array([], signature=dbus.Signature('s'))], -1, 0, ['', -1, -1, ''], -1, 0] if len(sys.argv) == 2: seconds = int(sys.argv[1]) else: seconds = 60 title = 'Timer' snooze = 10 sound = '' actions_struct[24] = [title, seconds, snooze, sound] pm_intf.executeAction(actions_struct) print 'Alarm set to go off in %s seconds from now.' %seconds Other ProfileMatic actions can be executed by modifying certain parts of the actions_struct. I can post the relevant indices if anyone is interested.
#!/usr/bin/python import dbus import sys bus = dbus.SessionBus() pm_obj = bus.get_object('org.ajalkane.profilematic', '/org/ajalkane/profilematic') pm_intf = dbus.Interface(pm_obj, 'org.ajalkane.profilematic') actions_struct = ['', 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, '', '', dbus.Array([], signature=dbus.Signature('(usis)')), '', 0, 1, [dbus.Array([], signature=dbus.Signature('s'))], -1, 0, ['', -1, -1, ''], -1, 0] if len(sys.argv) == 2: seconds = int(sys.argv[1]) else: seconds = 60 title = 'Timer' snooze = 10 sound = '' actions_struct[24] = [title, seconds, snooze, sound] pm_intf.executeAction(actions_struct) print 'Alarm set to go off in %s seconds from now.' %seconds