This plugin dynamically get the current working dir.
Am not sure that is anything to do apart from replacing all references with direct paths, at least for getcwd()
if (Parameters["Mode5"] == 'True'):
Domoticz.Log("Plugin Security Scan is enabled")
# Reading secpoluserFile and populating array of values
secpoluserFile = "/home/domoticz/domoticz" + "/plugins/PP-MANAGER/secpoluser.txt"
Domoticz.Debug("Checking for SecPolUser file on:" + secpoluserFile)
if (os.path.isfile(secpoluserFile) == True):
Domoticz.Log("secpoluser file found. Processing!!!")
# Open the file
secpoluserFileHandle = open(secpoluserFile)
# use readline() to read the first line
line = secpoluserFileHandle.readline()
while line:
if mid(line,0,4) == "--->":
secpoluserSection = mid(line,4,len(line))
Domoticz.Log("secpoluser settings found for plugin:" + secpoluserSection)
if ((mid(line,0,4) != "--->") and (line.strip() != "") and (line.strip() != " ")):
Domoticz.Debug("SecPolUserList exception (" + secpoluserSection.strip() + "):'" + line.strip() + "'")
#SecPolUserList.append(line.strip())
#SecPolUserList[secpoluserSection].append(line.strip())
if secpoluserSection.strip() not in self.SecPolUserList:
self.SecPolUserList[secpoluserSection.strip()] = []
self.SecPolUserList[secpoluserSection.strip()].append(line.strip())
# use realine() to read next line
line = secpoluserFileHandle.readline()
secpoluserFileHandle.close()
Domoticz.Log("SecPolUserList exception:" + str(self.SecPolUserList))
else:
self.SecPolUserList = {"Global":[]}
i = 0
path = "/home/domoticz/domoticz" + "/plugins/"
for (path, dirs, files) in os.walk(path):
for dir in dirs:
if str(dir) != "":
#self.UpdatePythonPlugin(pluginAuthor, pluginRepository, str(dir))
#parseFileForSecurityIssues("/home/domoticz/domoticz" + "/plugins/PP-MANAGER/plugin.py")
if (os.path.isfile("/home/domoticz/domoticz" + "/plugins/" + str(dir) + "/plugin.py") == True):
self.parseFileForSecurityIssues("/home/domoticz/domoticz" + "/plugins/" + str(dir) + "/plugin.py", str(dir))
i += 1
if i >= 1:
break
# Reading exception file and populating array of values
exceptionFile = "/home/domoticz/domoticz" + "/plugins/PP-MANAGER/exceptions.txt"
Domoticz.Debug("Checking for Exception file on:" + exceptionFile)
if (os.path.isfile(exceptionFile) == True):
Domoticz.Log("Exception file found. Processing!!!")
# Open the file
f = open(exceptionFile)
# use readline() to read the first line
line = f.readline()
while line:
if ((line[:1].strip() != "#") and (line[:1].strip() != " ") and (line[:1].strip() != "")):
Domoticz.Log("File ReadLine result:'" + line.strip() + "'")
self.ExceptionList.append(line.strip())
# use realine() to read next line
line = f.readline()
f.close()
Domoticz.Debug("self.ExceptionList:" + str(self.ExceptionList))
if Parameters["Mode4"] == 'All':
Domoticz.Log("Updating All Plugins!!!")
i = 0
path = "/home/domoticz/domoticz" + "/plugins/"
for (path, dirs, files) in os.walk(path):
for dir in dirs:
if str(dir) != "":
if str(dir) in self.plugindata:
self.UpdatePythonPlugin(pluginAuthor, pluginRepository, str(dir))
elif str(dir) == "PP-MANAGER":
Domoticz.Debug("PP-Manager Folder found. Skipping!!")
else:
Domoticz.Log("Plugin:" + str(dir) + " cannot be managed with PP-Manager!!.")
i += 1
if i >= 1:
break
if Parameters["Mode4"] == 'AllNotify':
Domoticz.Log("Collecting Updates for All Plugins!!!")
i = 0
path = "/home/domoticz/domoticz" + "/plugins/"
for (path, dirs, files) in os.walk(path):
for dir in dirs:
if str(dir) != "":
if str(dir) in self.plugindata:
self.CheckForUpdatePythonPlugin(pluginAuthor, pluginRepository, str(dir))
elif str(dir) == "PP-MANAGER":
Domoticz.Debug("PP-Manager Folder found. Skipping!!")
else:
Domoticz.Log("Plugin:" + str(dir) + " cannot be managed with PP-Manager!!.")
i += 1
if i >= 1:
break
if (Parameters["Mode4"] == 'SelectedNotify'):
Domoticz.Log("Collecting Updates for Plugin:" + pluginKey)
self.CheckForUpdatePythonPlugin(pluginAuthor, pluginRepository, pluginKey)
if pluginKey == "Idle":
Domoticz.Log("Plugin Idle")
Domoticz.Heartbeat(60)
else:
Domoticz.Debug("Checking for dir:" + "/home/domoticz/domoticz" + "/plugins/" + pluginKey)
#If plugin Directory exists
if (os.path.isdir("/home/domoticz/domoticz" + "/plugins/" + pluginKey)) == True:
Domoticz.Debug("Folder for Plugin:" + pluginKey + " already exists!!!")
#Domoticz.Debug("Set 'Python Plugin Manager'/ 'Domoticz plugin' attribute to 'idle' in order t.")
if Parameters["Mode4"] == 'Selected':
Domoticz.Debug("Updating Enabled for Plugin:" + pluginText + ".Checking For Update!!!")
self.UpdatePythonPlugin(pluginAuthor, pluginRepository, pluginKey)
Domoticz.Heartbeat(60)
else:
Domoticz.Log("Installation requested for Plugin:" + pluginText)
Domoticz.Debug("Installation URL is:" + "https://github.com/" + pluginAuthor +"/" + pluginRepository)
Domoticz.Debug("Current Working dir is:" + "/home/domoticz/domoticz")
if pluginKey in self.plugindata:
Domoticz.Log("Plugin Display Name:" + pluginText)
Domoticz.Log("Plugin Author:" + pluginAuthor)
Domoticz.Log("Plugin Repository:" + pluginRepository)
Domoticz.Log("Plugin Key:" + pluginKey)
Domoticz.Log("Plugin Branch:" + pluginBranch)
self.InstallPythonPlugin(pluginAuthor, pluginRepository, pluginKey, pluginBranch)
Domoticz.Heartbeat(60)
def onStop(self):
Domoticz.Debug("onStop called")
Domoticz.Log("Plugin is stopping.")
self.UpdatePythonPlugin("ycahome", "pp-manager", "PP-MANAGER")
Domoticz.Debugging(0)
if (mid(CurHr,0,2) == "12" and mid(CurMin,0,2) == "00"):
Domoticz.Log("Its time!!. Trigering Actions!!!")
#-------------------------------------
if Parameters["Mode4"] == 'All':
Domoticz.Log("Checking Updates for All Plugins!!!")
i = 0
path = "/home/domoticz/domoticz" + "/plugins/"
for (path, dirs, files) in os.walk(path):
for dir in dirs:
if str(dir) != "":
self.UpdatePythonPlugin(self.plugindata[Parameters["Mode2"]][0], self.plugindata[Parameters["Mode2"]][1], str(dir))
i += 1
if i >= 1:
break
if Parameters["Mode4"] == 'AllNotify':
Domoticz.Log("Collecting Updates for All Plugins!!!")
i = 0
path = "/home/domoticz/domoticz" + "/plugins/"
for (path, dirs, files) in os.walk(path):
for dir in dirs:
if str(dir) != "":
self.CheckForUpdatePythonPlugin(self.plugindata[Parameters["Mode2"]][0], self.plugindata[Parameters["Mode2"]][1], str(dir))
i += 1
if i >= 1:
break
if Parameters["Mode4"] == 'SelectedNotify':
Domoticz.Log("Collecting Updates for Plugin:" + pluginKey)
self.CheckForUpdatePythonPlugin(self.plugindata[Parameters["Mode2"]][0], self.plugindata[Parameters["Mode2"]][1], Parameters["Mode2"])
#-------------------------------------
if Parameters["Mode4"] == 'Selected':
Domoticz.Log("Checking Updates for Plugin:" + self.plugindata[pluginKey][2])
self.UpdatePythonPlugin(self.plugindata[Parameters["Mode2"]][0], self.plugindata[Parameters["Mode2"]][1], Parameters["Mode2"])
#if Parameters["Mode2"] == "Idle":
#Domoticz.Log("Plugin Idle. No actions to be performed!!!")
if pypluginid not in self.SecPolUserList:
self.SecPolUserList[pypluginid] = []
lineNum = 1
#Domoticz.Error("self.SecPolUserList[pypluginid]:" + str(self.SecPolUserList[pypluginid]))
for text in file.readlines():
text = text.rstrip()
#Domoticz.Log("'text' is:'" + str(text))
regexFound = re.findall(r'(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})',text)
paramFound = re.findall(r'<param field=',text)
if ((regexFound) and not (paramFound)):
#regexFound[rex] = regexFound[rex].strip('"]')
#Domoticz.Error("Security Finding(IPregex):" + str(regexFound) + " LINE: " + str(lineNum) + " FILE:" + pyfilename)
for rex in range(0,len(regexFound)):
if ((str(text).strip() not in self.SecPolUserList["Global"]) and (str(text).strip() not in self.SecPolUserList[pypluginid]) and (str(text).strip() != "") and (mid(text,0,1) != "#")):
Domoticz.Error("Security Finding(IP):-->" + str(text).strip() + "<-- LINE: " + str(lineNum) + " FILE:" + pyfilename)
#Domoticz.Error("Security Finding(IPr):" + regexFound[rex] + " LINE: " + str(lineNum) + " FILE:" + pyfilename)
ips["IP" + str(lineNum)] = (regexFound[rex], "IP Address")
#rex = 0
#regexFound = re.findall('import', text)
#if regexFound:
#regexFound[rex] = regexFound[rex].strip('"]')
#Domoticz.Error("Security Finding(IPregex):" + str(regexFound) + " LINE: " + str(lineNum) + " FILE:" + pyfilename)
# for rex in range(0,len(regexFound)):
# if ((str(text).strip() not in self.SecPolUserList["Global"]) and (str(text).strip() not in self.SecPolUserList[pypluginid]) and (str(text).strip() != "") and (mid(text,0,1) != "#")):
# Domoticz.Error("Security Finding(IMP):-->" + str(text) + "<-- LINE: " + str(lineNum) + " FILE:" + pyfilename)
#Domoticz.Error("Security Finding(IPr):" + regexFound[rex] + " LINE: " + str(lineNum) + " FILE:" + pyfilename)
# ips["IP" + str(lineNum)] = (regexFound[rex], "Import")
yes, after nothing worked anymore i backed up my folder and deleted it, did a new git pull.
Just tried it again and it keeps referring to the wrong cwd.
I must say that also my zigbee2mqtt plugin is acting up and giving errors.
I might have to clean install ubuntu again and try it that way.
remove pp-manager hardware, delete plugin folder, download pp-manager zip from github and extract folder to your plugins.
That way pp-manager will not auto update. Maybe this is your problem.
NOTE for other users: this is a work around solution to put a different path for plugins instead of auto detect.
I have 2 remarks/questions regarding the plugin manager:
1. I created a plugin to connect to Dyson Pure hot+cool air purifiers/fans, how can I add it? Plugin name "Dyson Pure Link", repo https://github.com/JanJaapKo/DysonPureLink
2. there is the "GoodWe solar inverter via SEMS API" plugin listed on the page. That seems no longer to be supported, perhaps you could add my fork? repo https://github.com/JanJaapKo/domoticz-GoodWeSEMS
Thanks
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
I have 2 remarks/questions regarding the plugin manager:
1. I created a plugin to connect to Dyson Pure hot+cool air purifiers/fans, how can I add it? Plugin name "Dyson Pure Link", repo https://github.com/JanJaapKo/DysonPureLink
2. there is the "GoodWe solar inverter via SEMS API" plugin listed on the page. That seems no longer to be supported, perhaps you could add my fork? repo https://github.com/JanJaapKo/domoticz-GoodWeSEMS
Thanks
Hello,
#1. you can create a pull request on https://github.com/ycahome/pp-manager
#2. you can add your version as additional version (something like "ver JanJaap" or "-fork JJ")
Thanks for answer (was a bit busy with other stuff, sorry for late reply)
1. PR created (#26).
2. I can't edit the Wiki page. The rights management seems to have changed? Anyway, I added this plugin to the PR .
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
Thanks to ycahome's great work and basing on the original plugin I've created alternate version with UI (using Domoticz custom page) to easily manage plugins. Hopefully someone else also find it useful. Any feedback is highly welcome
StasDemydiuk wrote: ↑Wednesday 27 May 2020 18:44
Thanks to ycahome's great work and basing on the original plugin I've created alternate version with UI (using Domoticz custom page) to easily manage plugins. Hopefully someone else also find it useful. Any feedback is highly welcome
Did anyone got this to work on synology already?
I can install plugin manager and other plugins manually, but cant install plugins via plugin manager.
There are posts from 2 years ago that reported the same. Hopefully someone knows a solution by now. Or should I just give up?
StasDemydiuk wrote: ↑Wednesday 27 May 2020 18:44
Thanks to ycahome's great work and basing on the original plugin I've created alternate version with UI (using Domoticz custom page) to easily manage plugins. Hopefully someone else also find it useful. Any feedback is highly welcome
StasDemydiuk wrote: ↑Wednesday 27 May 2020 18:44
Thanks to ycahome's great work and basing on the original plugin I've created alternate version with UI (using Domoticz custom page) to easily manage plugins. Hopefully someone else also find it useful. Any feedback is highly welcome
This is a very nice peace of work. It works OK on my system. Added another plugin an it is visible in the list. Still have to test or you can update it correctly.
Little question: Is there a way to hide/unhide the not installed plugins in the GUI list?
StasDemydiuk wrote: ↑Wednesday 27 May 2020 18:44
Thanks to ycahome's great work and basing on the original plugin I've created alternate version with UI (using Domoticz custom page) to easily manage plugins. Hopefully someone else also find it useful. Any feedback is highly welcome
Hello! Are there any options to automate python module installation ? My plugin has dependency on python modules which can be installed via pip3.
It would be nice to install dependencies with plugin manager.
StasDemydiuk wrote: ↑Wednesday 27 May 2020 18:44
Thanks to ycahome's great work and basing on the original plugin I've created alternate version with UI (using Domoticz custom page) to easily manage plugins. Hopefully someone else also find it useful. Any feedback is highly welcome
Installed this and it does show a 'custom' tab. However if I go to the tab, it stays at 'loading', no plugins are showed.
Any suggestions how to solve this? (have the correct python and libraries). I use the 'Thinktheme', but don't know if that has any influence.
Thanks for your help.