To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Jamie Balfour'sPersonal blog

ZPE 1.10.10 will be released today at some point, and the headline feature is MQTT support. 

In case you didn't know, MQTT is built upon the TCP/IP stack and is intended for direct communication in the form of a publish and subscribe system. ZPE now has the ability to publish (not subscribe yet) messages to an endpoint and is fairly straightforward to use (unlike the underlying implementation). 

To use MQTT in ZPE, one uses the MQTT object which encapsulates several built-in functions (connect and publish). More will be published after the release today on using MQTT.

You could write the following code (assuming you have cached values already setup):

YASS
$topic = "comms"
$message = "Hello world!"
$mqtt = new MQTT()
$mqtt->connect("192.168.1.2", 1883, read_cache_value("MQTT_USER"), read_cache_value("MQTT_PASS"))
$mqtt->publish($topic, $message
Powered by DASH 2.0 (beta)
Code previewClose