Get working scanning over rgpiod
This includes getting a list of chips, their line numbers, enumerating the properties of the lines/pins, and providing to the user the list of valid pins to connect to relays. It also includes reworking the fake relay system and the configuration file. I believe this ends the rampant refactoring and I'll now stabilize out some features.
This commit is contained in:
parent
cbffa327b9
commit
dd637c2eaa
5 changed files with 158 additions and 38 deletions
|
@ -6,7 +6,7 @@
|
|||
<h2>Relays</h2>
|
||||
<ul>
|
||||
{% for relay in relays %}
|
||||
<li><a href="/relay/{{ relay.id }}">{{ relay.name }}</a> - {{ relay.state }}</li>
|
||||
<li><a href="/relay/{{ relay.id }}">{{ relay.name }}</a> - {{ relay.state }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<h1>Relay Creation</h1>
|
||||
<form method="POST" action="/relay/create">
|
||||
<input type="text" name="name" placeholder="Pool Pump 1"></input>
|
||||
<select name="chip-and-number">:
|
||||
<select name="pin_id">:
|
||||
{% for pin in pins %}
|
||||
<option value="{{ pin.chip }}-{{ pin.number }}">{{ pin.name }}</option>
|
||||
<option value="{{ pin.chip.number }}-{{ pin.chip.name }}-{{ pin.line_number }}">{{ pin.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit">Create</button>
|
||||
|
|
21
templates/relay-detail.template.html
Normal file
21
templates/relay-detail.template.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<html>
|
||||
<h1>Pools'n'Pumps Device</h1>
|
||||
<h2>Relay "{{relay.name}}"</h2>
|
||||
<table>
|
||||
<thead><tr><th>Property</th><th>Value</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>Chip Number</td><td>{{ relay.pin.chip.number }}</td></tr>
|
||||
<tr><td>Chip Label</td><td>{{ relay.pin.chip.label }}</td></tr>
|
||||
<tr><td>Chip Name</td><td>{{ relay.pin.chip.name }}</td></tr>
|
||||
<tr><td>Pin Name</td><td>{{ relay.pin.name }}</td></tr>
|
||||
<tr><td>Pin Number</td><td>{{ relay.pin.line_number }}</td></tr>
|
||||
<tr><td>Relay State</td><td>{{ relay.state }}</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<form method="POST" action="/relay/{{relay.id}}/state">
|
||||
<input type="hidden" name="pin_id" value="{{ relay.pin.id }}">
|
||||
<input type="hidden" name="state" value="{{not relay.state}}">
|
||||
<button type="submit">{{ "Turn OFF" if relay.state else "Turn ON" }}</button>
|
||||
</form>
|
||||
<a href="/">Home</a>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue