New plugin development questions
Posted: Monday 20 September 2021 12:26
I am not an experienced Python developer, but using the plugin.py template mentioned in the Domoticz Wiki, I am trying to develop a new hardware plugin based on a standalone Python script that is running fine from the command line of my RPi4B.
Unfortunately, in Domoticz I am running into problems right away. After installation of the plugin from the hardware tab, I get error messages. Are there limitation as to what libs you can import? Apart from the Domoticz and sys lib, I have added:
import aiohttp
import asyncio
import pysmartthings
These libs have been installed in Python3.7 from the CLI first.
The log says:
2021-09-20 12:05:56.549 Error: STEST1A: (SmartThings) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/smartthings/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-09-20 12:05:56.549 Error: STEST1A: (STEST1A) Module Import failed, exception: 'SyntaxError'
2021-09-20 12:05:56.549 Error: STEST1A: (STEST1A) Import detail: File: , Line: 49, offset: 8
2021-09-20 12:05:56.549 Error: STEST1A: (STEST1A) Error Line ' async with aiohttp.ClientSession() as session:
2021-09-20 12:05:56.549 Error: STEST1A: (STEST1A) No traceback available
Line 49 is in this section in which I try to fill an array with available devices of my SmartThings setup on start:
It looks like the asyncio and/or the aiohttp lib is not loaded. Or did I make a mistake?
Unfortunately, in Domoticz I am running into problems right away. After installation of the plugin from the hardware tab, I get error messages. Are there limitation as to what libs you can import? Apart from the Domoticz and sys lib, I have added:
import aiohttp
import asyncio
import pysmartthings
These libs have been installed in Python3.7 from the CLI first.
The log says:
2021-09-20 12:05:56.549 Error: STEST1A: (SmartThings) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/smartthings/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-09-20 12:05:56.549 Error: STEST1A: (STEST1A) Module Import failed, exception: 'SyntaxError'
2021-09-20 12:05:56.549 Error: STEST1A: (STEST1A) Import detail: File: , Line: 49, offset: 8
2021-09-20 12:05:56.549 Error: STEST1A: (STEST1A) Error Line ' async with aiohttp.ClientSession() as session:
2021-09-20 12:05:56.549 Error: STEST1A: (STEST1A) No traceback available
Line 49 is in this section in which I try to fill an array with available devices of my SmartThings setup on start:
Code: Select all
def onStart(self):
Domoticz.Log("onStart called")
async with aiohttp.ClientSession() as session:
api = pysmartthings.SmartThings(session, tokenSmartThings)
devices = await api.devices()