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

View file

@ -39,9 +39,9 @@ in {
config = mkIf cfg.enable {
systemd.services."light-control" = {
wantedBy = [ "multi-user.target" ];
environment = { RUST_LOG = "rust_iot=trace"; };
environment = { RUST_LOG = "light_control=trace"; };
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";
src = fetchgit {
url = "https://git.ingolf-wagner.de/palo/light-control.git";
rev = "180200b6085291834079322fc63c5220cac28e43";
sha256 = "0dwf6dvpgrkpgaba4ayb0z6qjk8wjmp38y5viiq7hbjg5wcbr9qf";
rev = "af6f9f78180af24f329736f04bda07cf90ab98c9";
sha256 = "0yc5chl3pfx91rr59ngjfj0dahipjc0jkclxs2w0fg1j5aknxinc";
};
cargoSha256 = "1yzkbj36sx4vc8dsgcxahrvn33ci2ad1cpd1shcismw33k63rimh";
@ -15,8 +15,8 @@ rustPlatform.buildRustPackage rec {
buildInputs = [ mosquitto openssl cmake ];
meta = with stdenv.lib; {
description = "write me";
homepage = "https://foo";
description = "light control over mqtt, with scenes and room tracking";
homepage = "https://github.com/mrVanDalo/light-control";
license = licenses.gpl3;
maintainers = [ maintainers.mrVanDalo ];
platforms = platforms.all;