Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

harmony remote and start/stop scripts

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


aaron at rb303

May 10, 2012, 5:52 PM

Post #1 of 4 (429 views)
Permalink
harmony remote and start/stop scripts

I am trying to get my Harmony remote to start/stop the mythfrontend to make
it simpler for my family to do different things. I am on Mythbuntu 12.04
32bit. I have setup a irexec file, and made sure its running in daemon
mode. It all seems to kinda work, but not really sure what I'm missing to
make it run 100%. Here are my files, I think I just need another pair of
eyes to help me see what I am missing.

The parts I can't easily show are I have my Harmony remote set to run two
different activities. First one is "Watch TV" , second is "Watch Movies".
The watch TV activity is set to use the TV for audio (HDMI); then the
movies activity is set to use SPDIF to my receiver. I have it set to send
KEY_BLUE and KEY_YELLOW as the power on/off sequence from the remote. I
have verified it is sending them with irw.

The reason behind all this is my wife seems to get easily confused, so I am
trying to eliminate all "hassles" with switching applications. I should
mention when I run these scripts by hand they run flawlessly. So I'm not
really sure where or why its not running correctly. The results are
baffling. If I press "Watch TV" MythTV will pop up then close, then XBMC
will open. If I press "Watch Movies" it does the opposite. At first I
thought I had the Blue and Yellow wrong in the remote, but I've verified it
many times. I have also switched KEY_BLUE and KEY_YELLOW in the irexec
file, but it didn't seem to make a difference. Any incite would be much
appreciated.

~/.lirc/irexec
# MythTV
begin
remote = mceusb
prog = irexec
button = KEY_BLUE
config = ~/scripts/mythtv_start.sh &
end

# XBMC
begin
remote = mceusb
prog = irexec
button = KEY_YELLOW
config = ~/scripts/xbmc_start.sh &
end

~/scripts/mythtv_start.sh
#!/bin/bash
# Test to see if XMBC is running first
if ps -ef | grep xbmc.bin | grep -v grep
then
killall -v -s9 xbmc.bin
fi
# Now to see if MythTV is running
if ps -ef | grep mythfrontend | grep -v grep
then
# Do nothing
echo “MythTV already Running!”
else
# Startup MythTV
mythfrontend
fi
exit

~/scripts/xbmc_start.sh
#!/bin/bash
# Test to see if MythTV is running
if ps -ef | grep mythfrontend | grep -v grep
then
killall -v -s9 mythfrontend.re
fi
# Now to see if XBMC is running
if ps -ef | grep -v grep | grep -i xbmc.bin
then
# Do nothing
echo “XBMC already Running!”
else
# Startup XBMC
xbmc
fi
exit


mikep at randomtraveller

May 11, 2012, 3:09 AM

Post #2 of 4 (407 views)
Permalink
Re: harmony remote and start/stop scripts [In reply to]

On 11/05/12 01:52, Aaron wrote:
> I am trying to get my Harmony remote to start/stop the mythfrontend to make
> it simpler for my family to do different things. I am on Mythbuntu 12.04
> 32bit. I have setup a irexec file, and made sure its running in daemon
> mode. It all seems to kinda work, but not really sure what I'm missing to
> make it run 100%. Here are my files, I think I just need another pair of
> eyes to help me see what I am missing.
>
> The parts I can't easily show are I have my Harmony remote set to run two
> different activities. First one is "Watch TV" , second is "Watch Movies".
> The watch TV activity is set to use the TV for audio (HDMI); then the
> movies activity is set to use SPDIF to my receiver. I have it set to send
> KEY_BLUE and KEY_YELLOW as the power on/off sequence from the remote. I
> have verified it is sending them with irw.
>
> The reason behind all this is my wife seems to get easily confused, so I am
> trying to eliminate all "hassles" with switching applications. I should
> mention when I run these scripts by hand they run flawlessly. So I'm not
> really sure where or why its not running correctly. The results are
> baffling. If I press "Watch TV" MythTV will pop up then close, then XBMC
> will open. If I press "Watch Movies" it does the opposite. At first I
> thought I had the Blue and Yellow wrong in the remote, but I've verified it
> many times. I have also switched KEY_BLUE and KEY_YELLOW in the irexec
> file, but it didn't seem to make a difference. Any incite would be much
> appreciated.
>
> ~/.lirc/irexec
> # MythTV
> begin
> remote = mceusb
> prog = irexec
> button = KEY_BLUE
> config = ~/scripts/mythtv_start.sh&
> end
>
> # XBMC
> begin
> remote = mceusb
> prog = irexec
> button = KEY_YELLOW
> config = ~/scripts/xbmc_start.sh&
> end
>
> ~/scripts/mythtv_start.sh
> #!/bin/bash
> # Test to see if XMBC is running first
> if ps -ef | grep xbmc.bin | grep -v grep
> then
> killall -v -s9 xbmc.bin
> fi
> # Now to see if MythTV is running
> if ps -ef | grep mythfrontend | grep -v grep
> then
> # Do nothing
> echo “MythTV already Running!”
> else
> # Startup MythTV
> mythfrontend
> fi
> exit
>
> ~/scripts/xbmc_start.sh
> #!/bin/bash
> # Test to see if MythTV is running
> if ps -ef | grep mythfrontend | grep -v grep
> then
> killall -v -s9 mythfrontend.re
> fi
> # Now to see if XBMC is running
> if ps -ef | grep -v grep | grep -i xbmc.bin
> then
> # Do nothing
> echo “XBMC already Running!”
> else
> # Startup XBMC
> xbmc
> fi
> exit
>
You don't say which model of Harmony remote. That might be significant.

I would add this comment, based on my own experiences: Make sure that both the
Harmony and *all* your devices are in the same, known, consistent state before
you do any testing. Harmony remotes have an internal idea of what state each
device is supposed to be in; if for example something is powered up when the
remote thinks it should be off (or vice versa) then it is very easy to get into
a confused state.

My system is a Harmony 600, TV, cable box, mythtv front end and DVD player.
Currently I don't allow the remote to control the power on the cable box or the
front end. The cable box is always on (standby saves nothing) and the TV gets
confused switching inputs when the frontend powers up so we do that manually.

Try eliminating issues like power commands and just test a basic system. Switch
everything on and get the TV to change inputs properly first. You can always add
extras later.

--

Mike Perkins

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-users


dargllun at googlemail

May 11, 2012, 4:52 AM

Post #3 of 4 (404 views)
Permalink
Re: harmony remote and start/stop scripts [In reply to]

On 11.05.2012 12:09, Mike Perkins wrote:
>> # Test to see if XMBC is running first
>> if ps -ef | grep xbmc.bin | grep -v grep

You may want to replace this expression by a simple

if pidof xbmc.bin >/dev/null; then
killall -9 xbmc.bin
fi

This is much more efficient and robust.

--
Regards
greg
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-users


aaron at rb303

May 11, 2012, 7:07 AM

Post #4 of 4 (406 views)
Permalink
Re: harmony remote and start/stop scripts [In reply to]

On Fri, May 11, 2012 at 6:09 AM, Mike Perkins
<mikep [at] randomtraveller>wrote:

> On 11/05/12 01:52, Aaron wrote:
>
>> I am trying to get my Harmony remote to start/stop the mythfrontend to
>> make
>> it simpler for my family to do different things. I am on Mythbuntu 12.04
>> 32bit. I have setup a irexec file, and made sure its running in daemon
>> mode. It all seems to kinda work, but not really sure what I'm missing to
>> make it run 100%. Here are my files, I think I just need another pair of
>> eyes to help me see what I am missing.
>>
>> The parts I can't easily show are I have my Harmony remote set to run two
>> different activities. First one is "Watch TV" , second is "Watch Movies".
>> The watch TV activity is set to use the TV for audio (HDMI); then the
>> movies activity is set to use SPDIF to my receiver. I have it set to send
>> KEY_BLUE and KEY_YELLOW as the power on/off sequence from the remote. I
>> have verified it is sending them with irw.
>>
>> The reason behind all this is my wife seems to get easily confused, so I
>> am
>> trying to eliminate all "hassles" with switching applications. I should
>> mention when I run these scripts by hand they run flawlessly. So I'm not
>> really sure where or why its not running correctly. The results are
>> baffling. If I press "Watch TV" MythTV will pop up then close, then XBMC
>> will open. If I press "Watch Movies" it does the opposite. At first I
>> thought I had the Blue and Yellow wrong in the remote, but I've verified
>> it
>> many times. I have also switched KEY_BLUE and KEY_YELLOW in the irexec
>> file, but it didn't seem to make a difference. Any incite would be much
>> appreciated.
>>
>> ~/.lirc/irexec
>> # MythTV
>> begin
>> remote = mceusb
>> prog = irexec
>> button = KEY_BLUE
>> config = ~/scripts/mythtv_start.sh&
>> end
>>
>> # XBMC
>> begin
>> remote = mceusb
>> prog = irexec
>> button = KEY_YELLOW
>> config = ~/scripts/xbmc_start.sh&
>> end
>>
>> ~/scripts/mythtv_start.sh
>> #!/bin/bash
>> # Test to see if XMBC is running first
>> if ps -ef | grep xbmc.bin | grep -v grep
>> then
>> killall -v -s9 xbmc.bin
>> fi
>> # Now to see if MythTV is running
>> if ps -ef | grep mythfrontend | grep -v grep
>> then
>> # Do nothing
>> echo “MythTV already Running!”
>> else
>> # Startup MythTV
>> mythfrontend
>> fi
>> exit
>>
>> ~/scripts/xbmc_start.sh
>> #!/bin/bash
>> # Test to see if MythTV is running
>> if ps -ef | grep mythfrontend | grep -v grep
>> then
>> killall -v -s9 mythfrontend.re
>> fi
>> # Now to see if XBMC is running
>> if ps -ef | grep -v grep | grep -i xbmc.bin
>> then
>> # Do nothing
>> echo “XBMC already Running!”
>> else
>> # Startup XBMC
>> xbmc
>> fi
>> exit
>>
>> You don't say which model of Harmony remote. That might be significant.
>
> I would add this comment, based on my own experiences: Make sure that both
> the Harmony and *all* your devices are in the same, known, consistent state
> before you do any testing. Harmony remotes have an internal idea of what
> state each device is supposed to be in; if for example something is powered
> up when the remote thinks it should be off (or vice versa) then it is very
> easy to get into a confused state.
>
> My system is a Harmony 600, TV, cable box, mythtv front end and DVD
> player. Currently I don't allow the remote to control the power on the
> cable box or the front end. The cable box is always on (standby saves
> nothing) and the TV gets confused switching inputs when the frontend powers
> up so we do that manually.
>
> Try eliminating issues like power commands and just test a basic system.
> Switch everything on and get the TV to change inputs properly first. You
> can always add extras later.
>
> --
>
> Mike Perkins
>
> ______________________________**_________________
> mythtv-users mailing list
> mythtv-users [at] mythtv
> http://www.mythtv.org/mailman/**listinfo/mythtv-users<http://www.mythtv.org/mailman/listinfo/mythtv-users>
>

Thank you, I have a harmony one. I did eliminate the power commands last
night and it's working as designed now. When I was watching the output from
irw I noticed it would re-send the KEY_BLUE after all the other commands so
I told the remote to leave the devices (xbmc and mythtv) on at all times;
disable power commands. Then I realized from the irw output that I could
just use the switch input keys that the remote was sending (now I use RecTV
for MythTV and KEY_HOME for XBMC). Now everything is working perfectly. I
did disable the corresponding keys on each action, so MyhTV no longer has a
media key (KEY_HOME) and xbmc doesn't have RecTV key. I did this just so
they don't press it and get everything confused.

I have two activities one Watch TV and then Watch Movies, the wife and kids
are very happy.

Thanks Greg G. I will try that!

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.