Smanar / Domoticz-deCONZ

deCONZ plugin for Domoticz (Zigbee application)
GNU General Public License v3.0
36 stars 27 forks source link

Python Plugin System: (ZigBee) Error during installing plugin custom page #91

Closed chrispazz closed 2 years ago

chrispazz commented 3 years ago

Installing plugin using official Domoticz docker give an error when copying custom pages. In Docker the plugins path is "/opt/domoticz/userdata/plugins" so relative paths has to be adjusted or a custom field in plugin settings has to be added to specify the correct path.

Smanar commented 3 years ago

Ha yes, something similar to https://github.com/stas-demydiuk/domoticz-zigbee2mqtt-plugin/issues/556 ?

Here it s paths I m using

    source_path = os.path.dirname(os.path.abspath(__file__)) + '/frontend'
    templates_path = os.path.abspath(source_path + '/../../../www/templates')

So the source_path is still the good one, but templates_path need to change ?

chrispazz commented 3 years ago

The problem is the same but I am using the Official Domoticz Docker image (not linuxserver one).

Source path is: /opt/domoticz/userdata/plugins/Domoticz-deCONZ/frontend/. templates_path is: /opt/domoticz/www/templates/.

Thank you

Smanar commented 3 years ago

Ha the code is using /opt/domoticz/userdata/www/templates/ instead of /opt/domoticz/www/templates/ for templates_path ?

Smanar commented 3 years ago

@chrispazz If it s just that the problem, I can just remove "/userdata/" from path.

chrispazz commented 3 years ago

@Smanar, no, you have to "add" userdata in path... ;)

Currently you are using: /opt/domoticz/plugins/Domoticz-deCONZ/frontend/.

but inside docker we have to use: /opt/domoticz/userdata/plugins/Domoticz-deCONZ/frontend/.

Smanar commented 3 years ago

But I don't understand, with the command

source_path = os.path.dirname(os.path.abspath(__file__)) + '/frontend'

I retreive the folder where the python file is installed ? so it will be /opt/domoticz/userdata/plugins/Domoticz-deCONZ/frontend/. for you ?

Or in docker you have 1 folder for python domoticz file "/opt/domoticz/plugins/Domoticz-deCONZ/" and one other for idk what in "/opt/domoticz/userdata/plugins/Domoticz-deCONZ/" If it s that, why ?

schroot72 commented 3 years ago

I have the same error. I use Domoticz in docker and all userdata is placed in /config. The plugin can thus be found in /config/plugins/Domoticz-deCONZ.

Smanar commented 3 years ago

@schroot72 so for you plugins files are in /config/plugins/Domoticz-deCONZ/plugin.py

So file to copy are in /config/plugins/Domoticz-deCONZ/frontend

And need to be copied where ? And why he haven't same path than you with the same oficial docker ?

schroot72 commented 3 years ago

I use a different docker, but Domoticz lets you specify the userdata/config folder in the startup command. When I check the domoticz development site, it states you can get the path of the plugin folder by using Parameters["HomeFolder"].

Smanar commented 3 years ago

I m using a python command to retreive the plugin folder source_path = os.path.dirname(os.path.abspath(__file__)) + '/frontend'

Like that I have the path with files I need to copy (the folder frontend in the plugin folder), but what is the destination diorectory for you ?

On the code I m using the previous path andd making templates_path = os.path.abspath(source_path + '/../../../www/templates')

schroot72 commented 3 years ago

I think I made the misstake myself, somehow the www folder was deleted from the config folder. I recopied it from the domoticz install folder and now that error is gone ! thank you.