-
Notifications
You must be signed in to change notification settings - Fork 15
MQTT Events Flow
The MQTT flow is as follows:
Smartthings events are generated from attributes - both standard and custom.
You may choose to define custom attriutes for handling functionality beyond standard attributes - e.g combo devices or more functional tiles
Within the MBS - SmartApp you describe a capability map and specify which attribute(s) (and corresponding event(s)), the SmartApp will subscribe to.
For every event Smartthings generates a [device][attribute][command] event package that the SmartApp is subscribed to and sends it to the mbs-server.
The devices.yml config file maintains a mapping of [device][attribute][command] to the MQTT [topic][payload] to be published.
Once the server receives the event from Smartthings, if the device is in the (devices.yml) config file it uses the mapping to publish to MQTT broker.
If the device is not in the device config file it publishes a message {PREFACE}/{DEVICE_NAME}/${ATTRIBUTE}/SUFFIX
On the flip side, when the server receives an MQTT message from the broker, it checks the device config file (device.yml) for mapping of [topic][payload] to [device][attribute][command] and sends the command back to Smartthings.
If device is not found it follows the flow xxx.
Smartthings MBS-SmartApp maintains mappings for each capability of what attribute[event] to subscribe (for publishing to MQTT Broker) and what action method to call for an event received form the MQTT broker via the MBS-Server. See _smartapp.example.md