Shelly Plug Integration - Mqtt string to Input

Hi there,
I’m new to Mycodo and I’m trying to setup a controller for a pepper growing box.
I have a couple of Shelly Plug smart plugs, and I’d like to integrate them in the system.
So far I’ve been able to setup the Mqtt broker and to connect it to Mycodo, using Mqtt Value Inputs.
I’m almost correctly reading the power draw and energy (It’s published in watt per minute and I think I need to create a unit conversion, but that’s another story); my main problem is the relay state reading.
The devices send a simple “on” or “off” Mqtt message, which isn’t correctly read by Mycodo. If I understood correctly, the software expects a numeric value; how do I convert the string, preferably to a boolean state value? I’ve tried different units, but no one seems to work.
Probably I’m missing something obvious, but I’ve tried to find an answer in the manual and in the forum, with no success.

Thank you for your time,

The current version of Mycodo has two MQTT input modules, one for numerical values, the other for JSON strings of key/value pairs. There currently doesn’t exist a module for a simple string. I would copy the value MQTT input and modify it to work for strings instead of values. The problem appears when you try to save a value to the database, since these can only be numerical (well, technically text can be saved to the influxdb database, but Mycodo wasn’t designed to handle non-numerical time-series values). So, you will need to have the user specify a numerical value to save when a particular string is received. Check out the wiki I wrote on developing custom Input modules for a primer on creating custom modules:

Thank you, I’ll try to work on it; at least I wasn’t missing something obvious… :slight_smile: