192 lines
13 KiB
HTML
192 lines
13 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Juice</title>
|
|
<link rel="stylesheet" type="text/css" href="/static/juice.css">
|
|
<script>
|
|
const init_state = {{ init_state|tojson|safe }};
|
|
const ws_uri = "{{ url('ws') }}";
|
|
</script>
|
|
<script type="text/javascript" src="/static/juice.js"></script>
|
|
<script>window.onload = load;</script>
|
|
<meta name="viewport" content="width=device-width, initial-scale=0.8">
|
|
<meta name="description" content="An IOT hub.">
|
|
<meta name="theme-color" content="lightblue">
|
|
<link rel="manifest" href="/static/juice-manifest.webmanifest">
|
|
<link rel="icon" href="/static/orange-juice.svg">
|
|
<link rel="icon" href="/static/orange-juice-144p.png">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<div id="logo-line">
|
|
<object id="logo" aria-label="Juice: An IOT hub" data="/static/orange-juice.svg"></object>
|
|
<h1>Juice</h1>
|
|
<h3>An IOT hub</h3>
|
|
</div>
|
|
<nav>
|
|
<span class="font-awesome" title="Home"><a href="./"></a></span>
|
|
<span class="font-awesome" title="Add new device" onclick="new_device()"></span>
|
|
</nav>
|
|
</header>
|
|
<main>
|
|
<div id="devices">
|
|
{% for device in network %}
|
|
<div class="device {{ device.type }}" id="{{ device.id }}">
|
|
<div class="id editable"><span class="field_value">{{ device.id }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span><span class="delete font-awesome" onclick="delete_device(this.parentElement.parentElement)"></span><span class="lock font-awesome" onclick="lock_device(this.parentElement.parentElement)"></span>{% else %}<span class="unlock font-awesome" onclick="unlock_device(this.parentElement.parentElement)"></span>{% endif %}</div>
|
|
<div class="description editable"><span class="field_value">{{ device.description }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span>{% endif %}</div>
|
|
<div class="location editable"><span class="field_value">{{ device.location }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span>{% endif %}</div>
|
|
{% if device.type == 'RelayDevice' %}
|
|
<div class="ip_address editable"><span class="field_value">{{ device.ip_address }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span>{% endif %}</div>
|
|
{% elif device.type == 'LightStrip' %}
|
|
<div class="mqtt_root editable"><span class="field_value">{{ device.mqtt_root }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span>{% endif %}</div>
|
|
<div class="light_controls">
|
|
<div class="state">
|
|
<span>State</span><br>
|
|
<select class="state_select" onchange="state_select(this)">
|
|
<option{% if device.state == 'solid' %} selected{% endif %} value="solid">Solid</option>
|
|
<option{% if device.state == 'rainbow' %} selected{% endif %} value="rainbow">Rainbow</option>
|
|
<option{% if device.state == 'america' %} selected{% endif %} value="america">America</option>
|
|
</select>
|
|
<div class="state_solid" style="display: {% if device.state == 'solid' %}block{% else %}none{% endif %}">
|
|
<input type="radio" id="state_solid_all_{{ device.id }}" name="state_solid_{{ device.id }}" value="all" onchange="state_solid_amount(this)" checked>
|
|
<label for="state_solid_all_{{ device.id }}">All</label><br>
|
|
<input type="radio" id="state_solid_single_{{ device.id }}" name="state_solid_{{ device.id }}" value="single" onchange="state_solid_amount(this)">
|
|
<label for="state_solid_single_{{ device.id }}">Single</label><br>
|
|
<label for="state_solid_all_color_{{ device.id }}">All:</label>
|
|
<input type="color" id="state_solid_all_color_{{ device.id }}" value="{{ device.sub_devices[0].color|html_color }}" onchange="neopixel_state(this.closest('.device'))">
|
|
</div>
|
|
<div class="state_rainbow" style="display: {% if device.state == 'rainbow' %}block{% else %}none{% endif %}">
|
|
<table>
|
|
<tr>
|
|
<td>Red</td>
|
|
<td>
|
|
<input type="number" id="state_rainbow_red_freq_{{ device.id }}" min="0" max="1" step="0.1" value="{{ device.rainbow_params[0] }}" onchange="neopixel_state(this.closest('.device'))">
|
|
<label for="state_rainbow_red_freq_{{ device.id }}">f</label>
|
|
</td>
|
|
<td>
|
|
<input type="number" id="state_rainbow_red_phase_{{ device.id }}" min="0" max="10" step="1" value="{{ device.rainbow_params[3] }}" onchange="neopixel_state(this.closest('.device'))">
|
|
<label for="state_rainbow_red_phase_{{ device.id }}">Φ</label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Green</td>
|
|
<td>
|
|
<input type="number" id="state_rainbow_green_freq_{{ device.id }}" min="0" max="1" step="0.1" value="{{ device.rainbow_params[1] }}" onchange="neopixel_state(this.closest('.device'))">
|
|
<label for="state_rainbow_green_freq_{{ device.id }}">f</label>
|
|
</td>
|
|
<td>
|
|
<input type="number" id="state_rainbow_green_phase_{{ device.id }}" min="0" max="10" step="1" value="{{ device.rainbow_params[4] }}" onchange="neopixel_state(this.closest('.device'))">
|
|
<label for="state_rainbow_green_phase_{{ device.id }}">Φ</label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Blue</td>
|
|
<td>
|
|
<input type="number" id="state_rainbow_blue_freq_{{ device.id }}" min="0" max="1" step="0.1" value="{{ device.rainbow_params[2] }}" onchange="neopixel_state(this.closest('.device'))">
|
|
<label for="state_rainbow_blue_freq_{{ device.id }}">f</label>
|
|
</td>
|
|
<td>
|
|
<input type="number" id="state_rainbow_blue_phase_{{ device.id }}" min="0" max="10" step="1" value="{{ device.rainbow_params[5] }}" onchange="neopixel_state(this.closest('.device'))">
|
|
<label for="state_rainbow_blue_phase_{{ device.id }}">Φ</label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="state_rainbow_center_{{ device.id }}">Center</label></td>
|
|
<td><input type="number" id="state_rainbow_center_{{ device.id }}" min="0" max="255" step="1" value="{{ device.rainbow_params[6] }}" onchange="neopixel_state(this.closest('.device'))"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="state_rainbow_width_{{ device.id }}">Width</label></td>
|
|
<td><input type="number" id="state_rainbow_width_{{ device.id }}" min="0" max="128" step="1" value="{{ device.rainbow_params[7] }}" onchange="neopixel_state(this.closest('.device'))"></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="state_america" style="display: {% if device.state == 'america' %}block{% else %}none{% endif %}">
|
|
<table>
|
|
<tr>
|
|
<td><label for="state_america_stripe_{{ device.id }}">Stripe Length</label></td>
|
|
<td><input type="number" id="state_america_stripe_{{ device.id }}" min="1" max="256" step="1" value="{{ device.america_params[0] }}" onchange="neopixel_state(this.closest('.device'))"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="state_america_magnitude_{{ device.id }}">Magnitude</label></td>
|
|
<td><input type="number" id="state_america_magnitude_{{ device.id }}" min="0" max="255" step="1" value="{{ device.america_params[1] }}" onchange="neopixel_state(this.closest('.device'))"></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="animation">
|
|
<span>Animation</span><br>
|
|
<select class="animation_select" onchange="animation_select(this)">
|
|
<option{% if device.animation == 'static' %} selected{% endif %} value="static">Static</option>
|
|
<option{% if device.animation == 'rotate_left' %} selected{% endif %} value="rotate_left">Rotate Left</option>
|
|
<option{% if device.animation == 'rotate_right' %} selected{% endif %} value="rotate_right">Rotate Right</option>
|
|
</select>
|
|
<div class="animation_static" style="display: {% if device.animation == 'static' %}block{% else %}none{% endif %}">
|
|
</div>
|
|
<div class="animation_rotate" style="display: {% if device.animation == 'rotate_left' or device.animation == 'rotate_right' %}block{% else %}none{% endif %}">
|
|
<label for="animation_rotate_count_{{ device.id }}">Rotate Count</label>
|
|
<input type="number" id="animation_rotate_count_{{ device.id }}" min="1" max="255" step="1" value="{{ device.animation_rotate_count }}" onchange="neopixel_animation(this.closest('.device'))">
|
|
</div>
|
|
Delay
|
|
<input type="number" id="animation_delay_{{ device.id }}" min="1" max="255" step="1" value="{{ device.animation_delay }}" onchange="neopixel_animation(this)">
|
|
<label for="animation_delay{{ device.id }}">ms</label>
|
|
</div>
|
|
</div>
|
|
{% elif device.type == 'LixieClock' %}
|
|
<div class="mqtt_root editable"><span class="field_value">{{ device.mqtt_root }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span>{% endif %}</div>
|
|
<div class="lixie_controls">
|
|
<input type="radio" id="display_mode_time_{{ device.id }}" class="time" name="display_mode_{{ device.id }}" value="time" onchange="lixie_display_mode(this)"{% if device.display_mode == 'time' %} checked{% endif %}>
|
|
<label for="display_mode_time_{{ device.id }}">Time</label><br>
|
|
<input type="radio" id="display_mode_number_{{ device.id }}" class="number" name="display_mode_{{ device.id }}" value="number" onchange="lixie_display_mode(this)"{% if device.display_mode == 'number' %} checked{% endif %}>
|
|
<label for="display_mode_number_{{ device.id }}">Number</label><br>
|
|
<div class='lixie_number' style="display: {% if device.display_mode == 'number' %}block{% else %}none{% endif %}">
|
|
<label for="lixie_number_{{ device.id }}">Number:</label>
|
|
<input type="number" id="lixie_number_{{ device.id }}" class="number" min="0" max="9999" value="{{ device.display_number }}" onchange="lixie_clock(this)">
|
|
</div>
|
|
<label for="display_color_{{ device.id }}">Color:</label>
|
|
<input type="color" id="display_color_{{ device.id }}" class="color" value="{{ device.color|html_color }}" onchange="lixie_clock(this)">
|
|
</div>
|
|
{% endif %}
|
|
<div class="sub_devices">
|
|
{% for sub_device in device.sub_devices %}
|
|
<div class="sub_device {{ sub_device.type }} {{ sub_device.id }}">
|
|
{% if sub_device.type == 'RelayOutlet' %}
|
|
<div class="id">{{ sub_device.id }}</div>
|
|
<object class="outlet_image" aria-label="Outlet Image" data="/static/outlet.svg"></object>
|
|
<div class="description editable"><span class="field_value">{{ sub_device.description }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span>{% endif %}</div>
|
|
{% elif sub_device.type == 'NeoPixel' %}
|
|
<label class="NeoPixel_color" style="background-color: {{ sub_device.color|html_color }}">
|
|
<input class="NeoPixel_color_input" type="color" value="{{ sub_device.color|html_color }}" onchange="neopixel_state(this.closest('.sub_device'))" disabled>
|
|
</label>
|
|
{% elif sub_device.type == 'LixieDisplay' %}
|
|
LixieDisplay
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</main>
|
|
<template id="RelayDevice_template">
|
|
<div class="device RelayDevice" id="">
|
|
<div class="id editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span><span class="delete font-awesome" onclick="delete_device(this.parentElement.parentElement)"></span><span class="lock font-awesome" onclick="lock_device(this.parentElement.parentElement)"></span></div>
|
|
<div class="description editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
|
<div class="location editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
|
<div class="ip_address editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
|
<div class="sub_devices">
|
|
<div class="sub_device RelayOutlet OUT0">
|
|
<div class="id">OUT0</div>
|
|
<object class="outlet_image" alt="Outlet Image" data="/static/outlet.svg"></object>
|
|
<div class="description editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
|
</div>
|
|
<div class="sub_device RelayOutlet OUT2">
|
|
<div class="id">OUT2</div>
|
|
<object class="outlet_image" alt="Outlet Image" data="/static/outlet.svg"></object>
|
|
<div class="description editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</body>
|
|
</html>
|