Basic Sony TV switch on or Off using HDMI-CEC
Install needed package:
Check connected devices
1pi@raspberrypi:~ $ echo 'scan' | cec-client -s -d 1
2opening a connection to the CEC adapter...
3requesting CEC bus information ...
4CEC bus information
5===================
6device #0: TV
7address: 0.0.0.0
8active source: no
9vendor: Sony
10osd string: TV
11CEC version: 1.4
12power status: on
13language: eng
14
15
16device #1: Recorder 1
17address: 3.0.0.0
18active source: no
19vendor: Pulse Eight
20osd string: CECTester
21CEC version: 1.4
22power status: on
23language: eng
From the above, the Sony TV has address 0.0.0.0
.
Turn-on:
Turn-off:
Get status:
Explore:
See details in https://pimylifeup.com/raspberrypi-hdmi-cec/