This library provides quick setup of a MQTT connection to MQTT brokers.
By default, Yombo starts up an MQTT broker that other devices can connect to. The user can also configure the gateway to use another MQTT broker, however, modules do not need to worry about that. Simply using self.mqtt_connection = self._MQTT.new(mqtt_incoming_callback=self.mqtt_incoming, client_id='myModuleName') within your module will connect the the system defined MQTT broker.
The Gateway starts an MQTT broker (aka server) that allows clients to subscribe to topics or send messages (commands, status updates, etc). A topic is something the client is interested in, for example, it might want to know when states change, when devices have status changes, etc. By default, the MQTT broker started by the Gateway only allows local connections and requires a username/password. See below for details on adding more users. The MQTT library also acts like a client. It allows other modules to connect to any MQTT client (including the broker it started) to send commands or receive topic messages. For example, the device's library will connect to the MQTT broker to listen for requests to change device status (such as turning on/off lights). The States and Atoms libraries will connect to the broker to publish any changes and receive requests to make changes.
- Internet of Things (IoT) - Interact with the gateway in real-time.
- Gateway Communications - Responsible for handling IoT interactions and gateway cluster communications.
- For detailed python interactions and more examples, see: MQTT @ Yombo Python API Docs
- Getting started with AMQP @ RabbitMQ
No hooks registered.
Defined MQTT Topics
Yombo uses the following topics. Developers are free to use any topic desired, however, see suggestions below.
- yombo - The primary yombo topic. Most other yombo items will stem from this.
- devices - The devices library can accept command requests, status requests here. It also uses this topic branch for broadcasting updates. See below for details.
- states - State changes will be broadcast as
Connecting, broadcasting, and listening
Modules wishing to connect the the MQTT broker, and simply use the MQTT library as such: self.mqtt_connection = self._MQTT.new(mqtt_incoming_callback=self.mqtt_incoming, client_id='myModuleName')