From b561c71bf2b925acbb73966b089b170f4cff928c Mon Sep 17 00:00:00 2001 From: 0xee Date: Thu, 31 Oct 2019 16:29:31 +0100 Subject: [PATCH] Add release.nix --- app.py | 96 +++++++++++++++++++++++++++++------------------------ default.nix | 4 +-- release.nix | 12 +++++++ 3 files changed, 66 insertions(+), 46 deletions(-) create mode 100644 release.nix diff --git a/app.py b/app.py index dc794a4..134c0dd 100755 --- a/app.py +++ b/app.py @@ -37,8 +37,11 @@ def button_widget(topic, label, pub_value): template = ''' ''' - 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,
{{label}}
''' - 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=''):
{{label}}
''' - 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):
{{label}}
''' - 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')) ]) diff --git a/default.nix b/default.nix index d118540..eb0ab96 100644 --- a/default.nix +++ b/default.nix @@ -1,5 +1,5 @@ -with import {}; with python3Packages; - +{ pkgs ? (import {}) }: +with pkgs.python3Packages; buildPythonPackage rec { name = "mqtt-dash"; src = ./.; diff --git a/release.nix b/release.nix new file mode 100644 index 0000000..013c990 --- /dev/null +++ b/release.nix @@ -0,0 +1,12 @@ +{ + mqtt-dash = + { system ? builtins.currentSystem }: + + let + pkgs = import { inherit system; }; + in + pkgs.releaseTools.nixBuild { + name = "mqtt-dash"; + src = ; + }; +}