-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Your doorIsOpen() function polls the door status on the webserver. Using the local status directly on the Ampel would be better. If the Pi would loose it's internet connection your status won't update anymore..
The communication is done with a unix socket. Here is our snippet to do this:
def notify(cmd, path='/var/run/ampel.sock'):
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(path)
s.send(cmd.encode())
res = s.recv(1024).decode()
s.close()
return resMaybe you could simply import our foreman.py to do this job.
import foreman
print(foreman.notify("Status")) # prints OpenLab, CloseLab or BlinkLabMetadata
Metadata
Assignees
Labels
No labels