threading in Python plugin

Python and python framework

Moderator: leecollings

Post Reply
nhale25
Posts: 1
Joined: Monday 24 June 2019 12:20
Target OS: Linux
Domoticz version: 4.10717
Location: UK
Contact:

threading in Python plugin

Post by nhale25 »

Hi, I see on the wiki [1] it says that a future version will support threading in a Python plugin.I'm wondering if that information is up to date. I'm running version 4.10717, and looking in git, it looks like at least the threading example plugin script is in that version, so can I expect threading to work? Or am I misinterpreting?

I'm currently working on a plugin for TP-Link plugs and bulbs. Due to limitations in the Connection API, and to avoid blocking, I'm having to do certain things in a different thread and everything does seem to be working as expected.

My other question is (assuming threading is supported in this version): Is there any information on using the plugin API safely from other threads? For example, can I make a device and call Device.Create() from another thread? Do I need to manually synchronise access to the the Devices dictionary?

Thanks

[1] https://www.domoticz.com/wiki/Developin ... rk_details:
pipiche
Posts: 2016
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: threading in Python plugin

Post by pipiche »

Yes it is available and as an example you have one here: https://github.com/domoticz/domoticz/bl ... hreaded.py
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest