Python Plugin: Shelly MQTT

Python and python framework

Moderator: leecollings

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 »

amwr wrote: Sunday 26 March 2023 19:42 Thanks! Tried it, but I get this message:

Code: Select all

'utf-8' codec can't decode byte 0xb0 in position 1634: invalid start byte                                                                                  
---ERROR: GEN2 device  shellyplus2pm-b8d61a89a20c Shelly1 template not found  
Do you have an idea what the problem could be?
Intresting that you have added "Shelly1" as prefix to your shellyplus2pm. :)

I recommend to delete shellyteacher directory, and git clone again a fresh one. This error means that the database file is corrupted.
rapinou
Posts: 3
Joined: Sunday 26 March 2023 17:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by rapinou »

lwolf wrote: Sunday 26 March 2023 18:17 This line says that %shelly_topic% is equal with homeassistant which is not possible. It should be "shellyplus2pm-5443b23d7858/"
I have a bad feeling that you changed your Shelly device prefix to homeassistant instead of a proper unique prefix...
I restarted the configuration: I deleted the devices in Domoticz and gave a unique mqtt prefix to the Shelly device before starting the script. Same result.
I have relay 0, relay 1, input 0 and input 1 creating in Domoticz ok, but not cover.
The log :
2023-03-26 20:24:26 102 Error: MQTT Auto Discovery: MQTT_Discovery: Invalid/Unhandled data received! (Topic: homeassistant/cover/shellyplus2pm-5443b23d7858-roller-0/config, Message: {"name": "shellyplus2pm-5443b23d7858 Roller 0", "enabled_by_default": false, "cmd_t": "~rpc", "pl_open": "{\"id\":0,\"src\":\"domoticz\",\"method\":\"Cover Open\",\"params\":{\"id\":0}}", "pl_cls": "{\"id\":0,\"src\":\"domoticz\",\"method\":\"Cover Close\",\"params\":{\"id\":0}}", "pl_stop": "{\"id\":0,\"src\":\"domoticz\",\"method\":\"Cover Stop\",\"params\":{\"id\":0}}", "stat_t": "~status/cover:0", value_template: "{{ value_json state }}","state_closing": "closing","state_opening": "opening","state_open": "open","state_stopped": "stopped","state_closed": "closed","pos_t": "~status/cover:0", "pos_tpl": "{{ value_json current_pos }}","pos_open": 100, "pos_clsd": 0, "uniq_id": "shellyplus2pm-5443b23d7858-roller-0", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "qos": 1, "~": "ShellyPlus2PM1/"})
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 »

rapinou wrote: Sunday 26 March 2023 20:36 I have relay 0, relay 1, input 0 and input 1 creating in Domoticz ok, but not cover.
The log :
... "stat_t": "~status/cover:0", value_template: "{{ value_json state }}"...
Yep, this template is from an older version of shellyteacher4domo. Please download latest from github.
AimoPaukku
Posts: 43
Joined: Saturday 28 January 2017 9:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Contact:

Re: Python Plugin: Shelly MQTT

Post by AimoPaukku »

lwolf wrote: Sunday 26 March 2023 15:35
Than please show your mosquitto.conf file, and check if mosquitto persistence file exists and can be accessed.
:shock: How?

I have mosquetto in my raspi, but my Linux skills are just copy-paste.

I use MQTT explorer at my PC
It shows after rebooting Shellies folder and everything in it seems ok
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 »

AimoPaukku wrote: Monday 27 March 2023 20:53
lwolf wrote: Sunday 26 March 2023 15:35 Than please show your mosquitto.conf file, and check if mosquitto persistence file exists and can be accessed.
:shock: How?
mosquitto.conf located in /etc/mosquitto as default. this command will show it on screen:
cat /etc/mosquitto/mosquitto.conf

See Steve's Internet Guide:
http://www.steves-internet-guide.com/mo ... conf-file/

Unless if you are using a docker/snap image, in this case mosquitto broker is running INSIDE your image, and you may contact the publisher of the image about how you can configure mosquitto settings...
AimoPaukku wrote: Monday 27 March 2023 20:53 I use MQTT explorer at my PC
It shows after rebooting Shellies folder and everything in it seems ok
Awesome. But autodiscovery config informations stored under "homeassistant/" in MQTT. "shellies/" only contains actual sensor data and nothing about how to handle them. Config has to be saved by mosquitto in its persistence file...
https://iot.stackexchange.com/questions ... figuration
AimoPaukku
Posts: 43
Joined: Saturday 28 January 2017 9:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Contact:

Re: Python Plugin: Shelly MQTT

Post by AimoPaukku »

Too hard to understand... I read this many times but have no clue what to do...
I hate linux. :evil:

Code: Select all

pi@raspberrypi:~ $ cat /etc/mosquitto/mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

allow_anonymous false
password_file /etc/mosquitto/pwfile
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 »

AimoPaukku wrote: Friday 31 March 2023 13:33 Too hard to understand... I read this many times but have no clue what to do...
I hate linux. :evil:

Code: Select all

pi@raspberrypi:~ $ cat /etc/mosquitto/mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

allow_anonymous false
password_file /etc/mosquitto/pwfile
Config seems ok, it says that persistence is true and saved into /var/lib/mosquitto directory - at least mosquitto is trying to save to there.

You can check if an error occured in the log with:
cat /var/log/mosquitto/mosquitto.log

My log says:

Code: Select all

1680273942: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
If your log contains some error, we can see more clearly.

(when i checked the contents of /var/lib/mosquitto/mosquitto.db i see Retained MQTT values, before rebooting and after rebooting also, this is the expected behavior)
amwr
Posts: 20
Joined: Wednesday 28 October 2015 17:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: Switzerland
Contact:

Re: Python Plugin: Shelly MQTT

Post by amwr »

lwolf wrote: Sunday 26 March 2023 20:01
amwr wrote: Sunday 26 March 2023 19:42 Thanks! Tried it, but I get this message:

Code: Select all

'utf-8' codec can't decode byte 0xb0 in position 1634: invalid start byte                                                                                  
---ERROR: GEN2 device  shellyplus2pm-b8d61a89a20c Shelly1 template not found  
Do you have an idea what the problem could be?
Intresting that you have added "Shelly1" as prefix to your shellyplus2pm. :)

I recommend to delete shellyteacher directory, and git clone again a fresh one. This error means that the database file is corrupted.
Shelly1 was just a sample name for this forum ;)
Re-installed and it works now. The Pro3EM also works fine, thank you!
User avatar
TiXav
Posts: 38
Joined: Saturday 28 November 2015 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: Shelly MQTT

Post by TiXav »

Yes, shellyteacher4domo.py (https://github.com/enesbcs/shellyteacher4domo) works very well (for 1 shellyplus2pm and 2 shellyplus1)
I will wire Shelly Plus I4 soon.

note there is just this message (not boring, the devices does not reboot often) when reboot shellyS in domoticz log :
2023-05-11 18:35:24.338 Error: MQTT: Select device doesn't have the option for received STATE "scheduled_restart")

Thank you a lot, a lot
ssk17051980
Posts: 112
Joined: Thursday 08 December 2022 22:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: ROMANIA
Contact:

Re: Python Plugin: Shelly MQTT

Post by ssk17051980 »

i just install Shelly_MQTT
no error.
i check my python version, because i see that it's a condition to have python 3.5
i see that i have 2 version of python on my rpi.

xxxxx:~ $ python -V
Python 2.7.16
xxxxx:~ $ python3 -V
Python 3.7.3

i can't find/see my Shelly in domoticz
any solution ?

thx
ssk17051980
Posts: 112
Joined: Thursday 08 December 2022 22:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: ROMANIA
Contact:

Re: Python Plugin: Shelly MQTT

Post by ssk17051980 »

ssk17051980 wrote: Saturday 13 May 2023 17:21 i just install Shelly_MQTT
no error.
plugin create the device, but i do not see the total energy



thx
Attachments
sma.jpg
sma.jpg (151.44 KiB) Viewed 3345 times
Untitled.jpg
Untitled.jpg (203.36 KiB) Viewed 3345 times
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 »

ssk17051980 wrote: Saturday 13 May 2023 23:49 plugin create the device, but i do not see the total energy
If you do not see the total energy, maybe it is a good idea to enable Power reading in plugin settings:

https://github.com/enesbcs/Shelly_MQTT/ ... working%3F
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 »

TiXav wrote: Friday 12 May 2023 8:05 note there is just this message (not boring, the devices does not reboot often) when reboot shellyS in domoticz log :
2023-05-11 18:35:24.338 Error: MQTT: Select device doesn't have the option for received STATE "scheduled_restart")
I think it is "input_event-0" Domoticz do not like if an option arrives from the device which is not defined in the template..
Maybe you can add "scheduled_restart" at the end of "ops" from:
"ops":["-","btn_down","btn_up","single_push","double_push","triple_push","long_push"]
to:
"ops":["-","btn_down","btn_up","single_push","double_push","triple_push","long_push","scheduled_restart"]
ssk17051980
Posts: 112
Joined: Thursday 08 December 2022 22:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: ROMANIA
Contact:

Re: Python Plugin: Shelly MQTT

Post by ssk17051980 »

lwolf wrote: Sunday 21 May 2023 17:05
ssk17051980 wrote: Saturday 13 May 2023 23:49 plugin create the device, but i do not see the total energy
If you do not see the total energy, maybe it is a good idea to enable Power reading in plugin settings:

https://github.com/enesbcs/Shelly_MQTT/ ... working%3F
for the moment i see the energy.
the bad part is that there are 3 phases, and I have to find a formula that will show me the total.
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by CronoS »

TiXav wrote: Friday 12 May 2023 8:05 Yes, shellyteacher4domo.py (https://github.com/enesbcs/shellyteacher4domo) works very well (for 1 shellyplus2pm and 2 shellyplus1)
I will wire Shelly Plus I4 soon.

note there is just this message (not boring, the devices does not reboot often) when reboot shellyS in domoticz log :
2023-05-11 18:35:24.338 Error: MQTT: Select device doesn't have the option for received STATE "scheduled_restart")

Thank you a lot, a lot
I still see Beta in the discription with a big disclaimer on it not to use in a Production enviroment. Now is my home not really a Corporate production environment :), but it does needs to be stable. Is there any idea why this disclaimer is written like this? Is this plugin not reliable yet because of this discalmer? I am still using the old Shelly MQTT plugin; but I want to change that because there is no active development on it 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 »

CronoS wrote: Monday 07 August 2023 16:50 I still see Beta in the discription with a big disclaimer on it not to use in a Production enviroment. Now is my home not really a Corporate production environment :), but it does needs to be stable. Is there any idea why this disclaimer is written like this? Is this plugin not reliable yet because of this discalmer? I am still using the old Shelly MQTT plugin; but I want to change that because there is no active development on it anymore..
New MQTT Teacher is not really a plugin, although if the shelly device is recognized, and works in Domoticz it will be more stable than the old plugin. Why? As the old plugin is based on python and it proved to be unstable by its nature (sadly).
The Teacher on the other hand is not a plugin, _not_ required to run in the background or a service, it has to be run at once: in the detection phase. After that, the Domoticz MQTT Autodiscovery hardware does the real job with the detected shelly devices, which is written in C and its part of the Domoticz binary. (it makes stable and versatile IMHO)

Why is it still beta?
The new method works for me, without problems. Although i had certain knowledge about Linux installation, firewall, MQTT broker, retain function, etc, which average users may not have, so sometimes I don't understand what they don't understand. :)
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: Monday 07 August 2023 19:19 New MQTT Teacher is not really a plugin, although if the shelly device is recognized, and works in Domoticz it will be more stable than the old plugin. Why? As the old plugin is based on python and it proved to be unstable by its nature (sadly).
The Teacher on the other hand is not a plugin, _not_ required to run in the background or a service, it has to be run at once: in the detection phase. After that, the Domoticz MQTT Autodiscovery hardware does the real job with the detected shelly devices, which is written in C and its part of the Domoticz binary. (it makes stable and versatile IMHO)

Why is it still beta?
The new method works for me, without problems. Although i had certain knowledge about Linux installation, firewall, MQTT broker, retain function, etc, which average users may not have, so sometimes I don't understand what they don't understand. :)
Thanks for the answer; appreciate this. I will change it to this version so that I am also able to use Gen2 devices better. But I have allot of devices, so enabling this will add allot of stuff in Domoticz then ;) This is something for in the weekend ;)

But a question still; the discovery process of Gen2 devices, these are not using the Autodiscover scripts on the Gen2 Shelly devices by itself? I have one Gen2 device (others are still Gen1); where the Homeassist autodiscover broadcast is being used and where Domoticz detect this. This works, but I don't find this a stable solution because I need to reboot the Shelly from time to time where it stops working because it is depended on the Scripts engine on the Shelly which has some issue's

I see that there is a limitation with kwh readings; is this not workig at all, or is there something still usable in this? Also I have one Shelly Gen 1 RGBW2 device (Using it in White mode); this one does not work, as far as I can see with this method right?
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Python Plugin: Shelly MQTT

Post by Xavier82 »

Hi,

I have always used the Shelly MQTT plugin in Domoticz but now I'm forced to use the Domoticz "MQTT Auto Discovery Client Gateway" since 1 of my Shelly 2.5 (roller/cover mode) died after 4 years or so, so I replaced it with a new Shelly Plus 2PM.
Since the Shelly Plus 2PM is a gen2 device I had to look for an other solutions to get it to work, so I found "ShellyTeacher 4 Domoticz".

First of all I want to thank Alexander Nagy (enesbcs) for all of his work!
But I have an issue.....

My setup (test):
Raspberry Pi4b 8GB version, SSD M2 drive
Bullseye, fully updated/upgraded
Domoticz version: Version 2023.2

The issue:
Running the ShellyTeacher4Domo.py works fine, the Shelly Plus 2pm is detected, in Domoticz I also see incoming messages to "MQTT Auto Discovery" in logging:

Code: Select all

2023-08-09 11:56:17.139 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-temperature-0/shellyplus2pm-XXXX Temperature 0 (unique_id: shellyplus2pm-XXXX-temperature-0)
2023-08-09 11:56:17.240 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-0/shellyplus2pm-XXXX Voltage 0 (unique_id: shellyplus2pm-XXXX-0-voltage)
2023-08-09 11:56:17.341 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-0/shellyplus2pm-XXXX Power 0 (unique_id: shellyplus2pm-XXXX-0-power)
2023-08-09 11:56:17.442 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-0/shellyplus2pm-XXXX Energy 0 (unique_id: shellyplus2pm-XXXX-0-energy)
2023-08-09 11:56:17.543 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-temperature-1/shellyplus2pm-XXXX Temperature 1 (unique_id: shellyplus2pm-XXXX-temperature-1)
2023-08-09 11:56:17.643 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1/shellyplus2pm-XXXX Voltage 1 (unique_id: shellyplus2pm-XXXX-1-voltage)
2023-08-09 11:56:17.744 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1/shellyplus2pm-XXXX Power 1 (unique_id: shellyplus2pm-XXXX-1-power)
2023-08-09 11:56:17.845 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1/shellyplus2pm-XXXX Energy 1 (unique_id: shellyplus2pm-XXXX-1-energy)
2023-08-09 11:56:17.946 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-roller-0/shellyplus2pm-XXXX Roller 0 (unique_id: shellyplus2pm-XXXX-roller-0)
2023-08-09 11:56:18.049 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-roller-pos/shellyplus2pm-XXXX Roller Pos (unique_id: shellyplus2pm-XXXX-roller-pos)
2023-08-09 11:56:28.974 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX/homeassistant Relay 0 (unique_id: shellyplus2pm-XXXX-0)
2023-08-09 11:56:29.075 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX/homeassistant Input 0 (unique_id: shellyplus2pm-XXXX-0-input)
2023-08-09 11:56:29.177 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-temperature-0/shellyplus2pm-XXXX Temperature 0 (unique_id: shellyplus2pm-XXXX-temperature-0)
2023-08-09 11:56:29.277 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-0/shellyplus2pm-XXXX Voltage 0 (unique_id: shellyplus2pm-XXXX-0-voltage)
2023-08-09 11:56:29.378 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-0/shellyplus2pm-XXXX Power 0 (unique_id: shellyplus2pm-XXXX-0-power)
2023-08-09 11:56:29.479 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-0/shellyplus2pm-XXXX Energy 0 (unique_id: shellyplus2pm-XXXX-0-energy)
2023-08-09 11:56:29.580 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1/homeassistant Relay 1 (unique_id: shellyplus2pm-XXXX-1)
2023-08-09 11:56:29.681 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1-input/homeassistant Input 1 (unique_id: shellyplus2pm-XXXX-1-input)
2023-08-09 11:56:29.782 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-temperature-1/shellyplus2pm-XXXX Temperature 1 (unique_id: shellyplus2pm-XXXX-temperature-1)
2023-08-09 11:56:29.883 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1/shellyplus2pm-XXXX Voltage 1 (unique_id: shellyplus2pm-XXXX-1-voltage)
2023-08-09 11:56:29.984 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1/shellyplus2pm-XXXX Power 1 (unique_id: shellyplus2pm-XXXX-1-power)
2023-08-09 11:56:30.084 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1/shellyplus2pm-XXXX Energy 1 (unique_id: shellyplus2pm-XXXX-1-energy)
2023-08-09 11:56:30.186 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-roller-0/shellyplus2pm-XXXX Roller 0 (unique_id: shellyplus2pm-XXXX-roller-0)
2023-08-09 11:56:30.288 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-roller-pos/shellyplus2pm-XXXX Roller Pos (unique_id: shellyplus2pm-XXXX-roller-pos)
2023-08-09 11:57:00.210 MQTT Auto Discovery: Light/Switch/Switch (shellyplus2pm-XXXX Roller 0)
2023-08-09 11:57:00.217 MQTT Auto Discovery: Light/Switch/Switch (shellyplus2pm-XXXX Roller Pos)
But when I go to the device tab I can only see the device "Roller 0" and "Roller Pos" but not devices are being created for the voltage, power, energy or temperature.
In the "mqtt_templates_gen2.txt" file I can see that these values are identified.

What am I doing wrong?
How can I fix this?

Hope somebody can help.

Thanks!
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: Tuesday 08 August 2023 22:16 But a question still; the discovery process of Gen2 devices, these are not using the Autodiscover scripts on the Gen2 Shelly devices by itself? I have one Gen2 device (others are still Gen1); where the Homeassist autodiscover broadcast is being used and where Domoticz detect this. This works, but I don't find this a stable solution because I need to reboot the Shelly from time to time where it stops working because it is depended on the Scripts engine on the Shelly which has some issue's
Shelly Teacher waits for Gen2 devices "+/online" announcements, than it tries to figure out what is this device, and then sends the config template to the proper MQTT "homeassistant/" path. If you enable retain settings and make sure, that persistent storage is enabled and works on your MQTT broker, these settings will be saved... otherwise the config template needs to be sent again.
https://pagefault.blog/2020/02/05/how-t ... tt-broker/
CronoS wrote: Tuesday 08 August 2023 22:16 I see that there is a limitation with kwh readings; is this not workig at all, or is there something still usable in this?
Can be enabled, but wont be accurate as it needs to be divided by 60. Domoticz currently has no working template for inline divison. This is the reason why i disable it automatically at creation time.
Maybe it can be hacked by NodeRed, not sure.... Or as i proposed: if you change "Wh" unit to "Wm" in templates.txt than it may be created as Custom sensor, and you can use as is.
https://github.com/enesbcs/shellyteacher4domo/issues/6
CronoS wrote: Tuesday 08 August 2023 22:16 Also I have one Shelly Gen 1 RGBW2 device (Using it in White mode); this one does not work, as far as I can see with this method right?
RGB mode is not working, as Domoticz only has a partial implementation, i guess it only supports zigbee2mqtt and zwave MQTT messages, and has no template support at all.
https://github.com/enesbcs/shellyteacher4domo/issues/7

RGBW2 white only support added at commit https://github.com/enesbcs/shellyteache ... 947c2952a3 for testing.
Last edited by lwolf on Sunday 13 August 2023 16:24, edited 1 time in total.
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 »

Xavier82 wrote: Wednesday 09 August 2023 13:22 But when I go to the device tab I can only see the device "Roller 0" and "Roller Pos" but not devices are being created for the voltage, power, energy or temperature.
In the "mqtt_templates_gen2.txt" file I can see that these values are identified.
Domoticz MQTT Autodiscovery hardware only creates the detected devices when the first values arrived from them, and not before.

If you are not getting values for several minutes, then make sure to enable "Generic status update over MQTT" at MQTT settings page on the Shelly2 PM devices (as this is written in the README) and reboot it. Usually I am using MQTT Explorer application to debug if the mqtt broker got any messages from a device....
Xavier82 wrote: Wednesday 09 August 2023 13:22

Code: Select all

2023-08-09 11:56:28.974 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX/homeassistant Relay 0 (unique_id: shellyplus2pm-XXXX-0)
2023-08-09 11:56:29.075 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX/homeassistant Input 0 (unique_id: shellyplus2pm-XXXX-0-input)
2023-08-09 11:56:29.580 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1/homeassistant Relay 1 (unique_id: shellyplus2pm-XXXX-1)
2023-08-09 11:56:29.681 Status: MQTT Auto Discovery: discovered: shellyplus2pm-XXXX-1-input/homeassistant Input 1 (unique_id: shellyplus2pm-XXXX-1-input)
These are very funny lines... i hope you are not changed your shelly2pm MQTT base path to "homeassistant/", i have never seen a Relay before which is named as "homeassistant." :D
Last edited by lwolf on Friday 11 August 2023 17:59, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest