-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSmart-Blind-IoT.py
77 lines (63 loc) · 2.43 KB
/
Smart-Blind-IoT.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# python3.6
# ----------------------------------------------------------------------------------
#
# `_` `_,_` _' `,`
# -#@@- >O#@@@@u B@@> 8@E
# :)ilc}` `=|}uccccVu}r" VQz `@@#Mhzk= |8M `=v}ucccccuY), `~v}uVVcccccV#@$
# ^Q@#EMqK.I#@QRdMqqMdRQ@@Q, Q@B `@@BqqqW^ W@@` e@@QRdMMMMbEQ@@8: i#@BOMqqqqqqqM#@$
# D@@` )@@x <@@T Q@B `@@q W@@`>@@l :@@z`#@d Q@$
# D@# ?@@@##########@@@} Q@B `@@q W@@`^@@@##########@@@y`#@W Q@$
# 0@# )@@d!::::::::::::` Q@B `@@M W@@`<@@E!::::::::::::``#@b `B@$
# D@# `m@@#bGPP} Q@B `@@q W@@` 3@@BbPPPV y@@QZPPPPPGME#@8=
# *yx .*icywwv )yv }y> ~yT .^icywyL .*]uywwwwycL^-
#
# (c) 2021 Reified Ltd. W: www.reified.co.uk E: [email protected]
#
# ----------------------------------------------------------------------------------
#
# Present a stepper motor, driven by the Adafruit Stepper Motor Bonnet on a
# Raspberry Pi, as an IoT device over MQTT, controllable and monitorable via MQTT
# messages when connected to a MQTT broker.
#
#
# ----------------------------------------------------------------------------------
import logging
import SmartBlindController
import MQTTSmartBlind
import time
import sys
####################################################################################
#
# run()
#
####################################################################################
def run():
logging.basicConfig(
format = '%(asctime)s %(levelname)s %(message)s',
datefmt = '%Y/%m/%d %H:%M:%S',
handlers = [
# logging.FileHandler("Smart-Blind-IoT.log"),
logging.StreamHandler()
]
)
controller = MQTTSmartBlind.MQTTSmartBlind(
host = '192.168.1.159',
blindNo = 1,
topicBase = 'smarthome',
loggingLevel = logging.DEBUG
)
# controller2 = MQTTStepperMotorKit.MQTTStepperMotorKit(
# host = '192.168.1.159',
# stepperNo = 2
# )
try:
controller.run()
except:
print("ERROR: ", sys.exc_info()[0], "occurred.")
####################################################################################
#
# main
#
####################################################################################
if __name__ == '__main__':
run()