A Homebridge plugin to control BenQ Projector via RS232 Serial Port and OpenWrt.
- Power toggle
- Mute toggle
- Eco Blank (dim the display) toggle
- A BenQ Projector
- A RS232 to USB adapter (Prolific PL2303 chip recommended)
- A RS232 crossover (null modem) cable
- An OpenWrt router with USB port
- An existing home network (wired or wireless)
Run firstboot
on the OpenWrt to get an clean reset.
# opkg install coreutils coreutils-stty kmod-usb-serial kmod-usb-serial-pl2303 libpthread librt socat
$ scp ./openwrt/fs/root/pctrl.sh root@ip-of-openwrt:/root/
$ scp ./openwrt/fs/www/cgi-bin/pctrl root@ip-of-openwrt:/www/cgi-bin/
# vim /etc/rc.local
Add
# Keep responding to multicast diagrams
while true; do socat UDP4-RECVFROM:2367,ip-add-membership=224.33.66.77:0.0.0.0,fork EXEC:"echo \"mac_address: $(cat /sys/class/net/eth0/address)\""; sleep 1; done &
exit 0
Refer to the OpenWrt Wiki.
Ensure the IP address of OpenWrt router is accessible from the main router network.
Test the following URLs on your computer connected to the main router network:
- get status: http://ip-of-openwrt/cgi-bin/pctrl/pow/%3F
- turn on: http://ip-of-openwrt/cgi-bin/pctrl/pow/on
- turn off: http://ip-of-openwrt/cgi-bin/pctrl/pow/off
Refer to Homebridge repo for more information.
$ sudo npm install -g homebridge # see also: https://github.com/nfarina/homebridge
$ git clone https://github.com/gaomd/homebridge-serial-projector.git
$ cd homebridge-serial-projector
$ npm install
{
"bridge": {
"//0": "Remove this line and refer to: https://github.com/nfarina/homebridge/blob/master/config-sample.json"
},
"accessories": [
{
"accessory": "SerialProjector",
"name": "TV", "//0": "required, default to TV (the {name})",
"power_switch_name": "TV Power", "//1": "optional, default to {name} Power",
"speaker_switch_name": "TV Speaker", "//2": "optional, default to {name} Speaker",
"display_switch_name": "TV Display", "//3": "optional, default to {name} Display",
"mac_address": "mac address of openwrt"
}
]
}
$ homebridge -D -P /path/to/homebridge-serial-projector
Open the Home app on your iOS device.