Skip to content

Commit 4274215

Browse files
authored
Merge pull request #36 from stigok/door-trigger-brusweb
Add door trigger to brusweb
2 parents 844801f + 0ed45ce commit 4274215

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

hackeriet/web/brusweb/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ def admin():
105105
return render_template('admin.html', username=user,
106106
users=members.list_users())
107107

108+
@app.route("/brus/door/hackeriet/open", methods=['POST'])
109+
@requires_auth
110+
def open_door():
111+
user=request.authorization.username
112+
signature='%s (brusweb)' % user
113+
mqtt('hackeriet/door/hackeriet/open', signature)
114+
return 'Door triggered'
115+
108116
@app.route("/brus/admin/add", methods=['POST'])
109117
@requires_admin
110118
def admin_add():

hackeriet/web/brusweb/templates/account.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
<body>
77
<h1>Hei {{username}}!</h1>
88
<a href="https://logg:[email protected]/brus/account">Logg ut</a>.
9+
10+
<h2>Vil du åpne døra?</h2>
11+
12+
<form action="/brus/door/hackeriet/open" method="post">
13+
<input type="submit" name="btn_opendoor" value="Trigger Hackeriet door lock">
14+
</form>
15+
916
<h2>Din saldo er: {{balance}}</h2>
1017

1118
<h2>Fyll på spenn</h2>

0 commit comments

Comments
 (0)