Difference between revisions of "MQTT Interface"

From Hubitat Documentation
Jump to: navigation, search
(Created page with "=Overview= '''NOTE: This interface is in alpha status and is liable to change. Once sufficient feedback has been received it will be finalized and the method names will chang...")
 
(Replaced content with "<big>'''We're moving!''' Please visit http://docs2.hubitat.com for the latest documentation.</big> <big> This document is available at: http://docs2.hubitat.com/en/develo...")
(Tag: Replaced)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Overview=
+
<big>'''We're moving!''' Please visit http://docs2.hubitat.com for the latest documentation.</big>
'''NOTE: This interface is in alpha status and is liable to change.  Once sufficient feedback has been received it will be finalized and the method names will change.''' Hubitat allows for opening and maintaining a connection to an MQTT broker from the hub. All code needs to be contained in a driver, there is no option to open an MQTT client connection from an app. Hubitat provides methods to connect and disconnect to the broker, subscribe and publish messages to topics. In addition it is required to create a method in the driver that accepts incoming messages (parse) and another method that will be called with any status updates for the client connection (mqttClientStatus).
 
  
=Methods=
+
<big>
 
+
This document is available at: http://docs2.hubitat.com/en/developer/interfaces/mqtt-interface
==Hubitat Provided Methods==
+
</big>
 
 
===<code>mqttConnect</code>===
 
 
 
:;Signature
 
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password)</code>
 
 
 
:;Parameters
 
:: device - The current device that is calling the method.
 
:: broker - The url of the broker to connect to.
 
:: clientId - The client id to use when connecting to the broker.
 
:: username - The username to use when connecting to the broker, use null if no username is necessary.
 
:: password - The password to use when connecting to the broker, use null if no password is necessary.
 
 
 
===<code>mqttDisconnect</code>===
 
 
 
:;Signature
 
 
 
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttDisconnect(DeviceWrapper device)</code>
 
 
 
:;Parameters
 
:: device - The current device that is calling the method.
 
 
 
==User defined methods==
 
 
 
: '''<code>parse(String message)</code>'''  - This method is called with any incoming messages from the subscribed topics of the MQTT broker. This is a standard method for drivers.
 
 
 
: '''<code>mqttClientStatus(String message)</code>''' - This method is called with any status messages from the MQTT client connection (disconnections, errors during connect, etc)
 

Latest revision as of 19:47, 25 September 2022

We're moving! Please visit http://docs2.hubitat.com for the latest documentation.

This document is available at: http://docs2.hubitat.com/en/developer/interfaces/mqtt-interface