shelly integration

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

Post Reply
harrykausl
Posts: 177
Joined: Sunday 13 November 2016 10:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Germany
Contact:

shelly integration

Post by harrykausl »

At the moment I'm using 2 shelly1 with the shelly-mqtt plugin. The development of this plugin is stopped. There is the possibility to use a script, to handle mqtt autodiscovery for shellys. A second solution seems to be to use nodered flows. I'd like to use the standard for shellys in domoticz, but what is or will be the standard.
PooleD
Posts: 1
Joined: Friday 31 March 2023 7:47
Target OS: -
Domoticz version:
Contact:

Re: shelly integration

Post by PooleD »

The standard for integrating Shelly devices with Domoticz is still under development, and it may take some time before a standard protocol or plugin is officially released. However, in the meantime, there are several options available to you.
As you mentioned, you can use a script or a Node-RED flow to handle MQTT autodiscovery for your Shelly devices. This will allow you to automatically detect and configure your devices in Domoticz. There are several examples of MQTT discovery scripts and Node-RED flows available online, and you can modify them to fit your specific needs.
Alternatively, you can use a third-party plugin or integration for Shelly devices that is compatible with Domoticz. For example, there is a plugin available on the Domoticz forum that provides support for Shelly devices via HTTP calls. This plugin is not officially supported by Domoticz, but it may work for your needs.
Ultimately, the best solution for integrating Shelly devices with Domoticz will depend on your specific requirements and preferences. I recommend exploring the available options and choosing the one that best fits your needs.
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: shelly integration

Post by lwolf »

harrykausl wrote: Monday 20 February 2023 12:20 At the moment I'm using 2 shelly1 with the shelly-mqtt plugin. The development of this plugin is stopped. There is the possibility to use a script, to handle mqtt autodiscovery for shellys. A second solution seems to be to use nodered flows. I'd like to use the standard for shellys in domoticz, but what is or will be the standard.
ShellyTeacher 4 Domoticz is the script you are writing about. It is now available as a standalone windows application, so i think it is the easiest solution:
https://github.com/enesbcs/shellyteacher4domo/releases

The Teacher app has to be started once, it will register detected Shelly devices to the built-in MQTT Autodiscovery Gateway, which is part of Domoticz. There are absolutely no need for any plugin, its a click-and-play solution.
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: shelly integration

Post by Gravityz »

i havr a shelly 1pm and that one works perfectly with the old plugin.

yes it is not updated anymore but still supported
as long as you do not have/buy newer shelly types in the future i would advice to use the current plugin.

all this MQTT auto discovery stuff is still under development
mvdw
Posts: 1
Joined: Sunday 07 February 2021 10:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: shelly integration

Post by mvdw »

It is also possible to use a Shelly device without MQTT: see description at https://www.hellosmarthome.nl/post/revi ... /domoticz/ - it is in Dutch, but the images clarify a lot.

In short: make a dummy switch device for the shelly, set the "on" and "off" actions to operate the shelly when controlled from within Domoticz, and set a Shely Action to change the Domoticz device when the Shelly is operated from elsewhere.

All this can work without the Shelly cloud - which is my primary reason I buy Shelly myself.

Something not mentioned yet: see that the shelly always gets the same IP address from the DHCP server in your router. IIRC, this is called a "fixed lease".

In my setup, I did not use a Shelly action, but a dzvents script - with the advantage that also the power measurement is transfrred into a second Domoticz dummy device. Downside: the script is polling every minute.

This is the script:

Code: Select all

-- Poll the Shelly Mini 1PM in bakje
return {
	on = {
		timer = { 'every minute' },
		httpResponses = { 'PollingShelly1PMMini' } -- matches callback string below
	},
	logging = { 
		level = domoticz.LOG_ERROR,
		marker = 'PollingShelly1PMMini',
	},
	execute = function(domoticz, item)
	    domoticz.log('Fetching PollingShelly1PMMini status', domoticz.LOG_INFO)
		if (item.isTimer) then
			domoticz.openURL({
				url = 'http://10.0.3.106/rpc/Switch.GetStatus?id=0',
				method = 'GET',
				callback = 'PollingShelly1PMMini'
			})
		elseif (item.isHTTPResponse) then
			if (item.ok and item.isJSON) then -- statusCode == 2xx
			    local v = item.json.output
			    domoticz.log('Fetching PollingShelly1PMMini status ' .. tostring(v), domoticz.LOG_INFO)
			    local vs 
			    if v then vs = 'On' else vs = 'Off' end
				domoticz.devices(419).updateEnergy(item.json.apower)
				domoticz.devices(418).setState(vs).checkFirst().silent()
			else -- oops
				domoticz.log('Error fetching PollingShelly1PMMini data', domoticz.LOG_ERROR)
				domoticz.log(item.data, domoticz.LOG_ERROR)
			end
		end
	end
}
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: shelly integration

Post by kimot »

I don't see why anyone needs any plugin for Shelly.
Shellys have an API for receiving and sending values ​​directly to Domoticz.
New Shelly Plus models can using their script language send through JSON/API call whatever.
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: shelly integration

Post by waltervl »

kimot wrote: Monday 26 February 2024 22:23 I don't see why anyone needs any plugin for Shelly.
Shellys have an API for receiving and sending values ​​directly to Domoticz.
New Shelly Plus models can using their script language send through JSON/API call whatever.
Any documentation on this? Because I don't believe a standard Shelly can do this, only perhaps with a flashed firmware from Tasmota.

The shellyteacher script/windows application mentioned earlier in this topic is already becoming very mature now. So no need to flash anything.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: shelly integration

Post by Gravityz »

this works with IO/ URL actions

however you can only switch things on/ff with this
i do not think you can send power usage or temperatures with this.

so yes, basic switching works
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: shelly integration

Post by kimot »

waltervl wrote: Monday 26 February 2024 22:59
kimot wrote: Monday 26 February 2024 22:23 I don't see why anyone needs any plugin for Shelly.
Shellys have an API for receiving and sending values ​​directly to Domoticz.
New Shelly Plus models can using their script language send through JSON/API call whatever.
Any documentation on this? Because I don't believe a standard Shelly can do this, only perhaps with a flashed firmware from Tasmota.

The shellyteacher script/windows application mentioned earlier in this topic is already becoming very mature now. So no need to flash anything.
2024-03-05-185732_1920x1080_scrot.png
2024-03-05-185732_1920x1080_scrot.png (176.47 KiB) Viewed 3513 times
No, no, boys.
No Tasmota, no special firmware, even no MQTT.
Only buy "Shelly Plus" devices gen.2 and use its powerful scripting language....
Create virtual devices and
then you can sent Volts, Amps, Watts or Watt hours to Domoticz using JSON/API

By the way, those scripts are so powerful, that the "Shelly" itself can download the SPOT hour energy prices from web and automatically switch the device at the time of the lowest prices...

On the picture is part of my script which sends the current energy consumption to Domoticz energy counter every minute
from standard Shelly Plus Plug S
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: shelly integration

Post by waltervl »

So they don't have an API but you programmed them to send their data to Domoticz with the Domoticz API. If you feel comfortable with that is fine but not easy for all...
Also you have to create the Domoticz devices manually. Also you have to make action commands on dummy Domoticz switches to switch a Shelly. All very easy and quick to do......

But agreed, possible.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: shelly integration

Post by kimot »

2024-03-05-193425_1920x1080_scrot.png
2024-03-05-193425_1920x1080_scrot.png (214.75 KiB) Viewed 3507 times

Here is another part of the code - example of reading the values ​​of consumed energy from the Shellys internal memory.
You can see the values ​​for each of the last three minutes and the total consumption since the device was turned on.
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
gvandick
Posts: 30
Joined: Saturday 01 July 2017 12:48
Target OS: Windows
Domoticz version:
Contact:

Re: shelly integration

Post by gvandick »

I installed the new shelly mqtt but no devices in domoticz
https://github.com/enesbcs/shellyteacher4domo/releases


In the mqtt explorer the shelly device shows up as online

What I do wrong
Attachments
Schermafbeelding 2024-03-15 090511.png
Schermafbeelding 2024-03-15 090511.png (114.02 KiB) Viewed 3389 times
Schermafbeelding 2024-03-15 085947.png
Schermafbeelding 2024-03-15 085947.png (92.2 KiB) Viewed 3389 times
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: shelly integration

Post by waltervl »

Did you install paho-mqtt as indicated when you run ./run.sh?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
gvandick
Posts: 30
Joined: Saturday 01 July 2017 12:48
Target OS: Windows
Domoticz version:
Contact:

Re: shelly integration

Post by gvandick »

Yes I'did

I change IP adres server in settings.py .

But there are two items in this file named

mqtt user and mqtt passw

I don't know if these must change I leave this empty in the hardware domoticz Mqtt autodiscovery LAN

I try change this in empty " " in the settings.py, but no effect.
Attachments
Schermafbeelding 2024-03-17 093654.png
Schermafbeelding 2024-03-17 093654.png (49.42 KiB) Viewed 3352 times
Schermafbeelding 2024-03-17 092745.png
Schermafbeelding 2024-03-17 092745.png (34.12 KiB) Viewed 3352 times
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: shelly integration

Post by lwolf »

gvandick wrote: Friday 15 March 2024 9:09 I installed the new shelly mqtt but no devices in domoticz
https://github.com/enesbcs/shellyteacher4domo/releases


In the mqtt explorer the shelly device shows up as online

What I do wrong
You error message says "no module named typing extensions"

It may be a dependency of paho-mqtt so paho-mqtt installation is not complete. Did you try to install "typing_extensions" ?

Anyway: precompiled windows binary always works, if you are unable to start the linux version.
gvandick
Posts: 30
Joined: Saturday 01 July 2017 12:48
Target OS: Windows
Domoticz version:
Contact:

Re: shelly integration

Post by gvandick »

First I try to install typing_extensions with pip installing oke but still not working
I removed de file teacher4domo and tar the file linux bin
But no file settings.py and run.sh
So I install teacher4domo again change the IP in de settings.py and ./run.sh

Then it worked the devices implemented in domoticz.

So I wonder is that the right way to install both?
But anyway its working

All thanks for the help
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: shelly integration

Post by lwolf »

gvandick wrote: Tuesday 19 March 2024 9:01 I removed de file teacher4domo and tar the file linux bin
But no file settings.py and run.sh
settings.py is integrated inside the linux and windows binary file.
settings.ini is used in this case.

The preferred way is: simply unpack the windows version with the GUI, click and use it, as it showed in the demo video.
gvandick
Posts: 30
Joined: Saturday 01 July 2017 12:48
Target OS: Windows
Domoticz version:
Contact:

Re: shelly integration

Post by gvandick »

I overlook the video. Now I install the win version

However, now a second plugplugS is added to the domoticz device list with a new ID of the shelly devices. But the data and control is identical to the first added device. I deleted the first device and then added the new one again. That worked, but when I plugged the first device back in, both devices were identical in terms of switch behavior and kWh data consumption.
AchilleTalon
Posts: 12
Joined: Wednesday 17 February 2021 9:28
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Contact:

Re: shelly integration

Post by AchilleTalon »

Hello all.

Just sharing my thoughts about the topic.
I've been using Shellys for a few years now, initially flashing them with Tasmota, but now I'm just using the stock firmware.

Shelly MQTT plugin was a great help, but it's discontinued. I updated it to add the TRVs, but eventually I moved on to ShellyTeacher4domoticz. The guy developing it is really responsive and added support for the WallDisplay in just one day with my inputs.

So as far as I'm concerned, everything I need is MQTT auto-discovery and ShellyTeacher4domoticz

!!!
EXCEPT for one thing
!!!

First generation Shellys (Shelly1, Dimmer2, ...) can't use MQTT and cloud at the same time. I don't really use cloud, but the WallDisplay does, so I can't really include my Dimmer2 on the display (until they fix the WallDisplay firmware).

However, 1st gen can use cloud and CoIoT at the same time, and I've been trying to see if I can use that protocol (CoIoT or Coap) to make some kind of a plugin or a nodered flow.
gvandick
Posts: 30
Joined: Saturday 01 July 2017 12:48
Target OS: Windows
Domoticz version:
Contact:

Re: shelly integration

Post by gvandick »

For each plugsplugs you must use a different prefix I now has been informed by de developer. So this solved my issue.

Thanks for the supply
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest