MQTT Connector Device/Variable control

Posted on
Tue Mar 14, 2023 2:26 pm
madscientist offline
Posts: 121
Joined: Jan 05, 2007
Location: Ontario, Canada

MQTT Connector Device/Variable control

I'm trying to pass values from an MQTT broker into Indigo variables. For example, I have a pool heater thermostat setup as an Indigo device. The desired thermostat set point is available in my Mosquitto broker, so I'm trying to setup an Indigo trigger to extract this value from the subscribed topic and pass it to an Indigo variable, which is then used by the thermostat device.

I have setup the MQTT Connector to subscribe to the relevant topic, but I'm not sure what to do next.

I notice that the MQTT Connector plug-in itself can be configured for device/variable control using these settings:

mqtt-variable-settings.jpg
mqtt-variable-settings.jpg (63.35 KiB) Viewed 1179 times


That seems much simpler than creating MQTT Shims, bit I'm not clear on how to configure the mqtt topic payload. There is a reference to the Wiki for additional configuration details. I assume this means the Wiki at https://github.com/FlyingDiver/Indigo-MQTT/wiki, but this doesn't contain any more details on this particular MQTT Connector feature. Is there additional online documentation somewhere?

Posted on
Wed Mar 15, 2023 5:54 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

MQTT Connector Device/Variable control

You can’t use that process to handle messages from your device. That’s for where you’re constructing the message yourself like on node red or similar.

You either need to use a shim device or trigger on the message and write a Python script that parses the connector state that contains the message payload.


Sent from my iPhone using Tapatalk

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Mar 15, 2023 7:17 am
madscientist offline
Posts: 121
Joined: Jan 05, 2007
Location: Ontario, Canada

Re: MQTT Connector Device/Variable control

Thanks Joe. Was hoping I wouldn't have to go the shim route as I've been trying for 2 days to get that working without success. Could you have a look at my settings and let me know what I'm doing wrong?

The mqtt topic of interest is indigo/variables/desired/-pool-thermostat-temp
01-mqtt-explorer.jpg
01-mqtt-explorer.jpg (47.95 KiB) Viewed 1144 times


I have subscribed to the topic indigo/variables/# with a QoS of 1
02-subscribed-topics.jpg
02-subscribed-topics.jpg (87.54 KiB) Viewed 1144 times


This is the topic match, which then gets assigned a message type of ##variables##
03-variables-topic-updated.jpg
03-variables-topic-updated.jpg (72.49 KiB) Viewed 1144 times


This is the shim device. I've used a value sensor device here. In this case I've used a "generic" sensor type, but I've also tried this using temperature (F).
04-shim-device.jpg
04-shim-device.jpg (113.88 KiB) Viewed 1144 times


The goal is to pass the shim device payload to an indigo variable:
05-shim-device-trigger.jpg
05-shim-device-trigger.jpg (54.49 KiB) Viewed 1144 times


06-shim-device-intsert-variable-state.jpg
06-shim-device-intsert-variable-state.jpg (60.43 KiB) Viewed 1144 times

Posted on
Wed Mar 15, 2023 7:44 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT Connector Device/Variable control

What’s generating that MQTT message? It doesn’t look like what I would expect from a hardware device.

If you have complete control over the format of that topic and payload, then you can use the device control syntax.


Sent from my iPhone using Tapatalk

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Mar 15, 2023 8:15 am
madscientist offline
Posts: 121
Joined: Jan 05, 2007
Location: Ontario, Canada

Re: MQTT Connector Device/Variable control

Thanks for the quick reply Joe. I do indeed have control over the format of that mqtt payload. The value is posted to the mqtt broker by node-red. So how would I go about formatting the payload to be processed by the device control syntax?

Posted on
Wed Mar 15, 2023 8:45 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: MQTT Connector Device/Variable control

This is hard to do on my phone, but I’m currently in India without a computer.

indigo/variables/6468864/set

Change the number to the ID of the variable you want to update, and the new value in the payload. Make sure the payload value is a string.

If that doesn’t work, copy the string from the config dialog tab and paste it here. The default might not be correct for the current code. That code was added a long time ago and not tested that well.



Sent from my iPhone using Tapatalk

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Mar 15, 2023 10:45 am
madscientist offline
Posts: 121
Joined: Jan 05, 2007
Location: Ontario, Canada

Re: MQTT Connector Device/Variable control

This is the syntax that appears in the mqtt broker config:

indigo/variables/(?P<id>.*)/command/(?P<cmd>.*)

Posted on
Wed Mar 15, 2023 1:15 pm
madscientist offline
Posts: 121
Joined: Jan 05, 2007
Location: Ontario, Canada

Re: MQTT Connector Device/Variable control

Eureka! After spending over 2 days trying to setup an MQTT shim without success, I discovered that the problem was that I was coincidentally using the topic indigo/variables, which seems to be reserved for the MQTT's built-in connection's device/variable control. The solution was simply to use myindigo/variables for the MQTT topic subscription. <face-palm>

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests