Here we go!

First of all, my lirc configuration for the toshiba TV power button, manually adjusted to the proper NEC timings:

begin remote

name Toshiba bits 16 flags SPACE_ENC eps 25 aeps 100

header 9000 4500 one 560 560 zero 560 1690 ptrail 560 repeat 9000 2250 pre_data_bits 16 pre_data 0xfd02 gap 42580 frequency 38000

  begin codes
      Power                    0x000000000000b748
  end codes

end remote

Next up my “tvon” script, which uses the “i2cget” program from i2c-utils:

#!/bin/sh

I2C_BUS=2

i2cget -f -y $I2C_BUS 0x3a 0x00 b > /dev/null 2>&1 TVSTATUS=$?

if [ $TVSTATUS != 0 ]; then irsend SEND_ONCE Toshiba Power irsend SEND_ONCE Toshiba Power irsend SEND_ONCE Toshiba Power fi

And finally my “tvoff” script, which uses the “i2cget” program from i2c-utils:

#!/bin/sh

I2C_BUS=2

i2cget -f -y $I2C_BUS 0x3a 0x00 b > /dev/null 2>&1 TVSTATUS=$?

if [ $TVSTATUS == 0 ]; then irsend SEND_ONCE Toshiba Power irsend SEND_ONCE Toshiba Power irsend SEND_ONCE Toshiba Power fi