File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212OUTLET_STATE_TOPIC = "funhouse/outlet/state"
1313OUTLET_COMMAND_TOPIC = "funhouse/outlet/set"
1414MOTION_TIMEOUT = 300 # Timeout in seconds
15+ USE_MQTT = True
1516
1617try :
1718 from secrets import secrets
@@ -32,7 +33,7 @@ def set_outlet_state(value):
3233 publish_outlet_state ()
3334
3435def publish_outlet_state ():
35- if OUTLET_STATE_TOPIC and OUTLET_COMMAND_TOPIC :
36+ if USE_MQTT :
3637 funhouse .peripherals .led = True
3738 output = "on" if outlet .value else "off"
3839 # Publish the Dotstar State
@@ -88,7 +89,7 @@ def timeleft():
8889funhouse .splash .append (status )
8990
9091# Initialize a new MQTT Client object
91- if OUTLET_STATE_TOPIC and OUTLET_COMMAND_TOPIC :
92+ if USE_MQTT :
9293 funhouse .network .init_mqtt (
9394 secrets ["mqtt_broker" ],
9495 secrets ["mqtt_port" ],
@@ -112,4 +113,5 @@ def timeleft():
112113 set_outlet_state (False )
113114 funhouse .set_text (timeleft (), countdown_label )
114115 # Check any topics we are subscribed to
115- funhouse .network .mqtt_loop (0.5 )
116+ if USE_MQTT :
117+ funhouse .network .mqtt_loop (0.5 )
You can’t perform that action at this time.
0 commit comments