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:
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?
MQTT Connector Device/Variable control
-
madscientist
- Posts: 122
- Joined: Fri Jan 05, 2007 10:13 pm
- Location: Ontario, Canada
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- 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
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
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
-
madscientist
- Posts: 122
- Joined: Fri Jan 05, 2007 10:13 pm
- 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 I have subscribed to the topic indigo/variables/# with a QoS of 1 This is the topic match, which then gets assigned a message type of ##variables## 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). The goal is to pass the shim device payload to an indigo variable:
The mqtt topic of interest is indigo/variables/desired/-pool-thermostat-temp I have subscribed to the topic indigo/variables/# with a QoS of 1 This is the topic match, which then gets assigned a message type of ##variables## 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). The goal is to pass the shim device payload to an indigo variable:
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- 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
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
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
-
madscientist
- Posts: 122
- Joined: Fri Jan 05, 2007 10:13 pm
- 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?
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- 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
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
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
-
madscientist
- Posts: 122
- Joined: Fri Jan 05, 2007 10:13 pm
- 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>.*)
indigo/variables/(?P<id>.*)/command/(?P<cmd>.*)
-
madscientist
- Posts: 122
- Joined: Fri Jan 05, 2007 10:13 pm
- 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>