AntonioMeireles / homebridge-vieramatic

Homebridge plugin for Panasonic™ Viera™ TVs (includes support for 2018 and later models)
Apache License 2.0
43 stars 9 forks source link

Add new feature to include a custom command config to turn old TV on #108

Open CyberMrProper opened 1 year ago

CyberMrProper commented 1 year ago

I have an old Panasonic TV that does not have wake on lan functionality. Once the TV is turned on (with the physical remote), the plugin works flawless. Given that I have an IR blaster, it would be great if this plugin could include a fallback mechanism to execute a command line script if "turns on" fails.

[Panasonic TV] (setPowerStatus)/-> ON - unable to power cycle TV - unpowered ?

Then run command line from config.

CyberMrProper commented 1 year ago

var exec = require('child_process').exec;

In here https://github.com/AntonioMeireles/homebridge-vieramatic/blob/b40d36488e5cdd8e2c096f9b0601d351da6785af/src/accessory.ts#L433

it could be something like:

else if (nextState === this.Characteristic.Active.ACTIVE && this.userConfig.customTurnOnCommand){ exec(this.userConfig.customTurnOnCommand); await sleep(1000) await this.updateTVstatus(nextState) }

@AntonioMeireles thoughts?

zobe123 commented 1 year ago

i was just thinking the same thing, would be a cool feature.

I can turn on the tv indirectly via a URL. (Enigma2 STB -> turns TV ON)