def process(topic, msg): global Repmsg for i in range(0, len(Repmsg)): if Repmsg[i]['listenfor'] == topic: if Repmsg[i]['whenmsg'] == msg: clees_mqtt.publish(Repmsg[i]['sendto'], Repmsg[i]['withmsg'])
def send_output_deactivated(i): global Outputs topic = clees_mqtt.gettopicstr('rep', 'o', Outputs[i]['id']) clees_mqtt.publish(topic, 'deactivated') return (0)
def send_turnout_thrown(i): global Turnouts topic = clees_mqtt.gettopicstr('rep', 't', Turnouts[i]['id']) clees_mqtt.publish(topic, 'thrown') return (0)
def send_turnout_changing(i): global Turnouts topic = clees_mqtt.gettopicstr('rep', 't', Turnouts[i]['id']) clees_mqtt.publish(topic, 'changing') return (0)
def send_button_deactivated(i): global Buttons topic = clees_mqtt.gettopicstr('rep', 'b', Buttons[i]['id']) msg = 'deactivated' clees_mqtt.publish(topic, msg) return (0)