feat(tv-remote-control): add Samsung TV remote control program

- Add `program.py` implementing async MDC client to manage TV power state and display ID
- Add `requirements.txt` with `python-samsung-mdc` dependency
This commit is contained in:
2026-06-19 12:00:57 +02:00
parent 5020d2c288
commit a6e93564ba
2 changed files with 29 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import asyncio
from samsung_mdc import MDC
async def main(ip, display_id):
async with MDC(ip, verbose=True) as mdc:
# First argument of command is always display_id
status = await mdc.status(display_id)
print(status) # Result is always tuple
if status[0] != MDC.power.POWER_STATE.ON:
# Command arguments are always Sequence (tuple, list)
await mdc.power(display_id, [MDC.power.POWER_STATE.ON])
await mdc.close() # Force reconnect on next command
await asyncio.sleep(15)
await mdc.display_id(display_id, [MDC.display_id.DISPLAY_ID_STATE.ON])
# You may also use names or values instead of enums
await mdc.display_id(display_id, ['ON']) # same
await mdc.display_id(display_id, [1]) # same
if True:
await mdc.power(display_id, [MDC.power.POWER_STATE.OFF])
await mdc.close() # Force reconnect on next command
# If you see "Connected" and timeout error, try other display_id (0, 1)
asyncio.run(main('10.184.27.132', 1))
+1
View File
@@ -0,0 +1 @@
python-samsung-mdc