You may find examples in this forum, looking for MqttMapper.
I may also help
Moderator: leecollings
Perhaps someone can gather all shelly MQTTMapper configs and put it in a topic or github repository.FlyingDomotic wrote: Friday 07 November 2025 10:50 Some people here did manage connecting Shellies to Domoticz through MqttMapper plug-in.
You may find examples in this forum, looking for MqttMapper.
I may also help![]()
oli80330 wrote: Saturday 25 October 2025 2:33 Json for sdhelly 2.5 roller works fine.
several JSON examples for shelly (1/2.5/EM Gen1) :
1 - For a Shelly 1 (GEN1) / domoticz device on/off :
"SDB Ventil": {
"topic": "shellies/SDB Ventil/relay/0",
"type": "244", "subtype": "73",
"switchtype": "0",
"mapping": {"item": "", "default": "0", "values": { "off": "0", "on": "100", "false": "0", "true": "100" }},
"commands": {
"On": {"topic": "shellies/SDB Ventil/relay/0/command", "payload": "on"},
"Off": {"topic": "shellies/SDB Ventil/relay/0/command", "payload": "off"}
}
2- For a Shelly 2.5 mode relay (not roller mode) (GEN1) / domoticz on/off :
"CE Mode PAC": {
"topic": "shellies/CE Thermo Solaire/relay/0",
"type": "244", "subtype": "73",
"switchtype": "0",
"mapping": {"item": "", "default": "0", "values": { "off": "0", "on": "100", "false": "0", "true": "100" }},
"commands": {
"On": {"topic": "shellies/CE Thermo Solaire/relay/0", "payload": "on"},
"Off": {"topic": "shellies/CE Thermo Solaire/relay/0", "payload": "off"}
}
}
3 -For a Shelly 2.5 mode roller (not relay mode) (GEN1) / domoticz blinds on/off/stop/position :
"ShellyMapper - Buro Volet": {
"topic": "shellies/Buro Volet/roller/0/pos",
"type": "244",
"subtype": "73",
"switchtype": "21",
"mapping": {"item": ""},
"commands": {
"Open": { "topic": "shellies/Buro Volet/roller/0/command", "payload": "open" },
"Close": { "topic": "shellies/Buro Volet/roller/0/command", "payload": "close" },
"Stop": { "topic": "shellies/Buro Volet/roller/0/command", "payload": "stop" },
"Set Level": { "topic": "shellies/Buro Volet/roller/0/command/pos", "payload": "<level>", "retain": false }
}
}
4 - For a Shelly EM or Shelly 2.5 (Gen1 conso) / domoticz General, kWh :
"Clim Salon": {
"topic": "shellies/Clim Salon/relay/0/power",
"type": "243", "subtype": "29", "switchtype": "0",
"options": {"EnergyMeterMode":"0"},
"mapping": {"item":"~*;~0"}
}
Thank you very much for your plugin, very fast for feedback in MQTT !
The CPU consumption of the RPi is very low.
A good plugin for shelly device, better than shellyteacher or AutoDiscovery, very slow in feedback.
Code: Select all
// Send Plug's Status & Power to Domoticz
let CONFIG = {
outputId: 0,
httpServer: 'http://1.8.1.1:8080', //Domoticz Server IP
httpState: '/json.htm?type=command¶m=switchlight&idx=6536&switchcmd=', // Domoticz Dummy Switch
httpPower: '/json.htm?type=command¶m=udevice&idx=6535&nvalue=0&svalue=' // Domoticz Dummy Power Device
};
function notifyState(OnOff) {
Shelly.call(
'HTTP.GET',
{url:CONFIG.httpServer+CONFIG.httpState+OnOff}
)
}
function notifyPower(Power, Energy) {
Shelly.call(
'HTTP.GET',
{url:CONFIG.httpServer+CONFIG.httpPower+Power+';'+Energy}
)
}
let outputStringId = "switch:" + JSON.stringify(CONFIG.outputId);
print(outputStringId);
Shelly.addStatusHandler(function (statusNtf) {
if (statusNtf.component !== outputStringId) return;
let sysStatus = Shelly.getComponentStatus('Switch:0')
if (sysStatus.output === true) notifyState('On');
else notifyState('Off');
notifyPower(sysStatus.apower, sysStatus.aenergy.total)
print(sysStatus.apower)
print(sysStatus.aenergy.total)
});Code: Select all
http://<Domoticz IPaddress>:<port>/json.htm?type=command¶m=switchlight&idx=<door contact idx>&switchcmd=OnReturning to this post by "Itschi,"Itschi wrote: Monday 17 November 2025 17:06 The most elegant way to integrate Shelly devices in Domoticz from my perspective is to make use of their integrated scripting function. Just add the respective dummy devices in Domoticz and a script in the Shelly device to call the Domoticz JSON interface. For a Plug S this looks like:
Finally you add in the Domoticz switch the on and off actions where 1.8.1.17 is the Shelly IP in this example:Code: Select all
// Send Plug's Status & Power to Domoticz let CONFIG = { outputId: 0, httpServer: 'http://1.8.1.1:8080', //Domoticz Server IP httpState: '/json.htm?type=command¶m=switchlight&idx=6536&switchcmd=', // Domoticz Dummy Switch httpPower: '/json.htm?type=command¶m=udevice&idx=6535&nvalue=0&svalue=' // Domoticz Dummy Power Device }; function notifyState(OnOff) { Shelly.call( 'HTTP.GET', {url:CONFIG.httpServer+CONFIG.httpState+OnOff} ) } function notifyPower(Power, Energy) { Shelly.call( 'HTTP.GET', {url:CONFIG.httpServer+CONFIG.httpPower+Power+';'+Energy} ) } let outputStringId = "switch:" + JSON.stringify(CONFIG.outputId); print(outputStringId); Shelly.addStatusHandler(function (statusNtf) { if (statusNtf.component !== outputStringId) return; let sysStatus = Shelly.getComponentStatus('Switch:0') if (sysStatus.output === true) notifyState('On'); else notifyState('Off'); notifyPower(sysStatus.apower, sysStatus.aenergy.total) print(sysStatus.apower) print(sysStatus.aenergy.total) });
"http://1.8.1.17/relay/0?turn=on"
"http://1.8.1.17/relay/0?turn=off"
That's it. Now you can control and monitor the plug from any endpoint (Domoticz, Shelly-App and even from the device switch).
Code: Select all
let DOMOTICZ_IP = "192.168.2.2";
let DOMOTICZ_PORT = "8080";
let IDX = 38;
function sendEnergy() {
let pm = Shelly.getComponentStatus("pm1:0");
if (!pm || !pm.aenergy) {
print("Energy data not ready");
return;
}
let power = pm.apower; // Watts
let energy_kwh = pm.aenergy.total / 1000; // Wh → kWh
let url = "http://" + DOMOTICZ_IP + ":" + DOMOTICZ_PORT +
"/json.htm?type=command¶m=udevice" +
"&idx=" + IDX +
"&nvalue=0&svalue=" + power + ";" + energy_kwh;
print("Sending:", power, "W,", energy_kwh, "kWh");
Shelly.call("HTTP.GET", { url: url }, function (res, err_code, err_msg) {
if (err_code !== 0) {
print("HTTP error:", err_msg);
} else {
print("OK");
}
});
}
// every 30 seconds
Timer.set(30000, true, sendEnergy);Code: Select all
{
"name": "Shelly Fase A Actief Vermogen",
"unique_id": "shelly_<id>_a_act_power",
"state_topic": "shelly<id>/status/em:0",
"value_template": "{{ value_json.a_act_power }}",
"device_class": "power",
"state_class": "measurement",
"unit_of_measurement": "W",
"device": {
"identifiers": ["shelly_<id>"],
"name": "Shelly Pro 3EM",
"model": "Pro 3EM",
"manufacturer": "Shelly"
}
}That would be highly appreciated by me!jorknu wrote: Wednesday 02 September 2026 21:57 I will post a link here once I have something that is 'workable'
did you test it?imautohuttraeger wrote: Wednesday 05 November 2025 13:30 Super! Will test it maybe next week and give feedback if it works.
Unfortunately not. I was quite busy after that post and I have to admit that I forgot it.lemassykoi wrote: Thursday 03 September 2026 19:04did you test it?imautohuttraeger wrote: Wednesday 05 November 2025 13:30 Super! Will test it maybe next week and give feedback if it works.