Add release.nix
parent
6e762316c8
commit
f75eee6b8a
96
app.py
96
app.py
|
@ -37,8 +37,11 @@ def button_widget(topic, label, pub_value):
|
|||
template = '''
|
||||
<input type="button" class="button is-large is-info is-outlined" value="{{label}}" onclick="publish('{{topic}}', '{{pub_value}}');"/>
|
||||
'''
|
||||
return make_widget(
|
||||
template, 'button', label=label, pub_value=pub_value, topic=topic)
|
||||
return make_widget(template,
|
||||
'button',
|
||||
label=label,
|
||||
pub_value=pub_value,
|
||||
topic=topic)
|
||||
|
||||
|
||||
def slider_widget(label,
|
||||
|
@ -61,17 +64,16 @@ def slider_widget(label,
|
|||
</div>
|
||||
<div>{{label}}</div>
|
||||
'''
|
||||
return make_widget(
|
||||
template,
|
||||
'slider',
|
||||
sub_topic=sub_topic,
|
||||
label=label,
|
||||
min_val=min_val,
|
||||
max_val=max_val,
|
||||
value_path=value_path,
|
||||
topic=topic,
|
||||
unit=unit,
|
||||
id_=id_)
|
||||
return make_widget(template,
|
||||
'slider',
|
||||
sub_topic=sub_topic,
|
||||
label=label,
|
||||
min_val=min_val,
|
||||
max_val=max_val,
|
||||
value_path=value_path,
|
||||
topic=topic,
|
||||
unit=unit,
|
||||
id_=id_)
|
||||
|
||||
|
||||
def label_widget(topic, label, unit=''):
|
||||
|
@ -82,13 +84,12 @@ def label_widget(topic, label, unit=''):
|
|||
</div>
|
||||
<div>{{label}}</div>
|
||||
'''
|
||||
return make_widget(
|
||||
template,
|
||||
'label',
|
||||
sub_topic=topic,
|
||||
topic=topic,
|
||||
unit=unit,
|
||||
label=label)
|
||||
return make_widget(template,
|
||||
'label',
|
||||
sub_topic=topic,
|
||||
topic=topic,
|
||||
unit=unit,
|
||||
label=label)
|
||||
|
||||
|
||||
def log_widget(topic, label):
|
||||
|
@ -106,8 +107,12 @@ def log_widget(topic, label):
|
|||
</div>
|
||||
<div>{{label}}<button id="{{id_}}" class="delete log-delete"></button></div>
|
||||
'''
|
||||
return make_widget(
|
||||
template, "log", sub_topic=topic, topic=topic, label=label, id_=id_)
|
||||
return make_widget(template,
|
||||
"log",
|
||||
sub_topic=topic,
|
||||
topic=topic,
|
||||
label=label,
|
||||
id_=id_)
|
||||
|
||||
|
||||
def row_layout(title, *elems):
|
||||
|
@ -157,27 +162,24 @@ def home():
|
|||
widgets=[
|
||||
column_layout(
|
||||
"Light",
|
||||
slider_widget(
|
||||
"Küche",
|
||||
"hue/set/lights/Ku",
|
||||
"hue/status/lights/Ku",
|
||||
value_path='val'),
|
||||
slider_widget(
|
||||
"WZ1",
|
||||
"hue/set/lights/WZ1",
|
||||
"hue/status/lights/WZ1",
|
||||
value_path='val'),
|
||||
slider_widget(
|
||||
"WZ2",
|
||||
"hue/set/lights/WZ2",
|
||||
"hue/status/lights/WZ2",
|
||||
value_path='val'),
|
||||
slider_widget(
|
||||
"Vorzimmer",
|
||||
"hue/set/lights/Vorzimmer",
|
||||
"hue/status/lights/Vorzimmer",
|
||||
value_path='val'),
|
||||
slider_widget("Küche",
|
||||
"hue/set/lights/Ku",
|
||||
"hue/status/lights/Ku",
|
||||
value_path='val'),
|
||||
slider_widget("WZ1",
|
||||
"hue/set/lights/WZ1",
|
||||
"hue/status/lights/WZ1",
|
||||
value_path='val'),
|
||||
slider_widget("WZ2",
|
||||
"hue/set/lights/WZ2",
|
||||
"hue/status/lights/WZ2",
|
||||
value_path='val'),
|
||||
slider_widget("Vorzimmer",
|
||||
"hue/set/lights/Vorzimmer",
|
||||
"hue/status/lights/Vorzimmer",
|
||||
value_path='val'),
|
||||
slider_widget("Schlafzimmer",
|
||||
"home/devices/192.168.1.214/override",
|
||||
"home/devices/192.168.1.214/brightness")),
|
||||
row_layout(
|
||||
"Temperature",
|
||||
|
@ -187,8 +189,14 @@ def home():
|
|||
"°C"),
|
||||
label_widget("home/sensors/bedroom/temperature", "Bedroom",
|
||||
"°C")),
|
||||
row_layout("Device logs", log_widget("test", "test log"),
|
||||
log_widget("test2", "test log 2")),
|
||||
row_layout(
|
||||
"Device logs", log_widget("test", "test log"), *[
|
||||
log_widget(f"home/devices/{ip}/log", name)
|
||||
for ip, name in [("192.168.1.214", "Bedroom lamp"),
|
||||
("192.168.1.213", "Sensor office"),
|
||||
("192.168.1.212", "Sensor livingroom"),
|
||||
("192.168.1.211", "Sensor bedroom")]
|
||||
]),
|
||||
row_layout("Some buttons", button_widget("test", "set to 1", 1),
|
||||
button_widget("test", "set to foo", 'foo'))
|
||||
])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
with import <nixpkgs> {}; with python3Packages;
|
||||
|
||||
{ python }:
|
||||
with python.pkgs;
|
||||
buildPythonPackage rec {
|
||||
name = "mqtt-dash";
|
||||
src = ./.;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
mqtt-dash =
|
||||
{ system ? builtins.currentSystem }:
|
||||
|
||||
let
|
||||
pkgs = import <nixpkgs> { inherit system; };
|
||||
in
|
||||
pkgs.callPackage ./. { python = pkgs.python3; };
|
||||
}
|
Loading…
Reference in New Issue