-
Notifications
You must be signed in to change notification settings - Fork 0
/
switchSocket.py
46 lines (34 loc) · 1.17 KB
/
switchSocket.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
import cRcSocketSwitch
import logging
parser = argparse.ArgumentParser(
prog = 'switchSocket',
description = 'Switches an 433 MHz remote socket device',
epilog = 'shows this help information')
parser.add_argument('SystemCode', metavar = 'SystemCode', type = str,
help="SystemCode of device")
parser.add_argument('ButtonCode', type = str,
help="Buttoncode of device")
parser.add_argument('status', type = int,
help="Status of device (on/off)")
args = parser.parse_args()
parser.parse_args()
logging.info(args)
# set gpio pin
gpio_pin = 17
# values for on
values1 = (args.SystemCode, args.ButtonCode, args.status)
# values for off just for testing
values2 = (args.SystemCode, args.ButtonCode, not args.status)
if __name__ == '__main__':
try:
# create Brennenstuhl RCS1000N object
obj = cRcSocketSwitch.RCS1000N(gpio_pin)
cRcSocketSwitch.RCS1000N.sanity_check_Systemcode('10000')
cRcSocketSwitch.RCS1000N.sanity_check_Buttoncode('A')
# prepare and send values
obj.send(*values1)
finally:
pass