Shelly support by Domoticz

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

Moderator: leecollings

User avatar
waltervl
Posts: 7039
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: Shelly support by Domoticz

Post by waltervl »

gizmocuz wrote: Thursday 19 November 2026 7:25 I have very limited Shelly devices, but did test against a wide range of MQTT-AD shelly configuration files i could find.
Then is the question: How to find or create those MQTT-AD shelly configuration files? Is it by doing a setting in the shelly user interface? Or just search on the net and publish it to MQTT?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
BartSr
Posts: 552
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: Shelly support by Domoticz

Post by BartSr »

Apart from all fine and helpfull instructions:
Domoticz is running in docker on a HP T630 thin client with plenty of storage.
I bought cheapest Shellies at Hornbach. ChatGpt advised and learned how to get these to work using python and mqtt. Once that was done integration in dz using auto mqtt detect was piece of cake.
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
User avatar
imautohuttraeger
Posts: 479
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: lat.beta
Location: Germany
Contact:

Re: Shelly support by Domoticz

Post by imautohuttraeger »

BartSr wrote: Thursday 19 November 2026 19:31 Apart from all fine and helpfull instructions:
Domoticz is running in docker on a HP T630 thin client with plenty of storage.
I bought cheapest Shellies at Hornbach. ChatGpt advised and learned how to get these to work using python and mqtt. Once that was done integration in dz using auto mqtt detect was piece of cake.
So you first had to make an own python script / plugin / whatsoever ?
Stop, look and listen.
gerardvs
Posts: 99
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

Re: Shelly support by Domoticz

Post by gerardvs »

You could also make a little bash script. As an example this is the script I use to add my Shellies 1 Gen3. It is not that difficult.

Code: Select all

#!/usr/bin/env bash

# Basic settings
BROKERIP="<broker-ip>"
BROKERPORT="1883"
MQTTROOT="homeassistant"

# Change for each device
SHELLYDEVICE="shellyxyz-aabbcc1122"
SHELLYNAME="<name within Domoticz>"
#

# Add Relay
PAYLOAD=$(cat <<EOF
{
    "name": "$SHELLYNAME",
    "unique_id": "$SHELLYDEVICE-relay",
    "command_topic": "$SHELLYDEVICE/command/switch:0",
    "state_topic": "$SHELLYDEVICE/status/switch:0",
    "value_template": "{{ value_json.output }}",
    "payload_on": "on",
    "payload_off": "off",
    "state_on": "true",
    "state_off": "false"
  }
}
EOF
)
mosquitto_pub -h "$BROKERIP" -p "$BROKERPORT" -r \
  -t "$MQTTROOT/switch/$SHELLYDEVICE/config" \
  -m "$PAYLOAD"

# Add Temperature
PAYLOAD=$(cat <<EOF
{
    "name": "$SHELLYNAME Temperature",
    "unique_id": "$SHELLYDEVICE-temperature",
    "state_topic": "$SHELLYDEVICE/status/switch:0",
    "value_template": "{{ value_json.temperature.tC }}",
    "unit_of_measurement": "C",
    "device_class": "temperature"
  }
}
EOF
)
mosquitto_pub -h "$BROKERIP" -p "$BROKERPORT" -r \
  -t "$MQTTROOT/sensor/$SHELLYDEVICE/config" \
  -m "$PAYLOAD"

# Add Input (be aware of button type in Shelly device)
PAYLOAD=$(cat <<EOF
{
    "name": "$SHELLYNAME Input",
    "unique_id": "$SHELLYDEVICE-input",
    "state_topic": "$SHELLYDEVICE/status/input:0",
    "value_template": "{{ value_json.state }}",
    "payload_on": "true",
    "payload_off": "false",
    "device_class": "power"
  }
}
EOF
)
mosquitto_pub -h "$BROKERIP" -p "$BROKERPORT" -r \
  -t "$MQTTROOT/binary_sensor/$SHELLYDEVICE/config" \
  -m "$PAYLOAD"

** edit: better use of ' and " **
Last edited by gerardvs on Saturday 21 November 2026 19:56, edited 1 time in total.
User avatar
gizmocuz
Posts: 3086
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Shelly support by Domoticz

Post by gizmocuz »

waltervl wrote: Thursday 19 November 2026 9:21
gizmocuz wrote: Thursday 19 November 2026 7:25 I have very limited Shelly devices, but did test against a wide range of MQTT-AD shelly configuration files i could find.
Then is the question: How to find or create those MQTT-AD shelly configuration files? Is it by doing a setting in the shelly user interface? Or just search on the net and publish it to MQTT?
You're correct, it is generated by this script:
https://github.com/bieniu/ha-shellies-discovery-gen2

But as these devices are so popular, I am looking about natively integrating them now.
(Also the company has been bought and we have to see what the feature remains)
Quality outlives Quantity!
User avatar
imautohuttraeger
Posts: 479
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: lat.beta
Location: Germany
Contact:

Re: Shelly support by Domoticz

Post by imautohuttraeger »

gizmocuz wrote: Friday 20 November 2026 9:53 But as these devices are so popular, I am looking about natively integrating them now.
Oh, that is great to hear - highly appreciated! This would be much more simple-user friendly than having to create scripts for every device.
Stop, look and listen.
User avatar
lemassykoi
Posts: 41
Joined: Saturday 11 March 2017 23:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Shelly support by Domoticz

Post by lemassykoi »

why not using websockets (like I did in my plugin) ?

for pure data collection efficiency on Gen2+ devices, WebSocket RPC wins

WebSocket (native RPC)
- Real-time push of status events directly from the device, no broker hop, no polling, lowest latency
- Fewer moving parts: no broker to run, secure, or monitor. Devices just open an outbound connection to your collector
- This is what Home Assistant's native Shelly integration uses by default for Gen2/3/4, with zero config
- Limits: point-to-point only (one connection per client), max 6 simultaneous non-persistent RPC channels per device, and no buffering. If your collector is down, events are lost, there's no retention like a broker
User avatar
imautohuttraeger
Posts: 479
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: lat.beta
Location: Germany
Contact:

Re: Shelly support by Domoticz

Post by imautohuttraeger »

lemassykoi wrote: Sunday 22 November 2026 20:25 why not using websockets (like I did in my plugin) ?
Partly, am really using this as a workaround. At least I use http commands. I could be wrong, but for a slider device (e.g. roller shutter percentage) it is not feasible.
Stop, look and listen.
User avatar
gizmocuz
Posts: 3086
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Shelly support by Domoticz

Post by gizmocuz »

Native Shelly support should now be working in Domoticz beta 2026.4.18655 and can be added from the hardware page (Choose Shelly as HW Type)

Also consult the wiki documentation

https://wiki.domoticz.com/Shelly

Once you added the hardware you can press the setup button from the hardware list, and at the bottom you can scan your network (enter your IP range like 192.168.0.1/24 to scan all your devices)
They should be detected and you can add them.

The native implementation also uses websockets except for Gen1
Quality outlives Quantity!
BurningTyre
Posts: 32
Joined: Wednesday 21 August 2019 15:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.4
Location: Arnhem, The Netherlands
Contact:

Re: Shelly support by Domoticz

Post by BurningTyre »

If you already have several Shelly devices set up in Domoticz via MQTT autodiscovery, would there still be any advantage to adding them using this method instead?
User avatar
gizmocuz
Posts: 3086
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Shelly support by Domoticz

Post by gizmocuz »

Yes, and i would then not use MQTT-AD has it is more native. But if you have a fully working system, then leave it on MQTT-AD, you can also only add certain devices that do not work correctly with MQTT-AD... but i hope they just work
Quality outlives Quantity!
User avatar
imautohuttraeger
Posts: 479
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: lat.beta
Location: Germany
Contact:

Re: Shelly support by Domoticz

Post by imautohuttraeger »

gizmocuz wrote: Monday 23 November 2026 9:17 Native Shelly support should now be working in Domoticz beta 2026.4.18655 and can be added from the hardware page (Choose Shelly as HW Type)
Wow, thank you very much! Must wait until next weekend to test it.
Stop, look and listen.
User avatar
imautohuttraeger
Posts: 479
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: lat.beta
Location: Germany
Contact:

Re: Shelly support by Domoticz

Post by imautohuttraeger »

Success-story:

Couldn't wait until the weekend ;-)

Already implemented
a Plus 2pm device (used for a roller shutter)
and a Plus H&T (Temperature an Humidity)

Fast and easy implementation by simply typing in the IP.

Now I can replace the old Domoticz devices that I had to learn by shelly teacher (percentage sliders did not work).

Looking at the wiki documentation I can only have a glimpse of imagination how much work this was. Thanks again!

You have a very happy user!
Stop, look and listen.
User avatar
gizmocuz
Posts: 3086
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Shelly support by Domoticz

Post by gizmocuz »

Using the scanner at the bottom of the setup page would possibly be even easier than typing in all IP addresses by hand 😁
Quality outlives Quantity!
User avatar
imautohuttraeger
Posts: 479
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: lat.beta
Location: Germany
Contact:

Re: Shelly support by Domoticz

Post by imautohuttraeger »

Sure, but this was just the first quick test.

EDIT: Will use the scan (confirm it is working perfectly) when I will start to to integrate all other Shelly (31) devices I have.

And I want / must proceed step-by step with only one Shelly device per step in order to keep the overview.

- Deactivate MQTT in the Shelly device (so I need the specific IP anyhow)
- Establish this one single Shelly device in Domoticz with SHELLY NATIVE
- Ensure the new Domoticz devices are running
- Identify the corresponding old Domoticz device(s) of MQTT AD
- Identify every skript and scene etc. using the old device(s)
- Replace the old IDX(es) against the new IDX(es) there
- Ensure all is working
- Finally delete the old device, so the system is clean.

I know that an old device idx can replace a new device idx. That would surely be faster and easier. But I am scared of loosing control and overview in the debugging and cleaning phase for 31 further Shelly devices (each creating several Domoticz devices) ...
Stop, look and listen.
Post Reply