Need some MQTT Help

jltnol
Posts: 1162
Joined: Tue Oct 15, 2013 11:11 pm

Need some MQTT Help

Post by jltnol »

So as long as I live I don't think I'll ever, fully grasp how MQTT works. EVER.

I have a few MQTT things working for my pool but am now trying to get notifications of when the heater is running. (See MQTT Explorer Pic below)
The Heater status is both in the heatMode and heatStatus topics, but I'm interested in the heatMode topic at the moment. When the heater is running, the "val":1, field is "1", and the "name":"heater" field is "heater". When off, those two fields are "val":0 and "name":"off"
1. I have a connector and it is working for other devices.
2. From the MQTT Explorer, I have copied and pasted, and added this topic in the subscription field to the connector:

Code: Select all

0:easytouch2-4/state/temps/bodies/1/pool/heatMode
2A. as a side note, I am also subscribing to other topics with this connector and don't know if the ORDER of the subscriptions matter, but my subscription list is not top to bottom as shown in the MQTT Explorer.

3. I've created a new Shim device, the Broker is the one I have set up for other pool devices, and the Message Type is the same as the other Shim devices for the pool.
4. The Unique ID Location is set as a "Topic Component"
5. Based on the MQTT Explorer, I'm counting from zero and my Topic Field seems like it shout be "6".
6. My Unique ID Value is "heatMode"
7. State Value Location = Payload Fields, Payload Type = JSON, and Payload Key = "name" (including quotes)
8, For the On Value field, I have "heater" (including quotes) (hoping to capture either of the two options being "heater", or "off")
9. Sensor Type is Generic, as Power On/Off or "Motion Sensor" don't seem to apply.

Once this device has been set up, and the heater is running, I restart both the MQTT Connector and Shims plugins, so they will update.

But alas, this doesn't seem to be working.

I've been able to get some other Shim Devices working for the pool, but the data for those isn't buried in a data string like the data I'm interested in here, so I'm guessing that's where my problem is with this.... I'm not correclty defining the data field that I'm trying to access. I'm also halfway assuming that I don't have the Payload Key set up right, and think I may need to include that whole data string, Also thinking the double brackets matter here as well, but I am nevertheless lost on this one.

And the Shim device in Indigo is grayed out, just more indications that I don't have this set up right.

If anyone has any ideas of where I've gone wrong, help is always appreciated!
Attachments
Screenshot 2025-06-16 at 6.42.05 PM.png
Screenshot 2025-06-16 at 6.42.05 PM.png (152.82 KiB) Viewed 674 times
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Need some MQTT Help

Post by FlyingDiver »

2. Remove pool from your subscription. Pool and heatMode are peer topics, not subsidiary.
3. Message type needs to be unique for each different value you’re extracting from the topic.
4. Correct. And it’s the easytouch2-4.
5. Your unique id is in field 0
6. You can use name, but the val field is more correct. However, those nested curly braces are important. That’s a json dict containing another dict, so the correct payload key is “heatMode.val”. That’s both keys required to identify the field, connected with a period.

It’s sometimes easier to put he connector in debug mode and see the messages in the log, rather than another app. That way you can be sure that your subscription is working, and see the actual topics, as the app merges them into its UI.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Need some MQTT Help

Post by FlyingDiver »

And I say more correct because I think it’s totally stupid for that device to be changing a name field when the status changes. IMHO
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
jltnol
Posts: 1162
Joined: Tue Oct 15, 2013 11:11 pm

Re: Need some MQTT Help

Post by jltnol »

Joe

As always, thanks for your help. Still don't have this working but maybe baby steps for me on this one.

1. I've disabled as much of my meager MQTT setup as possible to focus on this one project. I've put the Shims plugin into Debug mode(a great tip, thanks), and while I did change the subscription as you suggested, I still see both the heatMode and heatStatus are subscribed, as well as virtual circuit 130/poolheater which also indicates if the heater is on or off as well. (see pic below) I'm also guessing this is because the first subscription in my Connector is "easytouch2-4/#" which I think by default automatically subscribes to all topics. Guessing I can delete that subscription, but it's working so am hesitant to mess with it at the moment. From the debug log, you can see heatMode, heatStatus, and poolheater are all reporting in.

Code: Select all

MQTT Connector Debug            MQTT - Connector To Pool: processReceivedMessage: easytouch2-4/state/temps/bodies/1/pool/heatMode
   MQTT Connector Debug            MQTT - Connector To Pool: processReceivedMessage: easytouch2-4/state/temps/bodies/1/pool/heatStatus
   MQTT Connector Debug            MQTT - Connector To Pool: processReceivedMessage: easytouch2-4/state/virtualcircuits/130/poolheater
   MQTT Connector Debug            MQTT - Connector To Pool: processReceivedMessage: easytouch2-4/state/temps/bodies/1/spa/heatMode
   MQTT Connector Debug            MQTT - Connector To Pool: processReceivedMessage: easytouch2-4/state/temps/bodies/1/spa/heatStatus
2. While my other Shims Device MODELS are sensor values(water temp, air temp, saltwaterPPM), in this case I'm guessing my Model should be "Generic JSON Device", because the data is in a JSON field, and isn't a sensor value or on/off state.


So the first question is the Shims Model I should be using for this "Generic JSON Device"?

Once I get confirmation on what Model I should be using, I'm hoping the rest will be easy.

Virtual Circuit info:
mq2.png
mq2.png (50.14 KiB) Viewed 640 times
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Need some MQTT Help

Post by FlyingDiver »

Since you just want to know if the heater is on or not, a binary sensor device is appropriate.

You can set it up so that any arbitrary value indicates on or off.


Sent from my iPhone using Tapatalk
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Need some MQTT Help

Post by FlyingDiver »

Oh btw, the hash in a topic subscription is a wild card. So if you have that wildcard you don’t need any other subscriptions that start with that topic.


Sent from my iPhone using Tapatalk
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Post Reply

Return to “MQTT”