Using CustomImages with the Python framework

Python and python framework

Moderator: leecollings

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

Using CustomImages with the Python framework

Post by Dnpwwo »

The next beta will have functionality to allow developers to add custom images to plugins.

Have a look at the documentation here: http://www.domoticz.com/wiki/Developing ... gin#Images if you are interested

Basically, standard Domoticz custom images zips can be loaded from the plugin's home folder and the framework makes the actual image number available to the plugin so that it can be set using the existing Device.Update() function.

The example on the wiki shows how to give users the choice of three images via the hardware page but the image can be set for any reason: linked to device state or device value (like the standard weather devices)
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
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Using CustomImages with the Python framework

Post by remb0 »

Great job :!:
gerardvs
Posts: 81
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

Re: Using CustomImages with the Python framework

Post by gerardvs »

Yeah, great addition!

I was already thinking how to dynamically change icons. Ideally generating a small picture with a course graph or symbol with the python plugin and show it on the fly. This is a useful step towards that idea.

--Gerard
tester22
Posts: 49
Joined: Tuesday 20 December 2016 17:43
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Sweden
Contact:

Re: Using CustomImages with the Python framework

Post by tester22 »

I tried to use the function in the Sonos Plugin. Works on my Pi but another user got the following error:

2017-03-08 14:22:54.664 (Sonos Eetkamer) Initialized version 1.0, author 'tester22'
2017-03-08 14:22:54.719 Error: Domoticz received fatal signal 11 !...
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz() [0x1be334]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_Z14signal_handleri+0x58) [0x1be3ec]
2017-03-08 14:22:54.732 Error: /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76add180]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_ZNSs6assignERKSs+0x98) [0x6a7e70]
2017-03-08 14:22:54.732 Error: /home/pi/domoticz/domoticz(_ZN7Plugins11CImage_initEPNS_6CImageEP7_objectS3_+0x21c)

Here is my implementation:
https://github.com/tester22/Domoticz-So ... 8ecc29c921

Any idea what might be causing this?
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: Using CustomImages with the Python framework

Post by Dnpwwo »

@tester22,

I've used it on Windows and Linux and it seemed fine so platform shouldn't be an issue.

Can you request a log with debug turned on? May add logging around the Images based lines?
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
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest