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 »

zygios wrote: Monday 04 February 2019 19:48 I'm running on ARMBIAN 5.60 stable Ubuntu 18.04.1 LTS 4.14.84-sunxi
Python 3.6.7 version.

Mqtt:
MQTT Client Gateway with LAN interface 192.168.6.40 1883
Shelly MQTT 192.168.6.40 1883
Shelly 2 with The current Firmware version of your Shelly device is 20190122-162045/v1.4.5@5cbc6229 No newer firmware available.

How to get domoticz logfiles?
So far looks good.
And Domoticz version?
Logfiles can be under /var/log/domoticz.log as per:
https://www.domoticz.com/forum/viewtopic.php?t=22605
(or other places where your /etc/init.d/domoticz.sh points)

Usually i am viewing the Logs in the browser in the Domoticz, when trying to debug some errors..
swejmansson
Posts: 6
Joined: Saturday 10 March 2018 13:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by swejmansson »

Hi,

Installed a Shelly 2 yesterday and got it connected to my mosquitto broker running on Pi3(same as Domoticz). Subscribed with another client to verify....
I have installed the plugin and configured it but as soon as i start/enable it Domoticz will stop.
Running latest stable Domoticz and a verison of Python that should work(if I got it right). Have tried to disable all the other plugins as a test but no success.
My installation works perfectly and there are no issues with any other plugin. Strange....what suggestions do you have?

The current Firmware version of Shelly device is 20190208-145233/v1.4.6@a030bf96 No newer firmware available. Domoticz:
4.jpg
4.jpg (33.58 KiB) Viewed 3838 times
Fourth row from top is Domoticz stopping when enable and update. Then tried to start it again.
6.jpg
6.jpg (386.91 KiB) Viewed 3838 times
5.jpg
5.jpg (197.38 KiB) Viewed 3838 times
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

Hi,
I'm using this Plugin for some weeks right without any issues.
I'm running on Domoticz latest beta.

Today I've updated the plugin to the latest version, after this plugin stops working after some minutes, also domoticz will go down.
Last messages in log: domoticz: ShellyMQTT hardware (15) thread seems to have ended unexpectedly

After restarting Domoticz it works for maybe 10 Minutes, and than it happens again. Updating Domoticz to the latest beta will not solve the problem.
If I disable MQTT Plugin in Hardware, Domoticz is working stable.

Do someone have a hint, what I can do, to get it reliable again?
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 »

minime wrote: Tuesday 12 February 2019 16:45 for maybe 10 Minutes, and than it happens again. Updating Domoticz to the latest beta will not solve the problem.
If I disable MQTT Plugin in Hardware, Domoticz is working stable.

Do someone have a hint, what I can do, to get it reliable again?
When you updated the Shelly_MQTT did you overwrite the old mqtt.py AND plugin.py in your Shelly_MQTT directory?
Please provide logs with DEBUG settings enabled in the plugin.
Last edited by lwolf on Tuesday 12 February 2019 19:32, 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 »

swejmansson wrote: Monday 11 February 2019 23:01 I have installed the plugin and configured it but as soon as i start/enable it Domoticz will stop.
Running latest stable Domoticz and a verison of Python that should work(if I got it right). Have tried to disable all the other plugins as a test but no success.
Looks like that something at the Init section is not working well, as plugin related messages comes after "Entering work loop".
mqtt.py was changed last time, with one new parameter, can be a problem if an old mqtt.py located near plugin.py.
In 0.3.2 i've added more exception handling to throw some error messages at the init stage to give some idea about the problem.
Altough Python 3.4.2 is not so fresh i've found 3.4.9 as the oldest possible to install onto an Ubuntu 18.04. Python 3.6.7 works well based on user feedbacks:
https://github.com/enesbcs/Shelly_MQTT/issues/5

And please enable plugin DEBUG setting when you try to send some error reports...

However mine installation works well with Python 3.4.9:
Attachments
shelly_domo_032.png
shelly_domo_032.png (146.53 KiB) Viewed 3822 times
swejmansson
Posts: 6
Joined: Saturday 10 March 2018 13:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by swejmansson »

