Python Plugin

Python and python framework

Moderator: leecollings

Post Reply
imcfarla
Posts: 64
Joined: Monday 04 December 2017 13:18
Target OS: Linux
Domoticz version:
Contact:

Python Plugin

Post by imcfarla »

I am having problems setting the TimedOut property on a device.

Error:

Code: Select all

2017-12-11 12:12:43.817 Error: (CDevice_update) Hive - Bedroom: Failed to parse parameters: 'nValue', 'sValue', 'SignalLevel', 'BatteryLevel' or 'Options' expected.
2017-12-11 12:12:43.817 Error: (Hive) 'CDevice_update' failed 'TypeError':''TimedOut' is an invalid keyword argument for this function'. 
Note the 2 single quotes before TimedOut above which may be relevant.

My code is

Code: Select all

Devices[unit].Update(nValue=Devices[unit].nValue, sValue=Devices[unit].sValue, TimedOut=1)
but this also happens when doing something like

Code: Select all

Devices[unit].Update(nValue=0, sValue='Off', TimedOut=0)
I am running the v3.8153 build from the website

Any ideas?
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin

Post by Logread »

@imcfaria,

The device timedout option is a recent addition to the plugin framework. You need to run a very recent beta.
imcfarla
Posts: 64
Joined: Monday 04 December 2017 13:18
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin

Post by imcfarla »

In which case is there anyway to get the version of domoticz from the python plugin interface?
Logread
Posts: 228
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python Plugin

Post by Logread »

imcfarla wrote: Monday 11 December 2017 17:41 In which case is there anyway to get the version of domoticz from the python plugin interface?
I am not sure this is exposed to plugins natively. I'd suggest to make an http call to the json API such as /json.htm?type=command&param=getversion
This will return a json object like this:

Code: Select all

{
   "DomoticzUpdateURL" : "http://www.domoticz.com/download.php?channel=beta&type=release&system=linux&machine=armv7l",
   "HaveUpdate" : false,
   "Revision" : 8775,
   "SystemName" : "linux",
   "build_time" : "2017-11-06 12:49:07",
   "dzvents_version" : "2.3.0",
   "hash" : "283e647d",
   "status" : "OK",
   "title" : "GetVersion",
   "version" : "3.8702"
}
from which you can extract the version.
imcfarla
Posts: 64
Joined: Monday 04 December 2017 13:18
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin

Post by imcfarla »

What is the difference between the Revision field and the version field?

Code: Select all

DomoticzUpdateURL	"http://www.domoticz.com/download.php?channel=stable&type=release&system=linux&machine=armv7l"
HaveUpdate	false
Revision	8153
SystemName	"linux"
build_time	"2017-12-15 12:30:19"
dzvents_version	"2.3.0"
hash	"0db2a6e1"
status	"OK"
title	"GetVersion"
version	"3.8788"
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

Post by Dnpwwo »

@imcfarla,

I added "DomoticzVersion", "DomoticzHash", "DomoticzBuildTime" entries to the Parameters dictionary today.

Should be in a beta soon.
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
imcfarla
Posts: 64
Joined: Monday 04 December 2017 13:18
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin

Post by imcfarla »

Cheers
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest