Skip to content
OvisMaximus edited this page Jan 10, 2016 · 5 revisions

Macros are the most powerful tool which distinguishes a universal remote on a raspberry pi from a standard universal remote from your electronic discounter. To improve this tool I'd suggest the following roadmap:

  • extract the macro stuff to different source files to enhance modularisation and make it seperatly testable.
  • allow macros to call macros to keep configuration DRY. (see "call" below)
  • introduce state to the macro mechanism, so that one can switch between "watch DVD" and "play PS3" without turning the TV off and on. Configuration could read like that:
"macros": [
  { "name": "Turn on TV",
    "hidden" : true,
    "set": "TV",
    "sequence": [
        ["gpio", "SonyTV", 1],
        ["delay", 100],
        ["lirc", "SonyTV-RC", "KEY_SOURCEHDMI1"]
     ]
  },
  { "name": "Turn on Receiver",
    "hidden" : true,
    "set": "Receiver",
    "sequence": [
        ["gpio", "Receiver", 1],
        ["delay", 300]
     ]
  },
  { "name": "Watch DVD",
    "require": ["TV", "Receiver"],
    "sequence": [
        ["gpio", "DVD", 1],
        ["delay", 300],
        ["lirc", "MyReceiverRC", "KEY_INPUTDVD"]
     ]
  },
  { "name": "Watch DVD",
    "require": ["TV", "Receiver"],
    "sequence": [
        ["gpio", "DVD", 1],
        ["delay", 300],
        ["lirc", "MyReceiverRC", "KEY_INPUTDVD"]
     ]
  },
  { "name": "Play PS3",
    "require": ["TV", "Receiver"],
    "sequence": [
        ["gpio", "SonyPS3", 1 ],
        ["delay", 300],
        ["lirc", "MyReceiverRC", "KEY_INPUTAUX"]
     ]
  },
  { "name": "Power Off Receiver",
    "hidden": true,
    "delete": "Receiver",
    "sequence": [
        ["gpio", "Receiver", 0 ]
     ]
  },
  { "name": "Shut Down",
    "sequence": [
        ["gpio", "DVD", 0],
        ["call", "Power Off Receiver"],
        ["call", "Power Off TV"],
    ]
  }
}

The setup above should only display three macro buttons in the GUI: "Watch DVD", "Play PS3" and "Shut Down"

  • introduce a mechanism to the macro engine to either process macros serial or in parallel. Since this makes stuff really complex, I suggest it beeing implemented at last. For example, the calls to lirc have to be serialized again: introduce a queue, a delay...
Clone this wiki locally