MAIN """ if __name__ == "__main__": # MQTT connection parameters client.on_connect = on_connect client.on_disconnect = on_disconnect client.on_message = on_message client.on_log = on_log client.on_publish = on_publish # Topics to subscribe client.subscribe("eschbornoffice/things/{}/uplink".format(parkEUI1)) client.subscribe("eschbornoffice/things/{}/uplink".format(parkEUI2)) client.subscribe("eschbornoffice/things/{}/uplink".format(parkEUI3)) client.subscribe("eschbornoffice/things/{}/uplink".format(parkEUI4)) #Initaliaze Memcached init_memcache_parkingstatus() # Bot commands bot.set_help_message("Hi! I will automatically notify you if one parking space is still available or all are occupied. You can also ask me, see commands below. More information: https://fkf3parking.devnetcloud.com:\n") bot.remove_command("/echo") bot.add_command("/c", "Get the current parking status", getc) #bot.add_command("/r", "Remove the bot from the current room", removebot) bot.add_new_url("/wc", "website-current", wc) # Start MQTT client and run bot client.loop_start() bot.run(host="0.0.0.0", port=999)
''' config_dict = xmltodict.parse(config) # most basic differentiation of the user's command. if incoming_msg.text == "/changeint4 enable": netconf_reply = m.edit_config(target='running', config=config) return "Int4 was successfully enabled." elif incoming_msg.text == "/changeint4 disable": config_dict["config"]["interfaces"]["interface"]["enabled"] = "false" config = xmltodict.unparse(config_dict) netconf_reply = m.edit_config(target='running', config=config) return "Int4 was successfully disabled." else: return "Wrong command, please try again." if __name__ == "__main__": # Add new commands to the box. bot.add_command("/getinfo", "Get basic device information", getinfo) bot.add_command("/getallinterfaces", "Get information from all interfaces", getallinterfaces) bot.add_command("/changeint4", "disable or enable Interface 4: e.g. /changeint4 disable", change_interface4) bot.remove_command("/echo") bot.set_help_message( "Welcome to the IoT Config Bot! You can use the following commands:\n") # Run Bot bot.run(host="0.0.0.0", port=5000)