Python Plugin Beta testers - please read this

Python and python framework

Moderator: leecollings

User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin Beta testers - please read this

Post by Dnpwwo »

@ffes,

The error message says that you need to install libpython3.x not python3, they are different (as you have found out).

If you don't need Python3 I would remove it and just install libpython3.4.

Some extra info is here: http://www.domoticz.com/wiki/Linux#Prob ... ing_Python
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
ffes
Posts: 51
Joined: Thursday 26 January 2017 23:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Python Plugin Beta testers - please read this

Post by ffes »

Thanks for link. Clarifies it all.
I though installing python3 would pull in libpython3.4 as well (but I was wrong, I should have taken a closer look).

My experiment now shows up in the list.
All I need to do now is write the actual plugin :? 8-)
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python Plugin Beta testers - please read this

Post by G3rard »

@Dnpwwo, just installed the latest Domoticz beta v3.6544 on Ubuntu Server 14.04.

I copied the Kodi plugin from Github to plugins/Kodi/plugin.py and get the following error codes when starting Domoticz:

Code: Select all

2017-01-28 17:04:11.164 PluginSystem: Started, Python version '3.4.3'.

2017-01-28 17:03:05.178 (Kodi zolder) Connected successfully to: 192.168.1.114:9090
2017-01-28 17:03:05.228 Error: (Kodi zolder) 'onMessage' failed 'TypeError'.
2017-01-28 17:03:05.228 Error: (Kodi zolder) ----> Line 101 in /home/gerard/domoticz/plugins/Kodi/plugin.py, function onMessage
2017-01-28 17:03:05.228 Error: (Kodi zolder) ----> Line 312 in /usr/lib/python3.4/json/__init__.py, function loads
2017-01-28 17:03:05.228 Error: (Kodi zolder) 'onMessage' failed 'TypeError'.
After that Domoticz doesn't respons anymore. This used to work on an older beta version.
Is there a newer version of the Kodi plugin available which I have missed?
Not using Domoticz anymore
micha_pr
Posts: 82
Joined: Friday 24 October 2014 12:26
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany, near Berlin
Contact:

Re: Python Plugin Beta testers - please read this

Post by micha_pr »

@Dnpwwo: would it be possible to create devices like Dimmer or volume regulator?
It should report in short interval new values - not shure how it can be realized with the plugin

I mean an external device what will give the level to the already assigned device in domoticz.

Thanks!
Michael
Michael Pruefer
----------------------------
http://www.zwave-review.com (German only)
http://www.SmartHome.Work (German only)
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin Beta testers - please read this

Post by Dnpwwo »

@G3rard,

There is:
Kodi 1.1.0.zip
(5.86 KiB) Downloaded 158 times
Hopefully changes that change the interface will become far less frequent.

@micha_pr,

That does sound like the kind of thing the plugin framework is designed for. There is a more detailed description on the wiki.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python Plugin Beta testers - please read this

Post by G3rard »

Thanks, it's working with that version :)
Not using Domoticz anymore
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin Beta testers - please read this

Post by Dnpwwo »

@G3rard,

I probably should have mentioned that the remote control should also work with the latest beta (did for me but that is not always the best indication of if it really works :shock: )
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Re: Python Plugin Beta testers - please read this

Post by korniza »

I have another question: I checked that there is no TypeName for Watts. If I use Kwh as typename will domoticz make the maths for me as I send Watts as input? :lol:
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
zak45
Posts: 953
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin Beta testers - please read this

Post by zak45 »

Updated to last beta version: 3.6553, take the Kodi plugin 1.1.0
I use binaries downloaded from Domoticz website

still the same issue :
Spoiler: show
2017-01-29 11:41:05.387 (Kodic) Device nValue: 0
2017-01-29 11:41:05.387 (Kodic) Device sValue: ''
2017-01-29 11:41:05.387 (Kodic) Device LastLevel: 0
2017-01-29 11:41:05.387 (Kodic) Device: 2 - ID: 642, Name: 'Kodic - Source', nValue: 0, sValue: ''
2017-01-29 11:41:05.387 (Kodic) Device ID: '642'
2017-01-29 11:41:05.387 (Kodic) Device Name: 'Kodic - Source'
2017-01-29 11:41:05.387 (Kodic) Device nValue: 0
2017-01-29 11:41:05.387 (Kodic) Device sValue: ''
2017-01-29 11:41:05.387 (Kodic) Device LastLevel: 0
2017-01-29 11:41:05.387 (Kodic) Device: 3 - ID: 643, Name: 'Kodic - Volume', nValue: 0, sValue: ''
2017-01-29 11:41:05.387 (Kodic) Device ID: '643'
2017-01-29 11:41:05.387 (Kodic) Device Name: 'Kodic - Volume'
2017-01-29 11:41:05.388 (Kodic) Device nValue: 0
2017-01-29 11:41:05.388 (Kodic) Device sValue: ''
2017-01-29 11:41:05.388 (Kodic) Device LastLevel: 0
2017-01-29 11:41:05.388 (Kodic) Device: 4 - ID: 644, Name: 'Kodic - Playing', nValue: 0, sValue: ''
2017-01-29 11:41:05.388 (Kodic) Device ID: '644'
2017-01-29 11:41:05.388 (Kodic) Device Name: 'Kodic - Playing'
2017-01-29 11:41:05.388 (Kodic) Device nValue: 0
2017-01-29 11:41:05.388 (Kodic) Device sValue: ''
2017-01-29 11:41:05.388 (Kodic) Device LastLevel: 0
2017-01-29 11:41:05.388 (Kodic) Transport set to: 'TCP/IP', 192.168.1.38:9090.
2017-01-29 11:41:05.388 (Kodic) Protocol set to: 'JSON'.
2017-01-29 11:41:05.388 (Kodic) Heartbeat interval set to: 10.
2017-01-29 11:41:05.388 PluginSystem: Starting I/O service thread.
2017-01-29 11:41:05.388 (Kodic) Connect directive received, transport connect initiated successfully.
2017-01-29 11:41:06.755 (Kodic) Calling message handler 'onConnect'.
2017-01-29 11:41:06.755 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 11:41:09.127 (RFX433E) Temp + Humidity (433-TempSDB)
2017-01-29 11:41:14.889 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:41:24.894 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:41:34.894 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:41:34.894 PluginSystem: Starting I/O service thread.
2017-01-29 11:41:34.894 (Kodic) Connect directive received, transport connect initiated successfully.
2017-01-29 11:41:36.260 (Kodic) Calling message handler 'onConnect'.
2017-01-29 11:41:36.260 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 11:41:39.776 (RFX433E) Temp + Humidity (433-TempSDBE)
2017-01-29 11:41:41.151 (RFX433E) Temp + Humidity (433-TempSalon)
2017-01-29 11:41:44.905 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:41:52.124 (RFX433E) Temp + Humidity (433-TempSDB)
2017-01-29 11:41:54.912 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:42:03.610 (RFX433E) Energy (Compteur EDF)
2017-01-29 11:42:04.949 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:42:04.949 PluginSystem: Starting I/O service thread.
2017-01-29 11:42:04.949 (Kodic) Connect directive received, transport connect initiated successfully.
2017-01-29 11:42:06.264 (Kodic) Calling message handler 'onConnect'.
2017-01-29 11:42:06.264 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
Have even uninstalled python 3.6 and install python 3.5.3 --> no luck!

FYI: version x64 of Python is not reconized, maybe due to binaries location.
zak45
Posts: 953
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin Beta testers - please read this

Post by zak45 »

zak45 wrote:Updated to last beta version: 3.6553, take the Kodi plugin 1.1.0
I use binaries downloaded from Domoticz website

still the same issue :
Spoiler: show
2017-01-29 11:41:05.387 (Kodic) Device nValue: 0
2017-01-29 11:41:05.387 (Kodic) Device sValue: ''
2017-01-29 11:41:05.387 (Kodic) Device LastLevel: 0
2017-01-29 11:41:05.387 (Kodic) Device: 2 - ID: 642, Name: 'Kodic - Source', nValue: 0, sValue: ''
2017-01-29 11:41:05.387 (Kodic) Device ID: '642'
2017-01-29 11:41:05.387 (Kodic) Device Name: 'Kodic - Source'
2017-01-29 11:41:05.387 (Kodic) Device nValue: 0
2017-01-29 11:41:05.387 (Kodic) Device sValue: ''
2017-01-29 11:41:05.387 (Kodic) Device LastLevel: 0
2017-01-29 11:41:05.387 (Kodic) Device: 3 - ID: 643, Name: 'Kodic - Volume', nValue: 0, sValue: ''
2017-01-29 11:41:05.387 (Kodic) Device ID: '643'
2017-01-29 11:41:05.387 (Kodic) Device Name: 'Kodic - Volume'
2017-01-29 11:41:05.388 (Kodic) Device nValue: 0
2017-01-29 11:41:05.388 (Kodic) Device sValue: ''
2017-01-29 11:41:05.388 (Kodic) Device LastLevel: 0
2017-01-29 11:41:05.388 (Kodic) Device: 4 - ID: 644, Name: 'Kodic - Playing', nValue: 0, sValue: ''
2017-01-29 11:41:05.388 (Kodic) Device ID: '644'
2017-01-29 11:41:05.388 (Kodic) Device Name: 'Kodic - Playing'
2017-01-29 11:41:05.388 (Kodic) Device nValue: 0
2017-01-29 11:41:05.388 (Kodic) Device sValue: ''
2017-01-29 11:41:05.388 (Kodic) Device LastLevel: 0
2017-01-29 11:41:05.388 (Kodic) Transport set to: 'TCP/IP', 192.168.1.38:9090.
2017-01-29 11:41:05.388 (Kodic) Protocol set to: 'JSON'.
2017-01-29 11:41:05.388 (Kodic) Heartbeat interval set to: 10.
2017-01-29 11:41:05.388 PluginSystem: Starting I/O service thread.
2017-01-29 11:41:05.388 (Kodic) Connect directive received, transport connect initiated successfully.
2017-01-29 11:41:06.755 (Kodic) Calling message handler 'onConnect'.
2017-01-29 11:41:06.755 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 11:41:09.127 (RFX433E) Temp + Humidity (433-TempSDB)
2017-01-29 11:41:14.889 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:41:24.894 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:41:34.894 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:41:34.894 PluginSystem: Starting I/O service thread.
2017-01-29 11:41:34.894 (Kodic) Connect directive received, transport connect initiated successfully.
2017-01-29 11:41:36.260 (Kodic) Calling message handler 'onConnect'.
2017-01-29 11:41:36.260 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 11:41:39.776 (RFX433E) Temp + Humidity (433-TempSDBE)
2017-01-29 11:41:41.151 (RFX433E) Temp + Humidity (433-TempSalon)
2017-01-29 11:41:44.905 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:41:52.124 (RFX433E) Temp + Humidity (433-TempSDB)
2017-01-29 11:41:54.912 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:42:03.610 (RFX433E) Energy (Compteur EDF)
2017-01-29 11:42:04.949 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 11:42:04.949 PluginSystem: Starting I/O service thread.
2017-01-29 11:42:04.949 (Kodic) Connect directive received, transport connect initiated successfully.
2017-01-29 11:42:06.264 (Kodic) Calling message handler 'onConnect'.
2017-01-29 11:42:06.264 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
Have even uninstalled python 3.6 and install python 3.5.3 --> no luck!

FYI: version x64 of Python is not reconized, maybe due to binaries location.


A little bit more information
Spoiler: show
2017-01-29 11:58:07.108 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 11:58:36.987 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 11:59:07.215 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 11:59:37.390 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 12:00:07.402 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 12:00:37.328 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 12:01:07.290 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 12:01:36.046 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 12:02:06.015 Error: PyDomoticz_Connect, connection request from 'Kodic' ignored. Transport is already connected.
2017-01-29 12:02:36.030 Error: PyDomoticz_Connect, connection request from 'Kodic' ignored. Transport is already connected.
2017-01-29 12:03:06.078 Error: PyDomoticz_Connect, connection request from 'Kodic' ignored. Transport is already connected.
OnConnect error occur when Kodi is not running, once I open Kodi, I got PyDomoticz_Connect error.
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin Beta testers - please read this

Post by Dnpwwo »

@zak45,

This still looks like Domoticz has not picked up the new version of the plugin.

Unless line 79 of the plugin.py file is:

Code: Select all

def onConnect(Status, Description):
then it is not the correct version.

Can you up grade to the latest beta (from 4 hours ago), I have added some more logging around this, you should see something like:

Code: Select all

2017-01-29 23:21:00.507 (Test Kodi) Initialized version 1.1.0, author 'dnpwwo'
in the log. If you don't see version 1.1.0 Domoticz is not picking up the right one.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
zak45
Posts: 953
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin Beta testers - please read this

Post by zak45 »

Already into the last beta
this is the log file :
Spoiler: show
2017-01-29 14:13:55.714 (Kodic) Device has disconnected
2017-01-29 14:13:55.714 (Kodic) onStop called
2017-01-29 14:13:55.934 (Kodic) Exiting work loop...
2017-01-29 14:13:55.934 (Kodic) Stopped.
2017-01-29 14:13:56.018 (Kodic) Initialized version 1.1.0, author 'dnpwwo'
2017-01-29 14:13:56.070 (Kodic) Debug log level set to: 'true'.
2017-01-29 14:13:56.070 (Kodic) 'Mode3':'False'
2017-01-29 14:13:56.070 (Kodic) 'HardwareID':'11'
2017-01-29 14:13:56.070 (Kodic) 'Name':'Kodic'
2017-01-29 14:13:56.070 (Kodic) 'Key':'Kodi'
2017-01-29 14:13:56.071 (Kodic) 'Port':'9090'
2017-01-29 14:13:56.071 (Kodic) 'Mode2':'Ignore'
2017-01-29 14:13:56.071 (Kodic) 'Address':'192.168.1.38'
2017-01-29 14:13:56.071 (Kodic) 'Mode6':'Debug'
2017-01-29 14:13:56.071 (Kodic) Device count: 4
2017-01-29 14:13:56.071 (Kodic) Device: 1 - ID: 641, Name: 'Kodic - Status', nValue: 0, sValue: ''
2017-01-29 14:13:56.071 (Kodic) Device ID: '641'
2017-01-29 14:13:56.071 (Kodic) Device Name: 'Kodic - Status'
2017-01-29 14:13:56.071 (Kodic) Device nValue: 0
2017-01-29 14:13:56.071 (Kodic) Device sValue: ''
2017-01-29 14:13:56.071 (Kodic) Device LastLevel: 0
2017-01-29 14:13:56.071 (Kodic) Device: 2 - ID: 642, Name: 'Kodic - Source', nValue: 0, sValue: ''
2017-01-29 14:13:56.071 (Kodic) Device ID: '642'
2017-01-29 14:13:56.071 (Kodic) Device Name: 'Kodic - Source'
2017-01-29 14:13:56.071 (Kodic) Device nValue: 0
2017-01-29 14:13:56.071 (Kodic) Device sValue: ''
2017-01-29 14:13:56.071 (Kodic) Device LastLevel: 0
2017-01-29 14:13:56.071 (Kodic) Device: 3 - ID: 643, Name: 'Kodic - Volume', nValue: 0, sValue: ''
2017-01-29 14:13:56.071 (Kodic) Device ID: '643'
2017-01-29 14:13:56.071 (Kodic) Device Name: 'Kodic - Volume'
2017-01-29 14:13:56.071 (Kodic) Device nValue: 0
2017-01-29 14:13:56.071 (Kodic) Device sValue: ''
2017-01-29 14:13:56.071 (Kodic) Device LastLevel: 0
2017-01-29 14:13:56.071 (Kodic) Device: 4 - ID: 644, Name: 'Kodic - Playing', nValue: 0, sValue: '0'
2017-01-29 14:13:56.071 (Kodic) Device ID: '644'
2017-01-29 14:13:56.072 (Kodic) Device Name: 'Kodic - Playing'
2017-01-29 14:13:56.072 (Kodic) Device nValue: 0
2017-01-29 14:13:56.072 (Kodic) Device sValue: '0'
2017-01-29 14:13:56.072 (Kodic) Device LastLevel: 0
2017-01-29 14:13:56.072 (Kodic) Transport set to: 'TCP/IP', 192.168.1.38:9090.
2017-01-29 14:13:56.072 (Kodic) Protocol set to: 'JSON'.
2017-01-29 14:13:56.072 (Kodic) Heartbeat interval set to: 10.
2017-01-29 14:13:56.072 PluginSystem: Starting I/O service thread.
2017-01-29 14:13:56.072 (Kodic) Connect directive received, transport connect initiated successfully.
2017-01-29 14:13:56.173 (Kodic) Calling message handler 'onConnect'.
2017-01-29 14:13:56.173 Error: (Kodic) 'onConnect' failed 'TypeError':'onConnect() missing 2 required positional arguments: 'Status' and 'Description''.
2017-01-29 14:13:57.756 (AeonStick) Light/Switch (Z-FenetreCuisineMvt)
2017-01-29 14:14:04.273 (RFX433E) Temp + Humidity (433-TempSalon)
2017-01-29 14:14:05.578 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 14:14:15.572 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 14:14:24.937 (RFX433E) Temp + Humidity (433-TempSDBE)
2017-01-29 14:14:25.558 (Kodic) Calling message handler 'onHeartbeat'.
2017-01-29 14:14:25.558 Error: PyDomoticz_Connect, connection request from 'Kodic' ignored. Transport is already connected.
2017-01-29 14:14:31.144 (RFX433E) Temp + Humidity (433-TempSDB)
2017-01-29 14:14:35.564 (Kodic) Calling message handler 'onHeartbeat'.
so ... :?:
Let me know what I could more to try to help/debug?
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python Plugin Beta testers - please read this

Post by G3rard »

@Dnpwwo,
When changing something in the Hardware tab for the Sonos plugin of @tester22 (for example Debug or Update interval) I get the following error code in the Domoticz log and then Domoticz hangs.

Code: Select all

2017-01-29 23:27:23.951 (Sonos kantoor) Calling message handler 'onStop'.
2017-01-29 23:27:23.951 (Sonos kantoor) onStop called
2017-01-29 23:27:23.951 (Sonos kantoor - Volume) Updating device from 2:'2' to have values 2:'2'.
2017-01-29 23:27:24.064 (Sonos kantoor) Exiting work loop...
2017-01-29 23:27:28.938 (Sonos kantoor) Stopped.
2017-01-29 23:27:28.939 Error: Domoticz received fatal signal 11 !...
Running on Domoticz v3.6561.
Any clues how to fix this?
Not using Domoticz anymore
ubee
Posts: 66
Joined: Tuesday 10 February 2015 20:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Sweden
Contact:

Re: Python Plugin Beta testers - please read this

Post by ubee »

@Dnpwwo,

I'm still struggling to come to a point where I have a stable import of plugin modules. I had everything up and running and started to develop my own UniPi plugin. All of a sudden both this module and your Kodi plugin failed to load. I see that by finding both modules at the end of the drop-down list on the Hardware tab.

Then I removed my own UniPi plugin completely, bot the directory and plugin.py. The only remaining plugin was your Kodi plugin. Still fails to load...

I have upgraded to latest beta (3.6561) and downloaded the latest Kodi plugin you enclosed earlier in this thread. Still the same problem. I find this in the log file:

2017-01-29 20:54:41.112 PluginSystem: Entering work loop.
2017-01-29 20:54:41.274 Error: () failed to load 'plugin.py', Python Path used was ':/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'
2017-01-29 20:54:41.274 Error: (Kodi) Module Import failed, exception: 'ImportError'
2017-01-29 20:54:41.274 Error: (Kodi) Module Import failed: ' Name: plugin'
2017-01-29 20:54:41.400 Error: () failed to load 'plugin.py', Python Path used was ':/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'


Reboot does not help.

This is really annoying. I can't figure out what makes the import fail all of a sudden. :(

Edit: It´s strange. I just have to post a new message in this thread, and then I find out what´s the problem is... This time it was an empty directory named __pycache__ in the Kodi plugin folder. Once I removed this, import works again! Just wonder why this directory all of a sudden shows up....
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin Beta testers - please read this

Post by Dnpwwo »

@ubee,

I don't know what it is but there is definitely something amiss on your system.

I took a working plugin and forced an ImportError by renaming the plugin.py file to something else. I got:

Code: Select all

 2017-01-30 20:30:02.339 PluginSystem: Entering work loop.
2017-01-30 20:30:02.372 Error: (Kodi) failed to load 'plugin.py', Python Path used was ';D:\Domoticz\domoticz\msbuild\Debug\python35_d.zip;C:\Program Files (x86)\Python35-32\Lib\;C:\Program Files (x86)\Python35-32\DLLs\;D:\Domoticz\domoticz\msbuild\Debug'.
2017-01-30 20:30:02.373 Error: (Test Kodi) Module Import failed, exception: 'ImportError'
2017-01-30 20:30:02.373 Error: (Test Kodi) Module Import failed: ' Name: plugin' 
Now there are some key similarities and differences here that may provide some insight (or not but let's give it a go :lol: )

Here goes:
  • Difference: You have 2 'failed to load' messages but only 1 ImportError, is this because your log is abridged or is this what you actually saw?
  • Difference: Even though Domoticz couldn't find the plugin file at all I never got any '()' entires, the plugin name was always present in the errors
  • Similarity (finally!): The 1st part of the Python Path is the OS specific separator (I did this on Windows obviously and you did not). I believe this means that at startup Domoticz did not find the plugin. You can confirm this by going into the Hardware page, if the 'Type' column is blank for your plugin it was not found so the XML definition was not parsed.
So what advise can I give? I would try 2 things:
  • Go into the Hardware table of Domoticz using a sqlite3 browser and empty out all plugins from the table manually. I think there must be some data issue that is causing the () entries. Specifically you have Hardware entries where the 'Extra' field is blank, this won't work.
  • Run Domoticz from the command line from the domoticz folder using './domoticz' to make sure that the you are running image in the right place and check that it has a plugins folder underneath it. Does the Kodi plugin show up in the hardware list? It should if you have the Kodi plugin.py in a subfolder of domoticz
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Python Plugin Beta testers - please read this

Post by mvzut »

Dnpwwo wrote:@G3rard,

I probably should have mentioned that the remote control should also work with the latest beta (did for me but that is not always the best indication of if it really works :shock: )
Should it now also work for the Sonos plugin? It doesn't for me unfortunately (latest beta, latest version of the Sonos plugin Python script)...
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
avgays
Posts: 14
Joined: Monday 30 January 2017 12:02
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python Plugin Beta testers - please read this

Post by avgays »

@Dnpwwo:
if I set Heartbeat interval to 70 and more, and debugging in plugin is On, I start getting messages in log:

Code: Select all

2017-01-30 14:16:00.539 Error: A1 hardware (9) thread seems to have ended unexpectedly
message is logged every 30 seconds, except times when onHeartbeat called
Plugin itself continues working without any visual problems.
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin Beta testers - please read this

Post by Dnpwwo »

@avgays,

That error message is standard Domoticz hardware functionality and you will get the message for any value over 30 (although the plugin will function just fine). I think if the hardware doesn't 'phone home' every 30 seconds Domoticz reports that it may have died.

If you really need numbers that big I would suggest setting the heartbeat to 17 or 18 and doing what you want to do on every 4 call.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin Beta testers - please read this

Post by Dnpwwo »

@G3rard,

I have seen occasional crashes when reloading plugins, those that can be reproduced reliably I have resolved.

If you can crash the Sonos plugin regularly can you send me steps you use, I have an Ubuntu VM I can try it on (assuming you are running 14.04)
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
ubee
Posts: 66
Joined: Tuesday 10 February 2015 20:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Sweden
Contact:

Re: Python Plugin Beta testers - please read this

Post by ubee »

@Dnpwwo,
Here goes:
Difference: You have 2 'failed to load' messages but only 1 ImportError, is this because your log is abridged or is this what you actually saw?
Difference: Even though Domoticz couldn't find the plugin file at all I never got any '()' entires, the plugin name was always present in the errors
Similarity (finally!): The 1st part of the Python Path is the OS specific separator (I did this on Windows obviously and you did not). I believe this means that at startup Domoticz did not find the plugin. You can confirm this by going into the Hardware page, if the 'Type' column is blank for your plugin it was not found so the XML definition was not parsed.
The reason behind you just see 1 import error is I truncated the text from the log file. Both import fails.

As you can see from the edit I made of my post, problem is solved. The import fails if you have other files in the plugin directory. This has been confirmed by @zaraki673 as well. In my case python has created a cache directory, and that caused my problems. I wonder if this problem is platform dependent. I'm running Rasbian. You develop on Windows or?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest