Skip to content

Commit

Permalink
Merge pull request #36 from stigok/door-trigger-brusweb
Browse files Browse the repository at this point in the history
Add door trigger to brusweb
  • Loading branch information
stigok authored Aug 29, 2017
2 parents 844801f + 0ed45ce commit 4274215
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hackeriet/web/brusweb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ def admin():
return render_template('admin.html', username=user,
users=members.list_users())

@app.route("/brus/door/hackeriet/open", methods=['POST'])
@requires_auth
def open_door():
user=request.authorization.username
signature='%s (brusweb)' % user
mqtt('hackeriet/door/hackeriet/open', signature)
return 'Door triggered'

@app.route("/brus/admin/add", methods=['POST'])
@requires_admin
def admin_add():
Expand Down
7 changes: 7 additions & 0 deletions hackeriet/web/brusweb/templates/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
<body>
<h1>Hei {{username}}!</h1>
<a href="https://logg:[email protected]/brus/account">Logg ut</a>.

<h2>Vil du åpne døra?</h2>

<form action="/brus/door/hackeriet/open" method="post">
<input type="submit" name="btn_opendoor" value="Trigger Hackeriet door lock">
</form>

<h2>Din saldo er: {{balance}}</h2>

<h2>Fyll på spenn</h2>
Expand Down

0 comments on commit 4274215

Please sign in to comment.