Adding X10 lighting control to MythTV's menu

From JoatWiki
Jump to: navigation, search

Adding X10 lighting control to MythTV's menu

(13 Oct 2009) - Like "Controlling the lights with Asterisk and X-10", this one is so easy it's almost silly. Assuming that you have the proper hardware and Neil Cherry's bottlerocket software installed, just add the following to the end of /usr/share/mythtv/mainmenu.xml (just above the closing tag for "mythmenu").
  <button>
       <type>MENU_LIGHTS</type>
       <text>Lights on</text>
       <action>EXEC /usr/bin/br A2 on</action>
  </button>
  <button>
       <type>MENU_LIGHTS</type>
       <text>Lights off</text>
       <action>EXEC /usr/bin/br A2 off</action>
  </button>

For multiple lights, EXEC a script instead. This has the advantage of not having to program your remote to be able to control the lights and/or curtain controls. The disadvantage is that these controls aren't available while you're watching something (for that, you'll probably have to program your remote).

Note: the above will add entries to your menu but there won't be any picture associated with it. For that, you'll have to play around with the theme.xml file in the proper folder for your theme or re-use one of the menu types (hint: the name between the "type" tags corresponds to a graphic which is declared in your theme's theme.xml). In other words, change "MENU_LIGHTS" to something used elsewhere in mainmenu.xml.

Inspired by tgm4883's post in the Ubuntu forums, concerning the addition of a Hulu button in MythTV's menu.

Side note: for those adding the Hulu Desktop, as per tgm4883's post, you'll want to add "-r" to REMOTE_LIRCD_ARGS in /etc/lirc/hardware.conf (so that it looks like REMOTE_LIRCD_ARGS="-r" ) and you'll want to add "-f" (for full screen) to "EXEC /usr/bin/huludesktop" (so that it looks like "EXEC /usr/bin/huludesktop -f") in MythTV's mainmenu.xml.

Update: For 0.22, MythTV no longer picks up the changes in /usr/share/mythtv. Instead, copy the appropriate menu file to the .mythtv folder in the home directory of the user account that's used to run mythtv (your own home dir if you start MythTV manually). Then edit the file.

Update: (25 Nov 2009) Alternatively, you can use just a single entry to toogle the lights by using the script below. Call it "togglelights" and save it in /bin (or some other path reachable by the mythtv user account).

#!/usr/bin/perl

if(-e "/tmp/light") {
        system ("rm /tmp/light");
        system ("/usr/bin/br A2 off");
} else {
        system ("touch /tmp/light");
        system ("/usr/bin/br A2 on");
}

Then you only have to add the following to the appropriate menu:

  <button>
       <type>MENU_LIGHTS</type>
       <text>Toggle the lights</text>
       <action>EXEC /bin/togglelights</action>
  </button>

Enjoy!




Comments:

Leave a Comment

Personal tools