Python Plugin: Shelly MQTT

Python and python framework

Moderator: leecollings

User avatar
jacobsentertainment
Posts: 211
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Python Plugin: Shelly MQTT

Post by jacobsentertainment »

Ok I got it working, devices are added to the list now... :lol:
what did I do wrong, I mistook the mqtt client gateway for the mqtt with auto discovery

After I added it it went automatically, so my mistake.

A few comments, though.

All options of for example a dimmer appear, on its own this is good but can these be preset that they are not completely added, I mean you can make your own selection which ones you want to actively add. (instead of putting all parts unused afterwards )

I also noticed that the feedback of the dimmer does not work optimally, in the old shelly mqtt the slider is linked to the dimmer, this is not the case with teacher, I can dim the dimmer but I get no feedback. Also, I can no longer switch on the dimmer with the slider, first switch on the knob and then set the setting in the slider.
If i go to the shelly http page and slide the slider to 60% this is not connected to the actual slider in domoticz. Also scripting in dzvent is changed.


One more question, can we use the old shelly-mqtt to the side of this, so I can have my dimmers trough shelly-mqtt and add the new device like the trv and i4 trough teacher4domoticz? Or is this something we have to figure out ourselfs?
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Python Plugin: Shelly MQTT

Post by lwolf »

jacobsentertainment wrote: Wednesday 20 September 2023 11:33 Ok I got it working, devices are added to the list now... :lol:
what did I do wrong, I mistook the mqtt client gateway for the mqtt with auto discovery

jacobsentertainment wrote: Wednesday 20 September 2023 11:33 I mean you can make your own selection which ones you want to actively add. (instead of putting all parts unused afterwards )
You can edit mqtt_templates.txt freely as it is a simple text file (every windows user has the notepad at least), and you can remove any parts you do not need. I made it with a purpose: to let users customize their own needs by themself.
jacobsentertainment wrote: Wednesday 20 September 2023 11:33 I also noticed that the feedback of the dimmer does not work optimally, in the old shelly mqtt the slider is linked to the dimmer, this is not the case with teacher, I can dim the dimmer but I get no feedback. Also, I can no longer switch on the dimmer with the slider, first switch on the knob and then set the setting in the slider.
If i go to the shelly http page and slide the slider to 60% this is not connected to the actual slider in domoticz.
Status topic is provided to the Domoticz AD, so in theory it should work. I will check it and collect some mqtt payloads to report an issue to upstream domoticz.
jacobsentertainment wrote: Wednesday 20 September 2023 11:33 Also scripting in dzvent is changed.
Its not plugin related.
jacobsentertainment wrote: Wednesday 20 September 2023 11:33 One more question, can we use the old shelly-mqtt to the side of this, so I can have my dimmers trough shelly-mqtt and add the new device like the trv and i4 trough teacher4domoticz? Or is this something we have to figure out ourselfs?
Yes of course you can use both plugins at a time. As i mentioned, you can delete anything from your mqtt_templates.txt its structure is very simple, if a device ID is not found in the templates, than the Teacher will not create config objects...
User avatar
jacobsentertainment
Posts: 211
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Python Plugin: Shelly MQTT

Post by jacobsentertainment »

Thanks for the reply,

I'm still struggling with the dimmers. Normally I was able to use "dimTo(30)" in DZvent but that doesn't work anymore probably due to not being able to use the slider to switch on the device. Now i have to split up the action to switchOn() and then dimTo(30).afterSec(1) in many scripts, it's maybe nog due to the plugin but more between de transport of data.

If you would have a look in to it that would really save the day here :mrgreen:
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Python Plugin: Shelly MQTT

Post by lwolf »

jacobsentertainment wrote: Tuesday 26 September 2023 10:52 Thanks for the reply,

I'm still struggling with the dimmers. Normally I was able to use "dimTo(30)" in DZvent but that doesn't work anymore probably due to not being able to use the slider to switch on the device. Now i have to split up the action to switchOn() and then dimTo(30).afterSec(1) in many scripts, it's maybe nog due to the plugin but more between de transport of data.

If you would have a look in to it that would really save the day here :mrgreen:
Its a limitation of Domoticz MQTT Autodiscovery hardware. It has a command topic which sends "turn:on" to Shelly on switchOn() command, and a brightness topic which sends out brightness value on dimTo() to Shelly. But as Domoticz has no template support, there are nothing i can do for this matter, i am unable to add "turn:on" command automatically before brightness. And for some reason Shelly hardware wont switch on itself on brightness command, when its in turned off state..
Last edited by lwolf on Saturday 30 September 2023 20:48, edited 1 time in total.
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by CronoS »

