MQTT how to start

I want to experiment how MQTT works. But it is a big black box for me. I know that mqtt is a protocol. You need a broker(server) to use this protocol. I thought that a device is a MQTT client. But when I search the store I find different apps. Which do i need and what can I do with it.

The first things i wanted to try is how i can manage a device f.i. a Sonos speaker or a Hue bulb.

Second i want to try to get weather data from openweather with MQTT and how can i get the data into a variable.

Would be nice to get some help and some examples.

The topic for the MQTT app is so huge that it is a little to much in the beginning.

Hi,

If i’m not mistaken you need all components

MQTT Client is needed to receive MQTT messages
MQTT Hub is needed to be able to send MQTT messages

MQTT Broker is more like the Server, it doesn’t have to run on Homey, can also run on external system.

1 Like

So i can install f.i mosquitto broker on my NAS
Install, mosquitto MQTT client on Homey. How can my NAS communicate back to Homey. Must you install a Mosquitto client on your NAS, and which one?

You only fundamentally need the client on Homey and the broker on your NAS. You don’t need a client on the NAS.

However It is likely you will also want MQTT hub on Homey to do useful and interesting things with your Homey devices

Installing MQTT Explorer (somewhere on a PC) is highly recommended as it allows you to see what is being sent to the MQTT

1 Like

I have everything running. Mqtt client, hub and mosquitto on my server. Mqtt explorer is showing this


How do I retrieve this information in Homey?

Add a new MQTT device using MQTT auto discovery? MQTT device & auto discovery are available in the beta/test version of MQTT hub app.

If I don’t want to use the MQTT- Hub on Homey, only the MQTT client.
Now I want to switch a device ON via a flowcard:
image

image

Wat exactly should my entry in “Bericht” have to be for switch:0 ?

Possibly send payload on to shellyplus2pm-b48xxx/command/switch:0, but the Shelly thread might be a better place to discuss Shelly MQTT specifics.


I would like to know what I should fill in here so that I receive a message or notification when the charging station turns on or off.
Schermafbeelding 2024-02-09 212423

1 Like

I have quite some experience in working with MQTT and have a broker running on my NAS. In this way I can exchange information of a bunch of devices with Nodered flows that also run on my NAS.

I just managed to install the MQTT client (by Menno van Grinsven) on my Homey Pro (2023). I try to use it in a flow, but I don’t see any flowcards that return the contents (payload) of a received message! Without access to the payload MQTT becomes less useful.

Anyone knows how to get hold on the message payload?

It’s available as a tag:

1 Like

Thanks Robert ! In the mean time I discovered usage of tags!

Now that I have my data (heatpump duct temperatures), I want to create graphs. Is it possible in some way to transfer the tag data to Insights?

You can save numeric data to logic numeric variables, their values are shown in insights.

1 Like

Can you please give a hint how to do that. Maybe a link where I can read and learn?

Meanwhile I will check if my data is numeric. If not, convert it to numeric and then look if I see some clues in the flow environment.

Success! Once I convert the message text (using a logic flowcard) to a numeric value (#Result) an entry Logic Tvalue appears in the Insights menu. Great!

1 Like

The trick to get to the “Message received“ is sometimes the connection between the cards.

1 Like

I have quite some experience with Nodered. That helps.

The docs for Homey are quite thin/poor…

But luckily, the “community” over here is pretty responsive! Are there other locations where the Homey community is active?