Shelly support by Domoticz

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

FlyingDomotic
Posts: 463
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Shelly support by Domoticz

Post by FlyingDomotic »

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 ;-)
User avatar
waltervl
Posts: 6676
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Shelly support by Domoticz

Post by waltervl »

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 ;-)
Perhaps someone can gather all shelly MQTTMapper configs and put it in a topic or github repository.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
FlyingDomotic
Posts: 463
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Shelly support by Domoticz

Post by FlyingDomotic »

Some examples :
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.
Murasaki
Posts: 1
Joined: Sunday 16 November 2025 20:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Shelly support by Domoticz

Post by Murasaki »

This is a configuration for reading Shelly Plus 4i inputs (Firmware version: i4prod0)

"Input 1": {
"topic": "shellies/shellyplusi4-xxxxxxxx/status/input:0",
"type": "244",
"subtype": "73",
"switchtype": "9",
"mapping": {"item":"state", "values": {"True": "On", "False": "Off"}
}

Just change <input:0> to 1,2 or 3 depending on input to read

Just in case, it can help to somebody.
Itschi
Posts: 22
Joined: Saturday 16 May 2015 14:58
Target OS: Windows
Domoticz version:
Contact:

Re: Shelly support by Domoticz

Post by Itschi »

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:

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&param=switchlight&idx=6536&switchcmd=', // Domoticz Dummy Switch
  httpPower: '/json.htm?type=command&param=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)
});
Finally you add in the Domoticz switch the on and off actions where 1.8.1.17 is the Shelly IP in this example:

"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).
User avatar
andrehj
Posts: 54
Joined: Sunday 06 January 2019 14:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: Shelly support by Domoticz

Post by andrehj »

Thanks @Itschi,
That looks very promising. I'm very new to Shelly's, and have a Shelly Pro 3 (with 3 output relays, no energy metering and I don't use the three inputs).
Removing the energy- and power-part is simple, but I'm struggling to expand your script to three outputs.
What would your script look like with 3 outputs (0, 1 and 2)?
alanf
Posts: 5
Joined: Tuesday 03 September 2019 20:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Shelly support by Domoticz

Post by alanf »

Thanks for the code example @Itschi,

I bought a couple of Shelly door/window BLU sensors, mostly because they look far less clunky than most alternatives and I have a few earlier generation Shelly switches that have proved reliable over a few years (using the https://github.com/enesbcs/Shelly_MQTT plugin). I'm using a Shelly1 Gen4 switch as a gateway I can place near the doors, well within bluetooth range. One of the first tasks was to start by updating the firmware on the switches and the sensors. Some of the earlier firmware on devices "out of the box" don't have the menu options or messages described in the Shelly website documentation.

Simplest way I found to operate was to manually create a new dummy switch on Domoticz of type "door contact" and use two "Action" entries (opened and closed) on the paired Shelly switch to control the Domoticz switch. If anyone wants to try that:

First create the dummy Domoticz door contact switch (note the idx). Then pair the Shelly BLU device as a component from the Shelly1gen4 admin page; as per the Shelly guide (https://kb.shelly.cloud/knowledge-base/ ... art-blueto). The new component was renamed "Front Door sensor" to make it easier to find, the window[0] as the supported sensor could be renamed but as the only sensor of that type on the component I didn't bother.

From there it's a few menu choices to create two new "Action"s (aka webhooks?) using that "Front Door sensor - window[0]". One called "Front Door Opened" has a trigger of "State change", an additional condition of "New state is open" and a URL to execute of

Code: Select all

http://<Domoticz IPaddress>:<port>/json.htm?type=command&param=switchlight&idx=<door contact idx>&switchcmd=On
(Your <Domoticz IPaddress>:<port> address is likely to be something like 192.168.1.10:8080, the <door contact idx> the idx of the switch I created is 136).
The reverse "Front Door Closed" action uses "New state is closed" and "switchcmd=Off".

Seems to work well for a basic on/off type sensor; a Domoticz switch with the appropriate door icons that reflects the open/closed state of the door and can be included in scripts and so on. I can see some case for using MQTT, but against that would be adding extra complexity and another failure point. I was thinking of the simplest way I can use the built in "Battery[0]" and "llluminance[0]" sensors. Your script example might be the easiest way to trigger conditions such as "low battery" and "low light".
angelo67
Posts: 1
Joined: Sunday 14 December 2025 12:53
Target OS: Linux
Domoticz version:
Contact:

Re: Shelly support by Domoticz

Post by angelo67 »

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:

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&param=switchlight&idx=6536&switchcmd=', // Domoticz Dummy Switch
  httpPower: '/json.htm?type=command&param=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)
});
Finally you add in the Domoticz switch the on and off actions where 1.8.1.17 is the Shelly IP in this example:

"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).
Returning to this post by "Itschi,"
in the script to be written on the shellyplug, you need to change the IP of the domoticz server and in the two rows below you need to enter the "IDX" of the switch previously created as a virtual switch on a dummy hardware.
Is there anything else to change?
I tried, but the shellyplug status isn't changed on the domoticz page.

Thanks

Angelo67
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest