Skip to content

Commit 1042690

Browse files
abmantisCopilot
andauthored
feat: add LG TV codes (#4)
Required for home-assistant/core#162359 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3dbe7be commit 1042690

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

infrared_protocols/codes/__init__.py

Whitespace-only changes.

infrared_protocols/codes/lg/tv.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"""Command codes for LG TVs."""
2+
3+
from enum import IntEnum
4+
5+
from ...commands import Command, NECCommand
6+
7+
8+
class LGTVCode(IntEnum):
9+
"""LG TV IR command codes."""
10+
11+
BACK = 0x28
12+
CHANNEL_DOWN = 0x01
13+
CHANNEL_UP = 0x00
14+
EXIT = 0x5B
15+
FAST_FORWARD = 0x8E
16+
GUIDE = 0xA9
17+
HDMI_1 = 0xCE
18+
HDMI_2 = 0xCC
19+
HDMI_3 = 0xE9
20+
HDMI_4 = 0xDA
21+
HOME = 0x7C
22+
INFO = 0xAA
23+
INPUT = 0x0B
24+
MENU = 0x43
25+
MUTE = 0x09
26+
NAV_DOWN = 0x41
27+
NAV_LEFT = 0x07
28+
NAV_RIGHT = 0x06
29+
NAV_UP = 0x40
30+
NUM_0 = 0x10
31+
NUM_1 = 0x11
32+
NUM_2 = 0x12
33+
NUM_3 = 0x13
34+
NUM_4 = 0x14
35+
NUM_5 = 0x15
36+
NUM_6 = 0x16
37+
NUM_7 = 0x17
38+
NUM_8 = 0x18
39+
NUM_9 = 0x19
40+
OK = 0x44
41+
PAUSE = 0xBA
42+
PLAY = 0xB0
43+
POWER = 0x08
44+
POWER_ON = 0xC4
45+
POWER_OFF = 0xC5
46+
REWIND = 0x8F
47+
STOP = 0xB1
48+
VOLUME_DOWN = 0x03
49+
VOLUME_UP = 0x02
50+
51+
52+
def make_command(code: LGTVCode, repeat_count: int = 0) -> Command:
53+
"""Get the NECCommand for an LG TV IR code."""
54+
return NECCommand(
55+
address=0xFB04, command=code, modulation=38000, repeat_count=repeat_count
56+
)

0 commit comments

Comments
 (0)