|
Post by julian46 on Jan 18, 2014 10:16:37 GMT -8
Faraday (John) of Project Curacao posted a great video demoing his setup for his amazing remote environmental monitoring project.
In the video he has some control buttons below what I presume are "Remote Webview" windows.
He manages to cycle through different screens by pressing the buttons below - does anyone know how this is done ? (they new window overlaps the same area as the old)
thanks
|
|
|
Post by SDL on Jan 18, 2014 12:51:38 GMT -8
Julian,
I just watched the video too right after it was posted. Very cool.
I went over to his source code repository and looked at his Local.py file in RasPiConnect
What I found was that he is using a feedback button and storing the state of the feedback button on the Raspberry Pi. He then uses if statements to cycle through a serial of images of graphs (rather than changing the whole page - he could do that too in the the Local.py file).
The feedback button code looks like:
# FB-15 - summary page complex graph chart if (objectServerID == "FB-15"):
#check for validate request # validate allows RasPiConnect to verify this object is here if (validate == "YES"): outgoingXMLData += Validate.buildValidateResponse("YES") outgoingXMLData += BuildResponse.buildFooter() return outgoingXMLData
# not validate request, so execute
responseData = "pi power volts"
if (objectName is None): objectName = "pi power volts" lowername = objectName.lower()
if (lowername == "env temp/hum"):
responseData = "env lum/fan/bar" responseData = responseData.title()
f = open("./local/SumPageGraphSelect.txt", "w") f.write(lowername) f.close()
elif (lowername == "env lum/fan/bar"):
responseData = "pi power volts" responseData = responseData.title()
f = open("./local/SumPageGraphSelect.txt", "w") f.write(lowername) f.close()
elif (lowername == "pi power volts"):
responseData = "pi power currents" responseData = responseData.title()
f = open("./local/SumPageGraphSelect.txt", "w") f.write(lowername) f.close()
elif (lowername == "pi power currents"):
responseData = "pi system stats" responseData = responseData.title()
f = open("./local/SumPageGraphSelect.txt", "w") f.write(lowername) f.close()
elif (lowername == "pi system stats"):
responseData = "watchdog volts" responseData = responseData.title()
f = open("./local/SumPageGraphSelect.txt", "w") f.write(lowername) f.close()
elif (lowername == "watchdog volts"):
responseData = "watchdog currents" responseData = responseData.title()
f = open("./local/SumPageGraphSelect.txt", "w") f.write(lowername) f.close()
elif (lowername == "watchdog currents"):
responseData = "env temp/hum" responseData = responseData.title()
f = open("./local/SumPageGraphSelect.txt", "w") f.write(lowername) f.close()
# defaults to display currents else:
f = open("./local/SumPageGraphSelect.txt", "w") f.write(lowername) f.close()
responseData = "env temp/hum" responseData = lowername.title()
outgoingXMLData += BuildResponse.buildResponse(responseData) outgoingXMLData += BuildResponse.buildFooter() return outgoingXMLData
I assume he has also (in the RasPiConnect App Panel setup page (under edit button/customize)) set up the W-16 PICTURE_REMOTE_WEBVIEW_UITYPE to refresh with the button push.
He is using a PICTURE_REMOTE_WEBVIEW_UITYPE (W-16) to display the images. On refresh of W-16, he reads the SumPageGraphSelect.txt file and displays the image file name in the file.
Clever, indeed.
W-16 is a long piece of code, but it's pretty straight forward. The HTML code and image name change on refresh depending on the contents of the SumPageGraphSelect.txt
Look at the code on github.com/projectcuracao in the file Local.py
Hope that helped!
Best regards,
BP
|
|