mirror of
https://github.com/korneliuszo/lumiax-controller.git
synced 2026-03-28 19:22:33 +01:00
23 lines
558 B
Python
Executable File
23 lines
558 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import tlay2_client
|
|
import struct
|
|
|
|
def send_onoff(state):
|
|
a=tlay2_client.Tlay2_msg(1)
|
|
a.msg(struct.pack("?",state))
|
|
|
|
if __name__ == "__main__":
|
|
import argparse
|
|
parser = argparse.ArgumentParser(description='Control power')
|
|
|
|
group = parser.add_mutually_exclusive_group()
|
|
group.add_argument('-1', '--on', action='store_true')
|
|
group.add_argument('-0', '--off', action='store_true')
|
|
|
|
args = parser.parse_args()
|
|
|
|
if args.on:
|
|
send_onoff(True)
|
|
if args.off:
|
|
send_onoff(False) |