(2022 Nov 23, 05:24 PM)tutqiunnh Wrote:Thanks for the feedback Bryan,(2022 Nov 17, 04:22 PM)dan Wrote: I think I found a solution.
I just pushed an update to GitHub.
As of version: 4.1.51 the GET commands for options should be working
Also the GET commands PDF has been updated to show the correct commands:
https://raw.githubusercontent.com/wiki/D...mmands.pdf
For example, to set the water level you would use <SIP URL>/co?owl=50
assuming password access is not on.
Let me know if you encounter any problems.
Dan
Dan,
Got the update installed using the system update on the website. Ran into the following issues:
1) I had to move the webages.py file that I modified earlier to get the update to install.
2) I'm using it on an Dell Wyse z90d7 mini pc running Ubuntu that does not have GPIO pins. So the restart fails due to the GPIO.cleanup()
Exception in thread Thread-14:
Nov 23 11:58:29 bdp-cam-serv1 sip[69234]: Traceback (most recent call last):
Nov 23 11:58:29 bdp-cam-serv1 sip[69234]: File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
Nov 23 11:58:29 bdp-cam-serv1 sip[69234]: self.run()
Nov 23 11:58:29 bdp-cam-serv1 sip[69234]: File "/usr/lib/python3.8/threading.py", line 870, in run
Nov 23 11:58:29 bdp-cam-serv1 sip[69234]: self._target(*self._args, **self._kwargs)
Nov 23 11:58:29 bdp-cam-serv1 sip[69234]: File "/home/bitman1/SIP/helpers.py", line 176, in restart
Nov 23 11:58:29 bdp-cam-serv1 sip[69234]: GPIO.cleanup()
Nov 23 11:58:29 bdp-cam-serv1 sip[69234]: NameError: name 'GPIO' is not defined
workaround was to do a restart using systemctl
Web Home page shows the correct version of SIP and syslog showed that just webpages.py was updated for this update.
I will let you know after some testing how this update works. I will be using it in password mode.
On a separate note. I have a couple of hacks that I added to gv.py and helpers.py to attempt fix cpu temperature display issue on my Ubuntu install. I assume that I will have to do the same move the gv.py and helpers.py files for future updates that include these files.
Here are my hacks
gv.py
#determine platform for use with temperature and other system specific items
oscmd = "cat /etc/os-release | grep ^ID= | sed -e 's/^ID=//'"
osval = subprocess.check_output(oscmd, shell=True).strip() #returns output of cmd with byte value
platform = osval.decode("utf-8")
helpers.py
def get_cpu_temp():
"""
Reads and returns the Celsius temperature of the CPU if available.
# If unit is F, temperature is returned as Fahrenheit otherwise Celsius.
"""
try:
print(gv.platform)
if gv.platform == u"bo":
res = os.popen(u"cat /sys/class/hwmon/hwmon0/device/temp1_input").readline()
temp = u"" + str(int(res / 1000.0))
>>>> elif gv.platform == "raspbian" or gv.platform == "debian" or gv.platform == "ubuntu": <<<<
command = u"cat /sys/class/thermal/thermal_zone0/temp"
output = int(subprocess.check_output(command.split()))
temp = int(output / 1000.0)
else:
return u""
return temp
except Exception:
return u""
These 2 hacks work for raspberry pi using rasbian or debian or ubuntu and other hardware running debian or ubuntu.
Best,
Bryan
You are definitely running SIP under unusual conditions but I think others have tried something similar.
I'll take a look at the "name 'GPIO' is not defined" error. There is an internal option to disable the use of GPIO pins (gv.use_gpio_pins = 0) so it may be possible to skip the error in future updates.
I'll also check out your temperature code and probably include it in a future update.
SIP's system updater uses git pull to do the update and raises an error of you have made any uncommitted changes to the code. One way around that is to do a git stash before the update to save your changes, then do the update and then
git stash apply to restore your changes.
Dan
<p><br></p>