Anyone tested the plugin with the new Shelly mini? Thanks!
User avatar
jacobsentertainment
Posts: 211
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Python Plugin: Shelly MQTT

Post by jacobsentertainment »

Today a new beta update installed (2023,2 build 15578)
After installing, reboot and clearing the cache domoticz was working except the shelly dimmers. All other data is there temperatures, setpoints and shelly em3.
The shelly dimmers can only be switched off once and can't be switched on or change the level.
Tried to reboot the dimmer and teach it as a new device but no luck. Issues stays. No errors in the log, just no communication.

Update, within an hour updated to (2023,2 build 1581) still the same. (wat een gepruts)
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Python Plugin: Shelly MQTT

Post by lwolf »

jacobsentertainment wrote: Friday 06 October 2023 11:23 Today a new beta update installed (2023,2 build 15578)
After installing, reboot and clearing the cache domoticz was working except the shelly dimmers. All other data is there temperatures, setpoints and shelly em3.
The shelly dimmers can only be switched off once and can't be switched on or change the level.
Tried to reboot the dimmer and teach it as a new device but no luck. Issues stays. No errors in the log, just no communication.

Update, within an hour updated to (2023,2 build 1581) still the same. (wat een gepruts)
Yes, its the nature of beta releases... Dimmer status update fixed, but caused to mess switching on. Its in progress:
https://github.com/domoticz/domoticz/issues/5824

Its communicating, but for some reason sending out brightness command instead of turn:on, which will never turn on a Shelly. :D
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Python Plugin: Shelly MQTT

Post by lwolf »

CronoS wrote: Thursday 05 October 2023 12:02 Anyone tested the plugin with the new Shelly mini? Thanks!
The plugin will never got mini support, the Teacher app will get.. if somebody tell me what MQTT topics and payloads to use. :)
As currently there is ZERO information about the new Mini in the official documentation:
https://shelly-api-docs.shelly.cloud/ge ... ices/Mqtt/#
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Python Plugin: Shelly MQTT

Post by FireWizard »

Hi @lwolf,

The API for the mini is the same as for the standard device.
See: https://shelly-api-docs.shelly.cloud/ge ... lyPlus1PM/

Regards
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by CronoS »

lwolf wrote: Sunday 08 October 2023 16:32
CronoS wrote: Thursday 05 October 2023 12:02 Anyone tested the plugin with the new Shelly mini? Thanks!
The plugin will never got mini support, the Teacher app will get.. if somebody tell me what MQTT topics and payloads to use. :)
As currently there is ZERO information about the new Mini in the official documentation:
https://shelly-api-docs.shelly.cloud/ge ... ices/Mqtt/#
Yes ofcourse I mean the Teacher App. Maybe it is wise to rebrand this topic to Shelly Teacher App, because the Shelly_MQTT plugin is not supported anymore.
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Python Plugin: Shelly MQTT

Post by lwolf »

FireWizard wrote: Sunday 08 October 2023 22:13 Hi @lwolf,

The API for the mini is the same as for the standard device.
See: https://shelly-api-docs.shelly.cloud/ge ... lyPlus1PM/

Regards
Thanks! Gen2 docs seems very nice, but unfortunately it lacks what Tim Berners-Lee invented the WWW for: information!

When i check a Gen1 doc:
https://shelly-api-docs.shelly.cloud/ge ... ly2-5-mqtt

I see _immediately_ that i have to write payload: '1' to topic: 'shellies/shellyswitch25-<deviceid>/relay/0/command' to switch on a device.
And "SHSW-25" is the model ID for detection.

But if check a Gen2 doc:
https://shelly-api-docs.shelly.cloud/ge ... lyPlus1PM/

I see only hyperlinks and tables, without one usable example.... I've found _every usable MQTT information_ by Google, when i added Gen2 devices. :D
All i can see, that it has Input:0 and Switch:0 the same as ShellyPlus1 so it will surely work... if somebody tell me, what topic it uses... :D
Maybe shellyplus1mini? Just a hunch, as not documented.
User avatar
jacobsentertainment
Posts: 211
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Python Plugin: Shelly MQTT

Post by jacobsentertainment »

lwolf wrote: Sunday 08 October 2023 16:26
Yes, its the nature of beta releases... Dimmer status update fixed, but caused to mess switching on. Its in progress:
https://github.com/domoticz/domoticz/issues/5824

Its communicating, but for some reason sending out brightness command instead of turn:on, which will never turn on a Shelly. :D

Today installed latest update 15620 and now it's possible to switch on with use of the slider like before, except the feedback isn't working once clicked on the button to switch off the button stays on and the actual light goes off.
The feedback on the slider is working except the status of the device on or off isn't.
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Python Plugin: Shelly MQTT

Post by lwolf »

jacobsentertainment wrote: Thursday 26 October 2023 9:07 Today installed latest update 15620 and now it's possible to switch on with use of the slider like before, except the feedback isn't working once clicked on the button to switch off the button stays on and the actual light goes off.
The feedback on the slider is working except the status of the device on or off isn't.
You have to download latest ShellyTeacher, delete existing Shelly dimmer devices from Domoticz and reteach them with Teacher, as config object changed.
User avatar
capman
Posts: 153
Joined: Friday 12 July 2013 20:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Shelly MQTT

Post by capman »

I have a strange behavior with mqtt auto discover and shelly blinds.
When the blinds are OPEN I get a flood of logging (OPEN, CLOSE,...)
When I close my blind, (Kris:(IP:...), there is one logging OPEN and CLOSE and then it stops. But when blinds
are back open I get a flood off logs , (OPEN , CLOSED, ...)!
And the user is mqtt auto discover :shock:
Is this a error or ? See screenshots
I used the latest ShellyTeacher for adding my shelly devices. Great work !
log blinds open closed.jpg
log blinds open closed.jpg (289.44 KiB) Viewed 1805 times
(edit)
Add some more info with screenshot from mqtt explorer
mqtt explorer.jpg
mqtt explorer.jpg (28.71 KiB) Viewed 1786 times
User avatar
capman
Posts: 153
Joined: Friday 12 July 2013 20:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Shelly MQTT

Post by capman »

capman wrote: Wednesday 01 November 2023 13:14 I have a strange behavior with mqtt auto discover and shelly blinds.
When the blinds are OPEN I get a flood of logging (OPEN, CLOSE,...)
When I close my blind, (Kris:(IP:...), there is one logging OPEN and CLOSE and then it stops. But when blinds
are back open I get a flood off logs , (OPEN , CLOSED, ...)!
And the user is mqtt auto discover :shock:
Is this a error or ? See screenshots
I used the latest ShellyTeacher for adding my shelly devices. Great work !

log blinds open closed.jpg

(edit)
Add some more info with screenshot from mqtt explorer

mqtt explorer.jpg
I know what the problem was. Accept new hardware/sensor was enabled. As soon I disable it the logs stopped 8-)
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Python Plugin: Shelly MQTT

Post by lwolf »

capman wrote: Tuesday 07 November 2023 17:16 I know what the problem was. Accept new hardware/sensor was enabled. As soon I disable it the logs stopped 8-)
I hope you also stopped ShellyTeacher, as running continously is not needed.
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Python Plugin: Shelly MQTT

Post by lwolf »

ShellyTeacher has got a new topic
viewtopic.php?t=40998
User avatar
capman
Posts: 153
Joined: Friday 12 July 2013 20:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python Plugin: Shelly MQTT

Post by capman »

lwolf wrote: Tuesday 07 November 2023 17:22
capman wrote: Tuesday 07 November 2023 17:16 I know what the problem was. Accept new hardware/sensor was enabled. As soon I disable it the logs stopped 8-)
I hope you also stopped ShellyTeacher, as running continously is not needed.
I did :D . The problem was that I enabled a notification for the action blinds closed. So I get repeately a flow of blinds closed :? .
As soon a enable 'accept new hardware' , I get again notification flood when the blinds are open.
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by tjabas »

i finally got my shelly plus 1pm partially working in domoticz, but i can only turn the switch on, not off.

what can be wrong?
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Shelly MQTT

Post by waltervl »

tjabas wrote: Thursday 23 November 2023 12:33 i finally got my shelly plus 1pm partially working in domoticz, but i can only turn the switch on, not off.

what can be wrong?
Shelly plugin or Shelly Teacher script? For teacher script use topic viewtopic.php?t=40998
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest