light-control: update to current develop branch

This commit is contained in:
Ingolf Wagner 2020-06-03 01:03:15 +02:00
parent c98efed4f5
commit d150f47213
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 14 additions and 16 deletions

View file

@ -31,19 +31,13 @@
key = "contact"; key = "contact";
rooms = rooms; rooms = rooms;
invert_state = true; invert_state = true;
delay = { delay = 90;
secs = 90;
nanos = 0;
};
}; };
motion = { topic, rooms }: { motion = { topic, rooms }: {
topic = topic; topic = topic;
key = "occupancy"; key = "occupancy";
rooms = rooms; rooms = rooms;
delay = { delay = 60;
secs = 60;
nanos = 0;
};
}; };
in [ in [
(motion { (motion {
@ -84,10 +78,11 @@
}) })
]; ];
switches = let switches = let
sonoff = { id, rooms }: { sonoff = { id, rooms, delay ? 0 }: {
topic = "stat/${id}/RESULT"; topic = "stat/${id}/RESULT";
key = "POWER"; key = "POWER";
rooms = rooms; rooms = rooms;
delay = delay;
command = { command = {
command = "{{state}}"; command = "{{state}}";
init_command = "(null)"; init_command = "(null)";
@ -96,10 +91,11 @@
off = "OFF"; off = "OFF";
}; };
}; };
light = { topic, rooms }: { light = { topic, rooms, delay ? 0 }: {
topic = topic; topic = topic;
key = "state"; key = "state";
rooms = rooms; rooms = rooms;
delay = delay;
command = { command = {
command = ''{"state":"{{state}}","brightness":{{brightness}}}''; command = ''{"state":"{{state}}","brightness":{{brightness}}}'';
topic = "${topic}/set"; topic = "${topic}/set";
@ -119,6 +115,7 @@
(light { (light {
topic = "zigbee2mqtt/light_3"; topic = "zigbee2mqtt/light_3";
rooms = [ "living_room" ]; rooms = [ "living_room" ];
delay = 10;
}) })
(light { (light {
topic = "zigbee2mqtt/light_4"; topic = "zigbee2mqtt/light_4";
@ -127,6 +124,7 @@
(light { (light {
topic = "zigbee2mqtt/light_8"; topic = "zigbee2mqtt/light_8";
rooms = [ "bed_room" ]; rooms = [ "bed_room" ];
delay = 10;
}) })
(sonoff { (sonoff {
id = "PAL01"; id = "PAL01";

View file

@ -39,9 +39,9 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services."light-control" = { systemd.services."light-control" = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
environment = { RUST_LOG = "rust_iot=trace"; }; environment = { RUST_LOG = "light_control=trace"; };
script = '' script = ''
${pkgs.light-control}/bin/rust-iot ${lightControlConfig} ${pkgs.light-control}/bin/light-control ${lightControlConfig}
''; '';
}; };
}; };

View file

@ -5,8 +5,8 @@ rustPlatform.buildRustPackage rec {
version = "0.1.0"; version = "0.1.0";
src = fetchgit { src = fetchgit {
url = "https://git.ingolf-wagner.de/palo/light-control.git"; url = "https://git.ingolf-wagner.de/palo/light-control.git";
rev = "180200b6085291834079322fc63c5220cac28e43"; rev = "af6f9f78180af24f329736f04bda07cf90ab98c9";
sha256 = "0dwf6dvpgrkpgaba4ayb0z6qjk8wjmp38y5viiq7hbjg5wcbr9qf"; sha256 = "0yc5chl3pfx91rr59ngjfj0dahipjc0jkclxs2w0fg1j5aknxinc";
}; };
cargoSha256 = "1yzkbj36sx4vc8dsgcxahrvn33ci2ad1cpd1shcismw33k63rimh"; cargoSha256 = "1yzkbj36sx4vc8dsgcxahrvn33ci2ad1cpd1shcismw33k63rimh";
@ -15,8 +15,8 @@ rustPlatform.buildRustPackage rec {
buildInputs = [ mosquitto openssl cmake ]; buildInputs = [ mosquitto openssl cmake ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "write me"; description = "light control over mqtt, with scenes and room tracking";
homepage = "https://foo"; homepage = "https://github.com/mrVanDalo/light-control";
license = licenses.gpl3; license = licenses.gpl3;
maintainers = [ maintainers.mrVanDalo ]; maintainers = [ maintainers.mrVanDalo ];
platforms = platforms.all; platforms = platforms.all;