Thursday, November 30, 2017

Controlling an LG soundbar

As part of my home automation configuration, I wanted to figure out how to control my soundbar.

Seems it's not documented, there isn't an API, but there is an Android App.  So I installed Genymotion, set the nic to be bridged and used wireshark to sniff what the app was doing.  I saw udp packets for each key, so copied the data, and used it like this....

Mute: 080312002a0808011204081a1002 followed by 080312002a0808011204081a1001 
Vol down: 080312002a080801120408191002 then 080312002a080801120408191001
Vol up: 080312002a080801120408181002 then 080312002a080801120408181001
Power off: 080312002a080801120408011002 then 080312002a080801120408011001 
switching inputs (optical/bluetooth/home):  080312002a0808011204084d1002 then 080312002a0808011204084d1001

So, to send this udp data to a sound bar at 1.2.3.4 address 

echo "080312002a080801120408011002" | xxd -r -p > /dev/udp/1.2.3.4/9741 

netcat seemed quite slow for some reason

No comments: