Python Plugin Beta testers - please read this
Moderator: leecollings
-
- Posts: 50
- Joined: Saturday 01 February 2014 13:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin Beta testers - please read this
@gizmocuz, @Dnpwwo
I am not sure to understand eerything.
I start to code my own functions to connection to MELCloud.
It look like it work. It is not yet finish. I will share with you the result.
I am not sure to understand eerything.
I start to code my own functions to connection to MELCloud.
It look like it work. It is not yet finish. I will share with you the result.
-
- Posts: 50
- Joined: Saturday 01 February 2014 13:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin Beta testers - please read this
Thank a lot for creating Python plugin. It is perfect for me.
I create a first version of MELCloud plugin.
I create a Wiki page for instructions http://www.domoticz.com/wiki/Plugins/MELCloud.html
It is not finish but it work well.
I create a first version of MELCloud plugin.
I create a Wiki page for instructions http://www.domoticz.com/wiki/Plugins/MELCloud.html
It is not finish but it work well.
-
- Posts: 50
- Joined: Saturday 01 February 2014 13:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin Beta testers - please read this
@Dnpwwo
For code my plugin, i made a fresh install of domoticz on ubuntu. It work well.
My plugin work, well, I would like to install it on my domoticz setup. I use a raspberry pi for this.
plugin directory is not available. Do you kwnow why? I have the same version on Ubuntu and Raspberry Pi.
For code my plugin, i made a fresh install of domoticz on ubuntu. It work well.
My plugin work, well, I would like to install it on my domoticz setup. I use a raspberry pi for this.
plugin directory is not available. Do you kwnow why? I have the same version on Ubuntu and Raspberry Pi.
-
- 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
I you update to latest beta by running ./updatebeta in the domoticz directory, the plugin directory should be created. And there will be a few examples included as well. At least that happened to me when I made a fresh install on a new Rasp.
-
- Posts: 59
- Joined: Saturday 14 January 2017 21:37
- Target OS: Linux
- Domoticz version: Beta
- Location: Ukraine
- Contact:
Re: Python Plugin Beta testers - please read this
I'm trying to use Python requests library to make HTTP calls. I have the latest Domoticz Beta version 3.7266, but with previous versions I have the same problem.
I faced with really strange behavior:
1. When I'm trying to import request module in the file head, plugin stops working immediately, even onStart is not called
2. When I'm trying to import request module in onHeartbeat function then this function will be called ones, return result to Domoticz (log message in example) and plugin stops working
Maybe someone know what's happening or faced with the same problem?
Sample plugin code is in attachment.
I faced with really strange behavior:
1. When I'm trying to import request module in the file head, plugin stops working immediately, even onStart is not called
Code: Select all
import Domoticz
import sys
sys.path.append(sys.prefix+'/lib/site-packages')
import requests;
def onStart():
Domoticz.Log('Start')
return True
Maybe someone know what's happening or faced with the same problem?
Sample plugin code is in attachment.
- Attachments
-
- plugin.py.txt
- (889 Bytes) Downloaded 145 times
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Python Plugin Beta testers - please read this
I had the same issue with the requests module and my Sony Bravia python scripts.
I changed to urllib module and then it's working fine.
See https://www.domoticz.com/forum/viewtopi ... 10#p126606.
I changed to urllib module and then it's working fine.
See https://www.domoticz.com/forum/viewtopi ... 10#p126606.
Not using Domoticz anymore
-
- Posts: 59
- Joined: Saturday 14 January 2017 21:37
- Target OS: Linux
- Domoticz version: Beta
- Location: Ukraine
- Contact:
Re: Python Plugin Beta testers - please read this
Thank you for solution.G3rard wrote:I had the same issue with the requests module and my Sony Bravia python scripts.
I changed to urllib module and then it's working fine.
See https://www.domoticz.com/forum/viewtopi ... 10#p126606.
Maybe someone know the root cause of problem or the way how I can debug it.
-
- 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
I have seen a similar problem importing a GPIO library. The complete plugin system halts. No callback function is called. Just a import reference is enough to result in this error.
Skickat från min ONEPLUS A3003 via Tapatalk
Skickat från min ONEPLUS A3003 via Tapatalk
-
- 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
I got the same problem with "import uuid".
- 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
One thing to consider is that a 'Just a import reference' means that Python will load and execute the library.
Some libaries will just not be happy with the restriction that Domoticz does not enable Python threading and will not be usable.
Some libaries will just not be happy with the restriction that Domoticz does not enable Python threading and will not be usable.
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
- jorgh
- Posts: 124
- Joined: Friday 27 June 2014 23:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8224
- Location: Netherlands
- Contact:
Re: Python Plugin Beta testers - please read this
@Dnpwwo,
I can understand, that not everything is possible within the Domoticz 'restricted' python environment. However I do think there is something strange going on. I've seen that calling a library function lock's up Domoticz depending on when it's called. In addition if a plugins throws an exception, Domoticz tends to completely lockup.
It would be nice if Domoticz would be protected against 'faulty' plugins. There could be coding errors resulting in throwing exceptions within the plugin, errors within standard libraries used or Domoticz restrictions that are not handled correctly within a library etc. All of these now tend to lockup the complete Domoticz system instead of just crashing/stopping the plugin it concerns.
The plugin system is a great new feature, and definitely gives Domoticz an edge over other systems, but in its current state (still beta of course) I think it compromises the stability of the Domoticz system and some steps should be made there.
Kind regards,
Jorg
I can understand, that not everything is possible within the Domoticz 'restricted' python environment. However I do think there is something strange going on. I've seen that calling a library function lock's up Domoticz depending on when it's called. In addition if a plugins throws an exception, Domoticz tends to completely lockup.
It would be nice if Domoticz would be protected against 'faulty' plugins. There could be coding errors resulting in throwing exceptions within the plugin, errors within standard libraries used or Domoticz restrictions that are not handled correctly within a library etc. All of these now tend to lockup the complete Domoticz system instead of just crashing/stopping the plugin it concerns.
The plugin system is a great new feature, and definitely gives Domoticz an edge over other systems, but in its current state (still beta of course) I think it compromises the stability of the Domoticz system and some steps should be made there.
Kind regards,
Jorg
-
- Posts: 41
- Joined: Saturday 09 April 2016 18:11
- Target OS: Linux
- Domoticz version: 3.7449
- Location: France
- Contact:
Re: Python Plugin Beta testers - please read this
[UPDATE] It seems it is working in fact even if there no message in the log. I can find the new element in the material list
Please apologize for my coming question but in the Kodi plugin there are a lot of reference to image number, swichType number, subtype... where could I found the reference for all those elements?
I went through the wiki but I have not been able to find it.
Thanks for your help.
I have tried to play with python plugin... but can't make it working. I am using the Kodi plugin that I put in a dedicated directory.
Here is my log file after restart
I don't have any error message but the plugin is not starting at all. An idea on what I might do wrong?
Thanks for your help.[/i]
Please apologize for my coming question but in the Kodi plugin there are a lot of reference to image number, swichType number, subtype... where could I found the reference for all those elements?
I went through the wiki but I have not been able to find it.
Thanks for your help.
I have tried to play with python plugin... but can't make it working. I am using the Kodi plugin that I put in a dedicated directory.
Here is my log file after restart
Code: Select all
2017-05-11 23:11:40.017 Domoticz V3.7450 (c)2012-2017 GizMoCuz
2017-05-11 23:11:40.018 Build Hash: 586c31f9, Date: 2017-05-11 18:05:12
2017-05-11 23:11:40.019 Startup Path: /home/mthomas/domoticz/
2017-05-11 23:11:40.093 Sunrise: 06:11:00 SunSet:20:44:00
2017-05-11 23:11:40.093 EventSystem: reset all events...
2017-05-11 23:11:40.146 PluginSystem: Started, Python version '3.4.3'.
2017-05-11 23:11:40.151 Active notification Subsystems: email, nma (2/12)
2017-05-11 23:11:40.152 WebServer(HTTP) started on address: :: with port 8080
2017-05-11 23:11:40.155 WebServer(SSL) started on address: :: with port 443
2017-05-11 23:11:40.155 Proxymanager started.
2017-05-11 23:11:40.157 Starting shared server on: :::6144
2017-05-11 23:11:40.157 RxQueue: queue worker started...
2017-05-11 23:11:40.157 TCPServer: shared server started...
Thanks for your help.[/i]
Last edited by Mat2Vence on Friday 12 May 2017 0:11, edited 1 time in total.
- 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
@Mat2Vence,
The plugin system is starting and if 'plugin.py' is in '/home/mthomas/domoticz/plugins/<any folder name>' then it will be found. There are no messages from plugins unless you create an entry on the hardware page that uses one.
Go to the hardware page and add the Kodi selecting 'Kodi Players' from the 'Type' drop down. After that you should see entries in the log as it starts.
The plugin system is starting and if 'plugin.py' is in '/home/mthomas/domoticz/plugins/<any folder name>' then it will be found. There are no messages from plugins unless you create an entry on the hardware page that uses one.
Go to the hardware page and add the Kodi selecting 'Kodi Players' from the 'Type' drop down. After that you should see entries in the log as it starts.
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
-
- Posts: 41
- Joined: Saturday 09 April 2016 18:11
- Target OS: Linux
- Domoticz version: 3.7449
- Location: France
- Contact:
Re: Python Plugin Beta testers - please read this
@Dnpwwo,
Thanks. You are right. It's working.
Did you know where to find all these reference of type, subtype, image ID that are used in Python plugin?
Thanks. You are right. It's working.
Did you know where to find all these reference of type, subtype, image ID that are used in Python plugin?
- 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
@Mat2Vence,
That stuff is not really documented all in one place, its in the Domoticz code itself.
If possible I would recommend using the TypeName parameter (see http://www.domoticz.com/wiki/Developing ... in#Devices) which will give you a working Type, SubType and ImageID combination.
If you know of device that has what you want you can create one then look in the DeviceStatus table in the database to find the Type & SubType.
What are you trying to create?
That stuff is not really documented all in one place, its in the Domoticz code itself.
If possible I would recommend using the TypeName parameter (see http://www.domoticz.com/wiki/Developing ... in#Devices) which will give you a working Type, SubType and ImageID combination.
If you know of device that has what you want you can create one then look in the DeviceStatus table in the database to find the Type & SubType.
What are you trying to create?
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
Re: Python Plugin Beta testers - please read this
I'm trying to develop a python plugin using google maps package. But at very basic level, when I just import the Google maps package, onStart is not being called anymore. If I drop the googlemaps import it is working again.
I don't get any errors however in the Domoticz log. What could be the problem?
So the output in the log in case of importing the package is just (nothing more):
2017-05-13 12:13:14.757 (Test) Initialized version 1.0.0, author 'mastair'
While when I drop the import the output is like expected:
2017-05-13 12:13:14.757 (Test) Initialized version 1.0.0, author 'mastair'
2017-05-13 12:13:14.757 (Test) onStart called
I don't get any errors however in the Domoticz log. What could be the problem?
So the output in the log in case of importing the package is just (nothing more):
2017-05-13 12:13:14.757 (Test) Initialized version 1.0.0, author 'mastair'
While when I drop the import the output is like expected:
2017-05-13 12:13:14.757 (Test) Initialized version 1.0.0, author 'mastair'
2017-05-13 12:13:14.757 (Test) onStart called
Code: Select all
"""
<plugin key="TrafficDelays" name="Traffic Delays" author="mastair" version="1.0.0">
<params>
</params>
</plugin>
"""
import Domoticz
import googlemaps
def onStart():
Domoticz.Log("onStart called")
return True
def onStop():
return True
def onConnect(Status, Description):
return True
def onMessage(Data, Status, Extra):
return True
def onCommand(Unit, Command, Level, Hue):
return True
def onNotification(Name, Subject, Text, Status, Priority, Sound, ImageFile):
return True
def onDisconnect():
return True
def onHeartbeat():
return True
# Generic helper functions
def DumpConfigToLog():
for x in Parameters:
if Parameters[x] != "":
Domoticz.Debug( "'" + x + "':'" + str(Parameters[x]) + "'")
Domoticz.Debug("Device count: " + str(len(Devices)))
for x in Devices:
Domoticz.Debug("Device: " + str(x) + " - " + str(Devices[x]))
Domoticz.Debug("Device ID: '" + str(Devices[x].ID) + "'")
Domoticz.Debug("Device Name: '" + Devices[x].Name + "'")
Domoticz.Debug("Device nValue: " + str(Devices[x].nValue))
Domoticz.Debug("Device sValue: '" + Devices[x].sValue + "'")
Domoticz.Debug("Device LastLevel: " + str(Devices[x].LastLevel))
return
- 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
@mastair,
That normally means that the library is trying to do asyncronous or thread stuff (which is not supported).
That normally means that the library is trying to do asyncronous or thread stuff (which is not supported).
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
Re: Python Plugin Beta testers - please read this
Thanks, got another question. Trying to create a custom sensor from Python, and I want to add the axis label / units.
In SQLite the options field of a similar device contains "1;minutes" without the quotes of course. I wouldn't know how to translate this to a python dictionary.
Anyone?
Edit: Figured it out, needed a newer version of Domoticz and provide this as dictionary: Options={"Custom": "1;minutes"}
In SQLite the options field of a similar device contains "1;minutes" without the quotes of course. I wouldn't know how to translate this to a python dictionary.
Anyone?
Edit: Figured it out, needed a newer version of Domoticz and provide this as dictionary: Options={"Custom": "1;minutes"}
-
- Posts: 65
- Joined: Wednesday 14 January 2015 12:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: India
- Contact:
Plugin system not starting at all post update
I had been using the Lifx plugin for the last 4-5 months and it was running very stable
I unfortunately ended up updating to the latest beta today and now the plugin system isn't starting at all
I even tried copying one of the example plugins (Denon4306) as /home/pi/domoticz/plugins/Denon4306/plugin.py and gave it execution rights (chmod 755) but for some reason,the plugin system seems to be dead altogether 
I unfortunately ended up updating to the latest beta today and now the plugin system isn't starting at all
Code: Select all
2017-06-07 01:16:31.957 Domoticz V3.7680 (c)2012-2017 GizMoCuz
2017-06-07 01:16:31.958 Build Hash: 81c1918, Date: 2017-06-06 11:57:47
2017-06-07 01:16:31.958 System: Raspberry Pi
2017-06-07 01:16:31.958 Startup Path: /home/pi/domoticz/
2017-06-07 01:16:32.285 EventSystem: reset all events...
2017-06-07 01:16:32.314 Using 1-Wire support (kernel W1 module)...
2017-06-07 01:16:32.317 Philips Hue: Using default poll interval of 10 secs.
2017-06-07 01:16:32.366 WebServer(HTTP) started on address: :: with port 8080
2017-06-07 01:16:32.393 WebServer(SSL) started on address: :: with port 443
2017-06-07 01:16:32.398 Proxymanager started.
2017-06-07 01:16:32.401 Camera: settings (re)loaded
2017-06-07 01:16:32.408 TCPServer: shared server started...
2017-06-07 01:16:32.410 RxQueue: queue worker started...
2017-06-07 01:16:34.411 Hardware Monitor: Started
2017-06-07 01:16:34.413 AppLamp: Worker Started...
2017-06-07 01:16:34.413 1Wire: Added Device: 28-000005b6dc30
2017-06-07 01:16:34.413 1Wire: Added Device: 28-000005b6aa6d
2017-06-07 01:16:34.793 Incoming connection from: 103.253.166.8
2017-06-07 01:16:36.086 I2C_BMP085/180: Worker started...
2017-06-07 01:16:36.087 AppLamp: Worker Started...
2017-06-07 01:16:36.087 Kodi: Started
2017-06-07 01:16:36.088 Harmony Hub: Worker thread started...
2017-06-07 01:16:36.088 Kodi: Started
2017-06-07 01:16:36.088 Philips Hue: Worker started...
2017-06-07 01:16:36.089 YeeLight Worker started...
2017-06-07 01:16:36.089 EventSystem: reset all events...
2017-06-07 01:16:36.092 EventSystem: reset all device statuses...
2017-06-07 01:16:36.104 EventSystem: Started
2017-06-07 01:16:37.084 MySensors: Using serial port: /dev/ttyUSB0
2017-06-07 01:16:38.346 Harmony Hub: Authentication successful
2017-06-07 01:17:00.311 LUA: 0.0059666786
2017-06-07 01:17:00.312 LUA: 20531.288041762
2017-06-07 01:17:02.994 Incoming connection from: 192.168.0.115
2017-06-07 01:17:03.548 PROXY: Authenticate result: success.
2017-06-07 01:17:07.392 Incoming connection from: 192.168.0.8
2017-06-07 01:17:07.579 Incoming connection from: 127.0.0.1
2017-06-07 01:17:10.700 Incoming connection from: 192.168.0.100
2017-06-07 01:17:13.235 Incoming connection from: 192.168.0.114

-
- Posts: 4
- Joined: Thursday 10 March 2016 12:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.4834
- Contact:
Re: Python Plugin Beta testers - please read this
I experience the same problem as @superczar
Who is online
Users browsing this forum: No registered users and 1 guest