Page 1 of 1

Shelly support by Domoticz

Posted: Monday 03 February 2025 14:20
by HoogendoornJH
I wonder to what extent Shelly is still supported by Domoticz. I found out that Shelly Duo bulbs and Shelly PM minis are not well integrated in Domoticz (see also my post on 18 January 2025 13:50, viewtopic.php?t=43092). Can someone tell me what the support for Shelly devices is like and what the future expectations are? The

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 14:33
by waltervl
When the only shelly integration author quits because of complexity and moves to other hardware type (zigbee), we as Domoticz users have to wait until someone else volunteers to pick the work up. If and when that happens we will have to see....

But for me it is easy to say, I do not use Shellies.

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 15:54
by HvdW
With a bit of fantasy and dzVents a plugin isn't needed for Shelly.

Code: Select all

2025-02-03 15:49:00.388 dzVents: Handling httpResponse-events for: "Shelly21Retrieved"
2025-02-03 15:49:00.390 dzVents: > time: 15:49
2025-02-03 15:49:00.390 dzVents: > unixtime: 1738594140
2025-02-03 15:49:00.390 dzVents: > ext_temperature:
2025-02-03 15:49:00.390 dzVents: > serial: 268
2025-02-03 15:49:00.390 dzVents: > relays:
2025-02-03 15:49:00.390 dzVents: > 1:
2025-02-03 15:49:00.390 dzVents: > timer_remaining: 0
2025-02-03 15:49:00.390 dzVents: > timer_started: 0
2025-02-03 15:49:00.390 dzVents: > overpower: false
2025-02-03 15:49:00.390 dzVents: > source: http
2025-02-03 15:49:00.390 dzVents: > timer_duration: 0
2025-02-03 15:49:00.390 dzVents: > ison: false
2025-02-03 15:49:00.390 dzVents: > has_timer: false
2025-02-03 15:49:00.390 dzVents: > fs_free: 146835
2025-02-03 15:49:00.391 dzVents: > temperature: 30.77
2025-02-03 15:49:00.391 dzVents: > cfg_changed_cnt: 0
2025-02-03 15:49:00.391 dzVents: > cloud:
2025-02-03 15:49:00.391 dzVents: > connected: false
2025-02-03 15:49:00.391 dzVents: > enabled: false
2025-02-03 15:49:00.391 dzVents: > ram_free: 30920
2025-02-03 15:49:00.391 dzVents: > ram_total: 42960
2025-02-03 15:49:00.391 dzVents: > wifi_sta:
2025-02-03 15:49:00.391 dzVents: > ssid: ZIGGO
2025-02-03 15:49:00.391 dzVents: > rssi: -78
2025-02-03 15:49:00.391 dzVents: > ip: 192.168.2.21
2025-02-03 15:49:00.391 dzVents: > connected: true
2025-02-03 15:49:00.392 dzVents: > ext_sensors:
2025-02-03 15:49:00.392 dzVents: > meters:
2025-02-03 15:49:00.392 dzVents: > 1:
2025-02-03 15:49:00.392 dzVents: > is_valid: true
2025-02-03 15:49:00.392 dzVents: > total: 89555
2025-02-03 15:49:00.392 dzVents: > power: 0.0
2025-02-03 15:49:00.392 dzVents: > overpower: 0.0
2025-02-03 15:49:00.392 dzVents: > timestamp: 1738597740
2025-02-03 15:49:00.392 dzVents: > counters:
2025-02-03 15:49:00.392 dzVents: > 1: 0.0
2025-02-03 15:49:00.392 dzVents: > 2: 0.0
2025-02-03 15:49:00.392 dzVents: > 3: 0.0
2025-02-03 15:49:00.392 dzVents: > overtemperature: false
2025-02-03 15:49:00.392 dzVents: > ext_humidity:
2025-02-03 15:49:00.393 dzVents: > update:
2025-02-03 15:49:00.393 dzVents: > status: idle
2025-02-03 15:49:00.393 dzVents: > beta_version: 20231107-164450/v1.14.1-rc1-g0617c15
2025-02-03 15:49:00.393 dzVents: > new_version: 20230913-113709/v1.14.0-gcb84623
2025-02-03 15:49:00.393 dzVents: > old_version: 20230913-113709/v1.14.0-gcb84623
2025-02-03 15:49:00.393 dzVents: > has_update: false
2025-02-03 15:49:00.393 dzVents: > inputs:
2025-02-03 15:49:00.393 dzVents: > 1:
2025-02-03 15:49:00.393 dzVents: > input: 0
2025-02-03 15:49:00.393 dzVents: > event_cnt: 0
2025-02-03 15:49:00.393 dzVents: > event:
2025-02-03 15:49:00.393 dzVents: > temperature_status: Normal
2025-02-03 15:49:00.393 dzVents: > mac: 8CAAB5778252
2025-02-03 15:49:00.393 dzVents: > actions_stats:
2025-02-03 15:49:00.394 dzVents: > skipped: 0
2025-02-03 15:49:00.394 dzVents: > mqtt:
2025-02-03 15:49:00.394 dzVents: > connected: false
2025-02-03 15:49:00.394 dzVents: > tmp:
2025-02-03 15:49:00.394 dzVents: > tC: 30.77
2025-02-03 15:49:00.394 dzVents: > tF: 87.38
2025-02-03 15:49:00.394 dzVents: > is_valid: true
2025-02-03 15:49:00.394 dzVents: > fs_size: 233681
2025-02-03 15:49:00.394 dzVents: > has_update: false
2025-02-03 15:49:00.394 dzVents: > uptime: 2266606
and here is the code to get that information

Code: Select all

-- Shelly (get watt)
-- Howto at Luftdaten https://www.domoticz.com/forum/viewtopic.php?f=72&t=23406&hilit=luftdaten
-- Call Shelly with http://192.168.x.x/status
--local Shelly = 'Shelly 21-0'

return {
	active = true,
	on = {
		timer = { 'every 1 minutes' },            -- every minute for testing, 10 minutes when active
		httpResponses = { 'Shelly21Retrieved' }  -- matches callback string below
	},
	logging = {
        -- level: This is the log level you want for this script. 
        -- Can be domoticz.LOG_DEBUG, domoticz.LOG_MODULE_EXEC_DEBUG, domoticz.LOG_DEBUG or domoticz.LOG_DEBUG
        -- marker: A string that is prefixed before each log message. 
        level = domoticz.LOG_ERROR,    
        marker = "Shelly 21 Watt verbruik",
        },
	
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'http://192.168.2.21/status',
				method = 'GET',
				callback = 'Shelly21Retrieved'
			})

		elseif (item.isHTTPResponse) then
			if (item.ok and item.isJSON) then
			    domoticz.log(domoticz.utils.dumpTable(item.json),domoticz.LOG_DEBUG)
				domoticz.devices('Shelly 21').updateCustomSensor(item.json.meters[1].power)                
				-- domoticz.devices('Shelly 21').updateCustomSensor(item.json.meters[2].power)
				-- domoticz.notify('Power     ' .. item.json.meters[1].power, domoticz.PRIORITY_HIGH)     
				-- domoticz.notify('Is_valid  ' .. item.json.meters[1].is_valid, domoticz.PRIORITY_LOW) --howto display TRUE or FALSE?
				domoticz.log('Shelly 21 verbruik : ' ..  item.json.meters[1].power, domoticz.LOG_DEBUG)                         
				-- domoticz.notify('Timestamp ' .. item.json.meters[1].timestamp, domoticz.PRIORITY_LOW)  -- success
			else
				-- oops
				domoticz.log('Error fetching Shelly data' .. item.data, domoticz.LOG_ERROR)
			end
		end
	end
}
Switching is done with a virtual sensor switch and the commands are like this

Code: Select all

http://192.168.2.21/relay/0?turn=on
http://192.168.2.21/relay/0?turn=off
or

Code: Select all

http://192.168.2.21/roller/0?go=open
http://192.168.2.21/roller/0?go=close
These commands can be found at the Shelly site.
Enjoy!

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 16:12
by waltervl
There is also a fantastic python library for shellies as base for a plugin. https://github.com/home-assistant-libs/aioshelly
If you have 1 or 2 shellies a script would do. If you have more and multiple types then a normal integration would be nice.

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 17:36
by marmachine
I have successfully implemented Shelly1 Gen3, however i was lucky that i could lift on work that was done.
On the new Shelly Dimmer Gen3 i am disappointed by Shelly due to lack of documentation, this is not going to work with shellyteacher4domo, developer gave up.

Shelly responded:
"We would like to tell you that we are not currently aware of Domoticz integration at this moment and when it will happen for gen 3 devices"

So, i returned my order to Bulgaria to get it refunded :cry: for now that's the end of Shelly integration, done with their crap!

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 18:52
by HoogendoornJH
Hmm, strange that Shelly is so difficult for Domoticz. It seems to integrate seamlessly into Home Assistant.

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 19:13
by waltervl
HoogendoornJH wrote: Monday 03 February 2025 18:52 Hmm, strange that Shelly is so difficult for Domoticz. It seems to integrate seamlessly into Home Assistant.
The way the author created the current integration with a script adding MQTT AD config topics gave issues with the complex MQTT payload. So that seems to be a not so good decision to go that way. But that is after a lot of work by some people working on that project.

A python plugin for Shelly GEN2/3 based on the old Shelly MQTT plugin for GEN1 devices seems very possible. But it will need support from Shelly to have devices available. And knowledge how to create a python plugin for Domoticz. But there is a lot of work done already.

For reference the old GEN1 plugin:
https://github.com/enesbcs/Shelly_MQTT

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 19:17
by waltervl
Another alternative is the mqttmapper plugin but that perhaps has the same difficulties with the complex message payload of the GEN2/3 shellies viewtopic.php?t=39279

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 19:55
by FireWizard
Hi,

I run both Shelly Gen 1 and Gen 2 devices using MQTT and Node RED, and communicating by MQTT to Domoticz.
Works great for a long period. As far as I understood from the documentation Gen 3 supports MQTT as well, so that should be an easy task to make these available in Domoticz. Unfortunately I do not own a Gen 3 device, yet.

Regards

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 20:32
by HoogendoornJH
Why MQTT and Node RED? Is MQTT alone not sufficient? And what does Node RED add to MQTT?

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 21:23
by marmachine
Thing is that there is no documentation on how to control these Gen3 devices, so integrating is one thing, we can read the published mqtt messages. But controling a dimmer left us guessing, there's lack of documentation.
Shelly support plays stupid and they're good at it.

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 21:34
by FireWizard
Hello @ HoogendoornJH
Why MQTT
MQTT is not necessary, but is very efficient.
See: https://www.iotforall.com/mqtt-vs-http- ... comparison
A HTTP JSON call can also be used.

The downside is you need a broker, such as Mosquitto.
and Node RED
Every IOT device has its own protocol/data format.
Domoticz does not understand every data format available in the IOT world. Shelly has also its own format.
And also Domoticz requires its own format. See the WIKI.

Node RED acts as the translator of those two different formats.
Is MQTT alone not sufficient?
No, as they do not understand each other, because of the different formats.
With some scripting it might be possible, that you implement the other protocol, but that is not for me.
And what does Node RED add to MQTT?
No, Node-RED does not add anything to MQTT, but acts as the translator of the two different data formats.

I hope this answers your questions.

Regards

Re: Shelly support by Domoticz

Posted: Monday 03 February 2025 21:40
by FireWizard
Documentation:

See: https://shelly-api-docs.shelly.cloud/gen2/

Although the link suggests only Gen 2, Gen 3 is included as well.

Re: Shelly support by Domoticz

Posted: Tuesday 04 February 2025 14:19
by FlyingDomotic
You may also have a look at https://github.com/FlyingDomotic/domoti ... per-plugin, which can extract data from MQTT and map it directly to Domoticz devices.

In most complicated cases, you may even extract data to Domoticz string device, and treat it with a LUA/dzVents script