[mythtv-users] Checking power status of STB

Daryl McDonald darylangela at gmail.com
Fri Oct 31 21:48:53 UTC 2014


On Fri, Oct 31, 2014 at 4:11 PM, Tom Lichti <tom at redpepperracing.com> wrote:

> On Fri, Oct 31, 2014 at 3:47 PM, Justin Alcorn <justin at jalcorn.net> wrote:
>
>> On Fri, Oct 31, 2014 at 3:43 PM, Andrew C. (AFPup) Stadt
>> <acstadt at stadt.ca> wrote:
>> >
>>
>> >> My setup: TWC with Cisco STB. Ubuntu 14.04.1 and MythTV 0.28
>> >>
>> > I used to do something like that though I was doing something like R.G.
>> > suggested to see if the tuner was in use, and if not then running the
>> > script.  I (accidently) discovered one day that my STB also supported
>> the
>> > same ir command set as dish network boxes, and that the dish commands
>> > included a discrete power-on command (versus power toggle). So, just
>> made my
>> > channel change command include a power-on command first.
>> >
>> > Just something to think about.
>>
>> I spent a bunch of time trying to find a power-on command for my STB.
>> No such luck.
>>
>>
> Even though I record my SA4250 via an HD-PVR, I can send the power-on
> through firewire, so that's what I do in my channel change script, as I did
> not find a discrete 'power on' message via IR, it is a toggle. If I could
> find a power on only IR command, then I'd use that.
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org


This is the script I use to check my stb, its toggle power:

 #! /bin/bash

# Authored by Evuraan_AT_gmail_DOT_com

# ABSOLUTELY NO WARRANTY, to the extent permitted by
# applicable law.

# YMMV.
# Use at your own risk.


lirc_socket="/var/run/lirc/lircdSerial"
pvr="/dev/videopvr150"
t="$RANDOM-$RANDOM"
out="/tmp/$t.mpg"
mark="1727"
blank="0"
say="/usr/bin/logger -p info -t mythstb-check"
POWEROFF="0"
POWERON="0"
#wakeup="/usr/bin/irsend SEND_ONCE DCT700 POWER"
wakeup="/usr/bin/irsend -d ${lirc_socket} SEND_ONCE DCT700 POWER"
#info="/usr/bin/irsend SEND_ONCE DCT700 info"
info="/usr/bin/irsend -d ${lirc_socket} SEND_ONCE DCT700 info"



send_power_on() {
$say "`date` STB seems to be turned off, last count was $blank, attempting
to Power it on" &
$wakeup 1>/dev/null 2>/dev/null || :
sleep 2
}

scan_images(){
for i in `echo /tmp/$t*.jpeg`
do
if [ -s "$i" ]
then
#blank="`jp2a $i --invert --size=72x24 | sed -e 's/./& \n/g'|grep -c "M"`"
blank="`jp2a $i --invert --size=72x24 | sed 's/W/M/g' | sed -e 's/./&
\n/g'|grep -c "M"`"
 rm -f "$i" 1>/dev/null 2>/dev/null || :
else
 :
fi
[ "$blank" -gt "$mark" ] && export POWERON="100"
[ "$blank" -le "$mark" ] && export POWEROFF="100"
done
if [ "$POWERON" -eq "100" -a "$POWEROFF" -ne "100" ]
then
# its off
send_power_on
else
# power is on, non blank frames
$say "`date` STB seems to be turned on, last count was $blank"
:
fi

}

purge_stuff(){
[ -f "$out" ] && rm -f "$out" 1>/dev/null >/dev/null || :
}

#ivtv-tune -c 3 -d "$pvr" 1>/dev/null 2>/dev/null &

cd /tmp
$info &

dd if="$pvr" of="$out" bs=64K count=2  1>/dev/null 2>/dev/null

if [ -s "$out" ]
then
ffmpeg -i $out -f image2 -vcodec mjpeg /tmp/$t%d.jpeg 1>/dev/null
2>/dev/null
[ -s "/tmp/${t}1.jpeg" ] && scan_images
else
$say "`date` Unable to query $pvr, as it seems to be in use."
:
fi

purge_stuff &


and it is called by the channel change script.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20141031/1b876cd0/attachment.html>


More information about the mythtv-users mailing list