I am trying to modify the Balena Dash project so the web page reverts to a home page after a period of inactivity. I’ve tried modifying the scheduler docker, overlaying JavaScript over a webpage, and trying to modify the Unclutter project. None of this has yielded great results, so I was wondering if anyone here had any suggestions?
Sure. In this case, I’m trying to show a website that allows users to sign a waiver before participating in an event. This waiver is hosted by EZWaiver-- a website that I don’t have control over. I tried making my own webpage with an iFrame pointing to our EZWaiver, but the refresh script didn’t work inside the iFrame.
I’ve also tried replacing the code in the Scheduler container with the following code
I’ve also looked into using the ADMBrowser solution but I kept getting errors stating that the command Python and the file browser.py weren’t found, even though I had added Python to the Dockerfile.template.
I understand that I can use Chron, but I don’t want the website to refresh while a user is filling out info.
Edit: I found another Balena project that is similar to what I’m trying to do, although it refreshes in regimented increments instead of timing how long the device has been idle. I will try to study this project and see if I can modify it to do what I need.
There is a container called touch that checks for touches on the screen.
The start.py triggers a restart of the wpe container every 600 seconds (you can update the code there).
If someone touches the screen, it restarts the counter, and so on.
Yes, then in your case you can modify the touch container and code to do something similar.
I haven’t used an HDMI+USB touch screen so I am not 100% sure how to do that. But see if you can get the touchscreen to trigger the actions then.
Already on it-- most touch screens just simulate a mouse cursor jumping to a position. I’m trying to edit your code to listen for mouse or keyboard input now. I will update this thread once I’m able to get it. Thanks again!
Small update on my progress: I looked into using the Pynput library instead of ft5406 because I think it would be more versatile, however I ran into issues with the X11/xorg dependencies. I’m now looking into solutions with PyQt5.
I’m still trying to get this working, but my novice coding skills are holding me back. I’m looking at either trying to run multiple containers with an X11 server or possibly using an entirely different web browser. If anyone in the forums has more experience and thinks this feature would be useful, feel free to contribute. I will be passing this along to a few colleagues to see what they think.
This is the error that is holding me back right now:
Error Log
touch Traceback (most recent call last):
touch File “start.py”, line 1, in
touch from pynput import keyboard
touch File “/usr/local/lib/python3.5/site-packages/pynput/init.py”, line 40, in
touch from . import keyboard
touch File “/usr/local/lib/python3.5/site-packages/pynput/keyboard/init.py”, line 49, in
touch from ._xorg import KeyCode, Key, Controller, Listener
touch File “/usr/local/lib/python3.5/site-packages/pynput/keyboard/_xorg.py”, line 39, in
touch from pynput._util.xorg import (
touch File “/usr/local/lib/python3.5/site-packages/pynput/_util/xorg.py”, line 40, in
touch _check()
touch File “/usr/local/lib/python3.5/site-packages/pynput/_util/xorg.py”, line 38, in _check
touch display = Xlib.display.Display()
touch File “/usr/local/lib/python3.5/site-packages/Xlib/display.py”, line 89, in init
touch self.display = _BaseDisplay(display)
touch File “/usr/local/lib/python3.5/site-packages/Xlib/display.py”, line 71, in init
touch protocol_display.Display.init(self, *args, **keys)
touch File “/usr/local/lib/python3.5/site-packages/Xlib/protocol/display.py”, line 84, in init
touch name, protocol, host, displayno, screenno = connect.get_display(display)
touch File “/usr/local/lib/python3.5/site-packages/Xlib/support/connect.py”, line 73, in get_display
touch return mod.get_display(display)
touch File “/usr/local/lib/python3.5/site-packages/Xlib/support/unix_connect.py”, line 76, in get_display
touch raise error.DisplayNameError(display)
touch Xlib.error.DisplayNameError: Bad display name “”
Hi @thundron I have been using Balena Cloud, and the Environment Variable values I input were “DISPLAY” and “:0”. Doing so gives me the following error:
Hi @cpollock,
would you mind providing us with the Dockerfile / Docker-Compose files so we can take a look if all dependencies are met ?
Regards
Thomas
Thanks for that. I have pinged the engineers. We will have to wait for someone familiar with this topic to come online so it might until tomorrow before someone takes a look at your files.
While we check the dependencies, could you try installing xhost and running xhost + before running your application and telling us if it changes anything?
It looks like the correct package is x11-utils, which I have imported. With Balena, how would I add xhost + privileges? I see that in regular Debian, I can do something like: xhost +si:localuser:root but I don’t that applies to Balena.
Without having xhost + added, it looks like the log errors are the same:
Logs
touch Traceback (most recent call last):
touch File "start.py", line 1, in <module>
touch from pynput import mouse
touch File "/usr/local/lib/python2.7/site-packages/pynput/__init__.py", line 40, in <module>
touch from . import keyboard
touch File "/usr/local/lib/python2.7/site-packages/pynput/keyboard/__init__.py", line 49, in <module>
touch from ._xorg import KeyCode, Key, Controller, Listener
touch File "/usr/local/lib/python2.7/site-packages/pynput/keyboard/_xorg.py", line 39, in <module>
touch from pynput._util.xorg import (
touch File "/usr/local/lib/python2.7/site-packages/pynput/_util/xorg.py", line 40, in <module>
touch _check()
touch File "/usr/local/lib/python2.7/site-packages/pynput/_util/xorg.py", line 38, in _check
touch display = Xlib.display.Display()
touch File "/usr/local/lib/python2.7/site-packages/Xlib/display.py", line 89, in __init__
touch self.display = _BaseDisplay(display)
touch File "/usr/local/lib/python2.7/site-packages/Xlib/display.py", line 71, in __init__
touch protocol_display.Display.__init__(self, *args, **keys)
touch File "/usr/local/lib/python2.7/site-packages/Xlib/protocol/display.py", line 89, in __init__
touch self.socket = connect.get_socket(name, protocol, host, displayno)
touch File "/usr/local/lib/python2.7/site-packages/Xlib/support/connect.py", line 87, in get_socket
touch return mod.get_socket(dname, protocol, host, dno)
touch File "/usr/local/lib/python2.7/site-packages/Xlib/support/unix_connect.py", line 127, in get_socket
touch raise error.DisplayConnectionError(dname, str(val))
touch Xlib.error.DisplayConnectionError: Can't connect to display ":0": [Errno 111] Connection refused