lwolf wrote: Tuesday 12 February 2019 19:19 Looks like that something at the Init section is not working well, as plugin related messages comes after "Entering work loop".
mqtt.py was changed last time, with one new parameter, can be a problem if an old mqtt.py located near plugin.py.
In 0.3.2 i've added more exception handling to throw some error messages at the init stage to give some idea about the problem.
Altough Python 3.4.2 is not so fresh i've found 3.4.9 as the oldest possible to install onto an Ubuntu 18.04. Python 3.6.7 works well based on user feedbacks:
https://github.com/enesbcs/Shelly_MQTT/issues/5

And please enable plugin DEBUG setting when you try to send some error reports...

However mine installation works well with Python 3.4.9:
Thanks for the reply lwolf! :)
Did some further tests tonight....
Removed folder plugins/Shelly_MQTT, installed it again. Enabled debugging for plugin, tried both alternatives, the log in domoticz still looks the same.
Domoticz stops after "Entering work loop".
Did some research on changing the logging level for domoticz, but did not succeed.
Think I will clone my card and try to install Python 3.6.7 into my Rasbian Stretch Lite setup. Last time I tried to update Python I had issues with libssl version and compatibility with domoticz.
Had hours of not fun :cry:

Strange everything else is working great, no issues with other Python plugins. I will NOT give up! :D
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

Hi,

I've enabled debugging to verbose, but theres not really much output:
root@Schlafzimmer:/home/pi/domoticz# ./domoticz
2019-02-12 22:23:07.114 Status: Domoticz V4.10427 (c)2012-2019 GizMoCuz
2019-02-12 22:23:07.114 Status: Build Hash: 75069fe9, Date: 2019-02-12 11:11:30
2019-02-12 22:23:07.115 Status: Startup Path: /home/pi/domoticz/
2019-02-12 22:23:07.168 Sunrise: 07:37:00 SunSet: 17:38:00
2019-02-12 22:23:07.168 Day length: 10:01:00 Sun at south: 12:05:00
2019-02-12 22:23:07.168 Civil twilight start: 07:04:00 Civil twilight end: 18:11:00
2019-02-12 22:23:07.168 Nautical twilight start: 06:27:00 Nautical twilight end: 18:48:00
2019-02-12 22:23:07.168 Astronomical twilight start: 05:50:00 Astronomical twilight end: 19:25:00
2019-02-12 22:23:07.168 Status: EventSystem: reset all events...
2019-02-12 22:23:07.259 Status: PluginSystem: Started, Python version '3.4.2'.
2019-02-12 22:23:07.268 Active notification Subsystems: email, gcm (2/13)
2019-02-12 22:23:07.270 Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2019-02-12 22:23:07.285 Status: WebServer(SSL) started on address: 0.0.0.0 with port 443
2019-02-12 22:23:07.287 Status: Proxymanager started.
2019-02-12 22:23:07.288 Status: Camera: settings (re)loaded
2019-02-12 22:23:07.289 Starting shared server on: 0.0.0.0:6144
2019-02-12 22:23:07.289 Status: TCPServer: shared server started...
2019-02-12 22:23:07.289 Status: RxQueue: queue worker started...
2019-02-12 22:23:09.295 Status: MySensors: Worker started...
2019-02-12 22:23:09.295 Status: (ShellyMQTT) Started.
2019-02-12 22:23:09.296 Status: Logitech Media Server: Worker started...
2019-02-12 22:23:09.296 Status: Fritzbox: connected to: XXXXXXXXXXXXX:1012
2019-02-12 22:23:09.296 Status: EventSystem: reset all events...
2019-02-12 22:23:09.297 Status: Logitech Media Server: 4 player-switch(es) found.
2019-02-12 22:23:09.299 Status: EventSystem: reset all device statuses...
2019-02-12 22:23:09.337 Status: Logitech Media Server: 2 playlist(s) found.
2019-02-12 22:23:09.520 Status: Python EventSystem: Initalizing event module.
2019-02-12 22:23:09.521 Status: EventSystem: Started
2019-02-12 22:23:09.521 Status: EventSystem: Queue thread started...
2019-02-12 22:23:09.672 Status: PluginSystem: Entering work loop.
domoticz: malloc.c:3695: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed.
2019-02-12 22:23:10.295 Status: MySensors: Using serial port: /dev/ttyUSB0
2019-02-12 22:23:10.354 Status: Logitech Media Server: 3 connected player(s) found.
2019-02-12 22:23:11.767 MySensors: Gateway Ready...
2019-02-12 22:23:11.843 MySensors: Gateway Version: 1.4.2
2019-02-12 22:24:00.034 Status: LUA: Update ESP Easy Oled Display
2019-02-12 22:24:17.533 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:24:31.536 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:24:45.539 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:24:59.542 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:25:55.402 Status: User: Admin initiated a switch command (790/Shelly2-roller/Off)
2019-02-12 22:25:55.590 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:25:58.119 Status: User: Admin initiated a switch command (790/Shelly2-roller/On)
2019-02-12 22:26:00.056 Status: LUA: Update ESP Easy Oled Display
2019-02-12 22:26:00.057 Status: EventSystem: Script event triggered: ThermometerDisplay
2019-02-12 22:26:09.593 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:26:23.596 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:26:37.599 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:26:51.602 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
....
2019-02-12 22:33:09.733 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:33:23.736 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:33:37.740 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:33:51.743 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
2019-02-12 22:34:00.148 Status: LUA: Update ESP Easy Oled Display


after 10 Minutes Domoticz Webfrontend stopped responding, also domoticz Process on the shell is not responding, also stop it with crtl+c is not working. I've to kill the process using kill -9
Seems it is waiting for something...
I've tested without Shelly Mqtt Plugin after my last post this afternoon, domoticz was working well all the time, until I've enabled the Plugin again...

Regards
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

Okay another try:

deleted mqtt.py and plugin.py and pulled it again with git

Set debug to true:
2019-02-12 22:50:08.694 (ShellyMQTT) Heartbeating...
2019-02-12 22:50:08.695 Error: (ShellyMQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-12 22:50:08.695 Error: (ShellyMQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:08.695 Error: (ShellyMQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:18.711 (ShellyMQTT) Heartbeating...
2019-02-12 22:50:18.711 Error: (ShellyMQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-12 22:50:18.711 Error: (ShellyMQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:18.711 Error: (ShellyMQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:28.677 (ShellyMQTT) Heartbeating...
2019-02-12 22:50:28.677 Error: (ShellyMQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-12 22:50:28.677 Error: (ShellyMQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:28.677 Error: (ShellyMQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:38.693 (ShellyMQTT) Heartbeating...
2019-02-12 22:50:38.693 Error: (ShellyMQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-12 22:50:38.693 Error: (ShellyMQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:38.693 Error: (ShellyMQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:48.709 (ShellyMQTT) Heartbeating...
2019-02-12 22:50:48.709 Error: (ShellyMQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-12 22:50:48.709 Error: (ShellyMQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:48.709 Error: (ShellyMQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:58.675 (ShellyMQTT) Heartbeating...
2019-02-12 22:50:58.675 Error: (ShellyMQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-12 22:50:58.675 Error: (ShellyMQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:58.675 Error: (ShellyMQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat

Maybe this will help?
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 »

minime wrote: Tuesday 12 February 2019 22:42 Hi,

I've enabled debugging to verbose, but theres not really much output:
root@Schlafzimmer:/home/pi/domoticz# ./domoticz
domoticz: malloc.c:3695: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed.
...
2019-02-12 22:24:17.533 Error: ShellyMQTT hardware (15) thread seems to have ended unexpectedly
It seems that ShellyMQTT does not even started, than Heartbeat cannot be proceed.
Is it Ubuntu 16.04?
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 »

minime wrote: Tuesday 12 February 2019 22:53 2019-02-12 22:50:08.695 Error: (ShellyMQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-12 22:50:08.695 Error: (ShellyMQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-12 22:50:08.695 Error: (ShellyMQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat

Maybe this will help?
Some. It means that MQTT connection can not be established, so none of the functions will be working.

If you restart Domoticz (with Debug mode enabled) than maybe you can capture error messages from the initialization settings of the Shelly plugin, which contains more specific informations about why mqtt can not be started...
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

root@Schlafzimmer:/home/pi/domoticz# ./domoticz
2019-02-13 07:26:00.785 Status: Domoticz V4.10427 (c)2012-2019 GizMoCuz
2019-02-13 07:26:00.785 Status: Build Hash: 75069fe9, Date: 2019-02-12 11:11:30
2019-02-13 07:26:00.786 Status: Startup Path: /home/pi/domoticz/
2019-02-13 07:26:00.842 Sunrise: 07:35:00 SunSet: 17:40:00
2019-02-13 07:26:00.842 Day length: 10:05:00 Sun at south: 12:05:00
2019-02-13 07:26:00.842 Civil twilight start: 07:02:00 Civil twilight end: 18:12:00
2019-02-13 07:26:00.842 Nautical twilight start: 06:25:00 Nautical twilight end: 18:49:00
2019-02-13 07:26:00.842 Astronomical twilight start: 05:49:00 Astronomical twilight end: 19:26:00
2019-02-13 07:26:00.842 Status: EventSystem: reset all events...
2019-02-13 07:26:00.944 Status: PluginSystem: Started, Python version '3.4.2'.
2019-02-13 07:26:00.953 Active notification Subsystems: email, gcm (2/13)
2019-02-13 07:26:00.955 Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2019-02-13 07:26:00.970 Status: WebServer(SSL) started on address: 0.0.0.0 with port 443
2019-02-13 07:26:00.972 Status: Proxymanager started.
2019-02-13 07:26:00.973 Status: Camera: settings (re)loaded
2019-02-13 07:26:00.974 Starting shared server on: 0.0.0.0:6144
2019-02-13 07:26:00.975 Status: TCPServer: shared server started...
2019-02-13 07:26:00.975 Status: RxQueue: queue worker started...
2019-02-13 07:26:02.981 Status: MySensors: Worker started...
2019-02-13 07:26:02.984 Status: Logitech Media Server: Worker started...
2019-02-13 07:26:02.984 Status: (Shelly_MQTT) Started.
2019-02-13 07:26:02.985 Status: Logitech Media Server: 4 player-switch(es) found.
2019-02-13 07:26:02.985 Status: EventSystem: reset all events...
2019-02-13 07:26:02.985 Status: Fritzbox: connected to: XXXXXXXXXXXXXX:1012
2019-02-13 07:26:02.988 Status: EventSystem: reset all device statuses...
2019-02-13 07:26:03.044 Status: Logitech Media Server: 2 playlist(s) found.
2019-02-13 07:26:03.261 Status: Python EventSystem: Initalizing event module.
2019-02-13 07:26:03.262 Status: EventSystem: Started
2019-02-13 07:26:03.262 Status: EventSystem: Queue thread started...
2019-02-13 07:26:03.348 Status: PluginSystem: Entering work loop.
2019-02-13 07:26:03.577 Error: CPlugin:PyDomoticz_Debug, illegal operation, Plugin has not started yet.
2019-02-13 07:26:03.578 Status: (Shelly_MQTT) Entering work loop.
2019-02-13 07:26:03.578 Status: (Shelly_MQTT) Initialized version 0.3.2
2019-02-13 07:26:03.585 (Shelly_MQTT) Debug logging mask set to: PYTHON
2019-02-13 07:26:03.585 (Shelly_MQTT) MQTT client start error: name 'MqttClient' is not defined
2019-02-13 07:26:03.983 Status: MySensors: Using serial port: /dev/ttyUSB0
2019-02-13 07:26:04.060 Status: Logitech Media Server: 3 connected player(s) found.
2019-02-13 07:26:05.455 MySensors: Gateway Ready...
2019-02-13 07:26:05.531 MySensors: Gateway Version: 1.4.2
2019-02-13 07:26:13.601 (Shelly_MQTT) Heartbeating...
2019-02-13 07:26:13.601 Error: (Shelly_MQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-13 07:26:13.601 Error: (Shelly_MQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-13 07:26:13.601 Error: (Shelly_MQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-13 07:26:23.617 (Shelly_MQTT) Heartbeating...
2019-02-13 07:26:23.617 Error: (Shelly_MQTT) 'onHeartbeat' failed 'AttributeError':''NoneType' object has no attribute 'mqttConn''.
2019-02-13 07:26:23.617 Error: (Shelly_MQTT) ----> Line 447 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat
2019-02-13 07:26:23.617 Error: (Shelly_MQTT) ----> Line 139 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onHeartbeat

Its a raspbian Jessie on a Pi2 (!?)

I've realized after deleting mqtt.py and plugin.py, I've done "git pull" mqtt.py was not come back. Is this correct, what I've forgotten?
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

forget the last post, I've now deleted the whole folder and loaded the plugin completly:
mqtt.p is back, but plugin still not working correctly

root@Schlafzimmer:/home/pi/domoticz# ./domoticz
2019-02-13 07:36:33.066 Status: Domoticz V4.10427 (c)2012-2019 GizMoCuz
2019-02-13 07:36:33.066 Status: Build Hash: 75069fe9, Date: 2019-02-12 11:11:30
2019-02-13 07:36:33.067 Status: Startup Path: /home/pi/domoticz/
2019-02-13 07:36:33.116 Sunrise: 07:35:00 SunSet: 17:40:00
2019-02-13 07:36:33.116 Day length: 10:05:00 Sun at south: 12:05:00
2019-02-13 07:36:33.117 Civil twilight start: 07:02:00 Civil twilight end: 18:12:00
2019-02-13 07:36:33.118 Nautical twilight start: 06:25:00 Nautical twilight end: 18:49:00
2019-02-13 07:36:33.118 Astronomical twilight start: 05:49:00 Astronomical twilight end: 19:26:00
2019-02-13 07:36:33.118 Status: EventSystem: reset all events...
2019-02-13 07:36:33.207 Status: PluginSystem: Started, Python version '3.4.2'.
2019-02-13 07:36:33.217 Active notification Subsystems: email, gcm (2/13)
2019-02-13 07:36:33.219 Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2019-02-13 07:36:33.234 Status: WebServer(SSL) started on address: 0.0.0.0 with port 443
2019-02-13 07:36:33.237 Status: Proxymanager started.
2019-02-13 07:36:33.238 Status: Camera: settings (re)loaded
2019-02-13 07:36:33.239 Starting shared server on: 0.0.0.0:6144
2019-02-13 07:36:33.240 Status: TCPServer: shared server started...
2019-02-13 07:36:33.240 Status: RxQueue: queue worker started...
2019-02-13 07:36:35.246 Status: MySensors: Worker started...
2019-02-13 07:36:35.247 Status: (Shelly_MQTT) Started.
2019-02-13 07:36:35.247 Status: Logitech Media Server: Worker started...
2019-02-13 07:36:35.247 Status: Fritzbox: connected to: XXXXXXXXXXX:1012
2019-02-13 07:36:35.248 Status: EventSystem: reset all events...
2019-02-13 07:36:35.248 Status: Logitech Media Server: 4 player-switch(es) found.
2019-02-13 07:36:35.250 Status: EventSystem: reset all device statuses...
2019-02-13 07:36:35.292 Status: Logitech Media Server: 2 playlist(s) found.
2019-02-13 07:36:35.414 Status: Python EventSystem: Initalizing event module.
2019-02-13 07:36:35.415 Status: EventSystem: Started
2019-02-13 07:36:35.415 Status: EventSystem: Queue thread started...
2019-02-13 07:36:35.622 Status: PluginSystem: Entering work loop.
domoticz: malloc.c:3695: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed.
2019-02-13 07:36:36.246 Status: MySensors: Using serial port: /dev/ttyUSB0
2019-02-13 07:36:36.308 Status: Logitech Media Server: 3 connected player(s) found.
2019-02-13 07:36:37.718 MySensors: Gateway Ready...
2019-02-13 07:36:37.794 MySensors: Gateway Version: 1.4.2

--> domoticz: malloc.c:3695: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed.
this Messing comes only, when shelly mqtt is enabled
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 »

minime wrote: Wednesday 13 February 2019 7:38 --> domoticz: malloc.c:3695: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed.
I think that memory allocation error is not related to Python, so i can not solve this from the plugin.
If this error only pops up when using Shelly plugin, that may mean that Mqtt support libraries have some problem.
I've added some more error handling in today commit if this writes some useful details to the error log, it may help, if not... then try some refreshing like:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cmake libboost-dev libboost-thread-dev libboost-system-dev libsqlite3-dev subversion curl libcurl4-openssl-dev libusb-dev zlib1g-dev libssl-dev git mosquitto-clients libmosquitto-dev python3-pip python3-dev libpython3.5
sudo pip3 install paho-mqtt
If nothing helps then you can reinstall a new Domoticz with Python >3.5.x...
The last occasion i've seen "malloc" errors is when my SD card got faulty, than i grabbed a new one, reinstalled Raspbian and problems disappeared.
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

Hi,

I've seen your answer right now, and pulled the new commit.
After restarting domoticz and activating the plugin, following output was written to the log
2019-02-13 21:34:09.650 Status: (Shelly_MQTT) Started.
2019-02-13 21:34:09.989 Error: Domoticz(pid:11234, tid:11237('PluginMgr')) received fatal signal 11 (Segmentation fault)
2019-02-13 21:34:09.989 Error: siginfo address=0x46, address=0x722450
2019-02-13 21:34:12.382 Error: Thread 4 (Thread 0x751c9430 (LWP 11237)):
2019-02-13 21:34:12.382 Error: #0 0x76e36ef8 in waitpid () from /lib/arm-linux-gnueabihf/libpthread.so.0
2019-02-13 21:34:12.382 Error: #1 0x002c84e8 in dumpstack_gdb(bool) ()
2019-02-13 21:34:12.382 Error: #2 0x002c8ad4 in signal_handler(int, siginfo_t*, void*) ()
2019-02-13 21:34:12.382 Error: #3 <signal handler called>
2019-02-13 21:34:12.383 Error: #4 0x00721e08 in EVP_MD_CTX_reset ()
2019-02-13 21:34:12.383 Error: #5 0x00722450 in EVP_MD_CTX_copy ()
2019-02-13 21:34:12.383 Error: #6 0x693eba5c in ?? () from /usr/lib/python3.4/lib-dynload/_hashlib.cpython-34m-arm-linux-gnueabihf.so
Speicherzugriffsfehler

After this domoticz stopped. I'll now try your other hint...
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

Hi,

its a bit strange, one time those errors occurs the other time not. Its not reliable at the moment. Maybe your are right and the SD Card may die.
I'll replace it tomorrow and give it another shot.

Thanks for your help for the moment
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

Hi,

a fresh installation of raspbian, Domoticz and shelly_mqtt seems fixed the problems.I've also restored the database of the old installation, all devices were given. But I need to test this at home. I'e no shelly device here at the moment...
2019-02-14 11:56:39.309 Status: (Shelly MQTT) Started.
2019-02-14 11:56:39.484 Status: (Shelly MQTT) Entering work loop.
2019-02-14 11:56:39.484 Status: (Shelly MQTT) Initialized version 0.3.3
2019-02-14 11:56:39.494 (Shelly MQTT) Debug logging mask set to: PYTHON
2019-02-14 11:56:39.494 (Shelly MQTT) MqttClient::__init__
2019-02-14 11:56:39.495 (Shelly MQTT) MqttClient::Open
2019-02-14 11:56:39.545 (Shelly MQTT) MQTT connected successfully.
2019-02-14 11:56:39.545 (Shelly MQTT) MqttClient::Connect
2019-02-14 11:56:39.545 (Shelly MQTT) MQTT CONNECT ID: 'Domoticz_XXXX'
2019-02-14 11:56:39.546 (Shelly MQTT) MqttClient::Subscribe
2019-02-14 11:56:39.546 (Shelly MQTT) onMQTTSubscribed
2019-02-14 11:56:49.511 (Shelly MQTT) Heartbeating...
2019-02-14 11:56:49.511 (Shelly MQTT) MqttClient::Ping

Looks good for the moment ...
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 »

minime wrote: Thursday 14 February 2019 12:02 Hi,

a fresh installation of raspbian, Domoticz and shelly_mqtt seems fixed the problems.I've also restored the database of the old installation, all devices were given. But I need to test this at home. I'e no shelly device here at the moment...
2019-02-14 11:56:39.309 Status: (Shelly MQTT) Started.
2019-02-14 11:56:39.484 Status: (Shelly MQTT) Entering work loop.
2019-02-14 11:56:39.484 Status: (Shelly MQTT) Initialized version 0.3.3
2019-02-14 11:56:39.494 (Shelly MQTT) Debug logging mask set to: PYTHON
2019-02-14 11:56:39.494 (Shelly MQTT) MqttClient::__init__
2019-02-14 11:56:39.495 (Shelly MQTT) MqttClient::Open
2019-02-14 11:56:39.545 (Shelly MQTT) MQTT connected successfully.
2019-02-14 11:56:39.545 (Shelly MQTT) MqttClient::Connect
2019-02-14 11:56:39.545 (Shelly MQTT) MQTT CONNECT ID: 'Domoticz_XXXX'
2019-02-14 11:56:39.546 (Shelly MQTT) MqttClient::Subscribe
2019-02-14 11:56:39.546 (Shelly MQTT) onMQTTSubscribed
2019-02-14 11:56:49.511 (Shelly MQTT) Heartbeating...
2019-02-14 11:56:49.511 (Shelly MQTT) MqttClient::Ping

Looks good for the moment ...
Indeed it looks exactly as it should. :)
minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

Yeah Plugin works well now, thank you very much!!

Do you plan to integrate RGBW2 also? My devices arrived today.
Debuglog tells following:

Code: Select all

2019-02-15 20:07:53.823 (Shelly_MQTT) MQTT message: shellies/shelly1-2280AE/relay/0 off
2019-02-15 20:07:53.824 (Shelly_MQTT) MQTT message: shellies/shelly1-2280AE/input/0 0
2019-02-15 20:07:57.180 (Shelly_MQTT) MQTT message: shellies/shellyrgbw2-5A3AF6/color/0 on
2019-02-15 20:07:57.231 (Shelly_MQTT) MQTT message: shellies/shellyrgbw2-5A3AF6/color/0/status {'effect': 0, 'ison': True, 'overpower': False, 'blue': 0, 'power': 12.72, 'green': 0, 'red': 255, 'gain': 51, 'white': 0, 'mode': 'color'}
2019-02-15 20:07:57.232 (Shelly_MQTT) MQTT message: shellies/shellyrgbw2-5A3AF6/color/0/status {'effect': 0, 'ison': True, 'overpower': False, 'blue': 0, 'power': 12.72, 'green': 0, 'red': 255, 'gain': 51, 'white': 0, 'mode': 'color'}
2019-02-15 20:08:00.637 (Shelly_MQTT) Heartbeating...
2019-02-15 20:08:00.637 (Shelly_MQTT) MqttClient::Ping
Maybe this will help you, don't know whether or not you received your own devices?
salvacalatayud
Posts: 112
Joined: Monday 26 June 2017 21:16
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Spain
Contact:

Re: Python Plugin: Shelly MQTT

Post by salvacalatayud »

Do you know if shelly 2led ( led dimmer) works with this plugin?

Enviado desde mi Mi A2 mediante Tapatalk

minime
Posts: 18
Joined: Thursday 15 November 2018 15:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by minime »

I don't think so:

Code: Select all

Supported devices

Tested and working with:

    Shelly 1 Open Source (relay)
    Shelly Plug (relay and power consumption reporting)
    Shelly2 Switch (relay and roller shutter mode, positioning)
    Shelly4 Pro (relay and power consumption reporting)
    Shelly H&T
...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest