MQTT Pub and Sub

Hi there,

I have a MQTT device that connects to Thinger and publishes data. I am trying to create an on/off control on the dashboard but cannot see the property to select from the device, shown below.

image

Any help appreciated.

Graham

the widget settings you are showing, are for a device connected over the proprietary Thinger protocol.

Device properties are something very specific to Thinger and not available whenever you connect with MQTT.

I’m afraid I cannot help more on connecting upon MQTT.
I didn’t yet use it, and just know enough, to tell you that the “device properties” is definitely the wrong way.

@rin67630 is right. Just to mention, in Thinger.io there are properties and resources. Resources are those that are dynamically defined in the device, and can be used in the API explorer (using the protocol from Thinger), and can be used to interact with the device directly, from a Widget, REST API, etc… A property is more like a setting for a device, a way to store metadata that can be used when booting up a device, like thresholds, schedules, etc., or store any arbitrary data. MQTT devices supports properties from API (there is no an actual way to extract them from MQTT protocol at this moment) but not resources (that I think is the thing you are looking for). If you tell us more about your device/use case, we can try to help you better.

Bests!

Thank you both for the reply.

To give you more detail, I have a commercially available smart plug (ESP32 based) that measures voltage , current and power and also has a control relay. The communication uses MQTT protocol v3.1.1 .The supplier provides a setup/test mobile App (picture below). I have been able to set the configuration to communicate with Thinger and publish to a topic. What I want to do is to send a control signal from Thinger to the smart plug to switch the relay on off using MQTT. Any lead in how to do this appreciated.

Thanks,

Graham

Ok @grahammrichards, and what is the expected payload/topic you should send in order to turn on/off the relay? At this moment, the control widget cannot publish to a topic, but I think it is a feature that can be developed easily. The complex thing here is how to know the actual relay position. Does the device publish periodically its state periodically? Can you share with us the device/documentation?

Hi there,

This is the link to the product documentation.
http://doc.mokotechnology.com/index.php?s=/page/165#4.4%20Indicator%20Status

Regards,

Graham

Hope this aint too late,but this can be achieved using the Node-RED plugin in Thinger.
Create a Dummy MQTT device to push the state of the Widget Via Node Red to the Broker and have the subsribed device receiving the messages published by Node-RED which represent the state of the ON/OFF widget.