Skip to content

Add door trigger to brusweb #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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