CloudMQTT test, free online MQTT broker. Control Domoticz with the JSON API

cloudMQTT is a free online MQTT broker for 5 simultaneous connections. In this tutorial, we will take the opportunity to use cloudMQTT to control a Domoticz home automation server. Domoticz has a JSON API that allows you to control home automation accessories and retrieve states using the MQTT protocol. The MQTT protocol has been designed for this type of application! There is no special configuration to do on the Domoticz server, other than configuring the connection parameters to the MQTT broker. Other free brokers are listed here.

 

Using a free online broker such as cloudMQTT, you can control all your devices from the internet without having to expose your server!

Create a free MQTT broker on cloudMQTT

cloudMQTT is a broker (server ) MQTT online that offers a free offer. The free offer is limited to 5 simultaneous connections but it is more than enough for personal use. You will find other free online brokers here.

Create a free account on cloudMQTT. You will just need an email. Once logged in, click Create New Instance.

1 cloudmqtt create instance

Give a name to your instance and continue

cloudmqtt instance domoticz mqtt

Select the Cute Cate plan which is free (but limited to 5 simultaneous connections). Continue by clicking on Select Region.

 cloudmqtt plan prix

cloudMQTT uses Amazon AWS servers to function. You can choose the server on which your data will transit. Here, they will go through Ireland. Do not worry, the choice has little impact on the performance of your connection. Amazon AWS is a cloud leader…

Finish with Review

cloudmqtt localisation serveur aws

Finalize the creation of the instance on the next page by clicking Create Instancecloudmqtt create instance domoticz homy

The new instance is added to the list.

cloudmqtt instance domoticz created

Click on the name of the instance to open the connection parameters:

  • Server: the login domain name
  • User and password
  • Several ports are available

cloudmqtt mqtt instance info connexion

Configure the MQTT connection on Domoticz

Open the hardware list and add MQTT Client Gateway with Lan Interface hardware. Enter the parameters of cloudMQTT

  • Click on activate
  • address: the one indicated in the instance
  • port: here the 16338 but it can be different for you
  • user and password:
  • Topic : choose out by preference

Close by Add

cloudmtt domoticz mqtt connexion configuration

Note. The MQTT plugin for Domoticz does not support (for the moment I hope) the exchange of MQTT messages via a secure and encrypted connection. You must therefore connect to the standard port. The connection via the SSL port will lead to a connection failure.

Check that Domoticz is correctly connected to cloudMQTT

To find out whether Domoticz has connected to cloudMQTT correctly, just open the log. If this is not the case, change the port

domoticz check cloudmqtt mqtt connexion ok

Test the connection from cloudMQTT Now that everything is close, go back to cloudMQTT and open the Websocket UI. With this tool, you can view in real time all MQTT messages exchanged on the cloudMQTT broker and send messages on a particular topic. It’s great to do tests and debugging 🙂

test websocket mqtt domoticz cloudmqtt

For example, try sending a message on the domoticz / in topic to turn off an RGB bulb (here, the IDX 24)

{"type":"command","param":"udevice","idx":24,"nvalue":0,"svalue":"off"}

Domoticz executes the command and returns a message with the new state of the device. Everything works perfectly

cloudmqtt check websocket ui message send receive domoticz

You can also track in the log the received messages (and any errors)

domoticz check log mqtt message in

All the specifications of the JSON API via MQTT messages on the official documentation here. Moreover, it is with this interface that I use to communicate with Domoticz from Homy. Of course, this tutorial is not limited to Domoticz, you can use cloudMQTT for all your DIY projects based on Arduino, ESP8266, ESP32, Raspberry Pi …. Ultra fast, secure, super simple to set up AND free …. why not use it 🙂

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

Tags:

We will be happy to hear your thoughts

Leave a Reply

DIY Projects
%d bloggers like this: