Implemented Lighting Control

This commit is contained in:
2026-04-14 15:27:11 -05:00
parent a18f70f0b8
commit 4dddf30c4c
5 changed files with 300 additions and 7 deletions

View File

@@ -11,7 +11,7 @@
<body>
<header>
<a href="/">
<svg version=" 1.1" width="196" height="46" xmlns="http://www.w3.org/2000/svg">
<svg version="1.1" width="196" height="46" xmlns="http://www.w3.org/2000/svg">
<polyline points="23,46 173,46 196,23 173,0 23,0 0,23" fill="#FFFFFF" class="icon-bg" />
<polyline points="23,44 33,34 23,24 13,34" fill="var(--color-max)" style="--hue: var(--des);" />
<polyline points="34,33 44,23 34,13 24,23" fill="var(--color-max)" style="--hue: var(--bea);" />

50
templates/lighting.html Normal file
View File

@@ -0,0 +1,50 @@
{% extends "base.html" %}
{% block head %}
<link rel="stylesheet" href="{{ url_for('static', filename='lighting.css') }}">
<script src="{{ url_for('static', filename='lighting.js') }}" defer></script>
{% endblock %}
{% block content %}
<main>
{% for group in ldata %}
{% if ldata[group]["lights"] %}
<div class="group">
<h2>{{ ldata[group]["name"] }}</h2>
<div>
{% for light in ldata[group]["lights"] %}
<form method="post" class="light">
{% set ldata = ldata[group]["lights"][light] %}
<h3>{{ ldata["name"] }}</h3>
<div class="view">
<div class="view-symb">
<svg version="1.1" width="100" height="100" xmlns="http://www.w3.org/2000/svg" class="symb-btn">
<polyline points="50,0 100,50 50,100 0,50" fill="#666666" />
<polyline points="50,5 95,50 50,95 5,50" fill="{{ ldata['display'] }}" />
</svg>
</div>
<input type="range" orient="vertical" class="brightness" name="brightness" min="0" max="254"
step="1" value="{{ ldata['state']['bri'] if ldata['state']['on'] else 0 }}">
</div>
{% if "ct" in ldata["state"] %}
<div class="colormode">
<output>{{ ldata["state"]["colormode"].upper() }}</output>
<input class="ctsel" type="number" min="100" max="600" step="1" name="ct"
value="{{ ldata['state']['ct'] }}">
{% if "hue" in ldata["state"] %}
<input class="hssel" type="color" name="hs" value="{{ ldata['display'] }}">
{% endif %}
<input type="hidden" name="mode" value="{{ ldata['state']['colormode'] }}">
</div>
{% endif %}
<input type="hidden" class="action" name="action" value="none">
<input type="hidden" name="light" value="{{ light }}">
</form>
{% endfor %}
</div>
</div>
{% endif %}
{% endfor %}
</main>
{% endblock %}