ma bureautomation: remove faulty motion detector

This commit is contained in:
makefu 2019-04-04 09:50:16 +02:00
parent 61606d0673
commit c4640031dd
9 changed files with 144 additions and 36 deletions

View file

@ -2,8 +2,9 @@
{ alias = "start Felix 10h";
trigger = {
platform = "state";
entity_id = "binary_sensor.redbutton";
to = "on";
entity_id = [ "device_tracker.felix_phone" "device_tracker.felix_laptop" ];
from = "not_home";
to = "home";
};
condition = {
condition = "and";

View file

@ -1,9 +1,10 @@
[
{ alias = "Turn on Fernseher on movement";
{ alias = "Turn on Fernseher on group home";
trigger = {
platform = "state";
entity_id = "binary_sensor.motion";
to = "on";
condition = "state";
entity_id = "group.team";
from = "not_home";
to = "home";
};
action = {
service = "homeassistant.turn_on";
@ -13,15 +14,15 @@
];
};
}
{ alias = "Turn off Fernseher 10 minutes after last movement";
{ alias = "Turn off Fernseher after last in group left";
trigger = [
{ # trigger when movement was detected at the time
platform = "state";
entity_id = "binary_sensor.motion";
to = "off";
for.minutes = 10;
condition = "state";
entity_id = "group.team";
from = "home";
to = "not_home";
}
{ # trigger at 20:00 no matter what
{ # trigger at 18:00 no matter what
# to avoid 'everybody left before 18:00:00'
platform = "time";
at = "18:00:00";
@ -44,10 +45,10 @@
after = "18:00:00";
# weekday = [ "mon" "tue" "wed" "thu" "fri" ];
}
{
{ # if anybody is still there
condition = "state";
entity_id = "binary_sensor.motion";
state = "off";
entity_id = "group.team";
state = "not_home";
}
];
};

View file

@ -9,7 +9,7 @@
action =
{
service = "homeassistant.turn_off";
entity_id = [ "switch.nachtlicht" ];
entity_id = [ "group.nachtlicht" ];
};
}
@ -37,7 +37,7 @@
action =
{
service = "homeassistant.turn_on";
entity_id = [ "switch.nachtlicht" ];
entity_id = [ "group.nachtlicht" ];
};
}
]

View file

@ -0,0 +1,14 @@
[
{ platform = "luci";
name = "router";
host = "192.168.8.1";
username = "root";
password = import <secrets/hass/router.nix>;
interval_seconds = 30; # instead of 12seconds
consider_home = 300; # 5 minutes timeout
new_device_defaults = {
track_new_devices = true;
hide_if_away = false;
};
}
]

View file

@ -0,0 +1,17 @@
{
thorsten-phone = {
name = "Thorsten";
mac = "8c:f5:a3:bc:83:a0";
track = true;
hide_if_away = true;
};
felix-laptop = {
name = "Felix";
mac = "6c:88:14:b4:43:9c";
track = true;
hide_if_away = true;
};
# b0:e5:ed:52:ee:43 - honor8
# 38:94:96:b0:13:c7 - android-4ef03e4f4a14b6b9
# ac:5f:3e:cc:b8:5e - Galaxy S7
}

View file

@ -1,8 +1,9 @@
{ pkgs, lib, ... }:
let
kodi-host = "192.168.8.11";
in {
networking.firewall.allowedTCPPorts = [ 8123 ];
state = [ "/var/lib/hass/known_devices.yaml" ];
services.home-assistant = {
enable = true;
config = {
@ -33,7 +34,8 @@ in {
retain = true;
};
};
switch = (import ./switch/tasmota_switch.nix);
switch = (import ./switch/tasmota_switch.nix) ++
(import ./switch/rfbridge.nix);
light = (import ./light/statuslight.nix) ++
(import ./light/buzzer.nix);
timer = {
@ -54,7 +56,12 @@ in {
{
platform = "kodi";
name = "wbob";
host = "192.168.8.11";
host = kodi-host;
}
];
media_player = [
{ platform = "kodi";
host = kodi-host;
}
];
script = (import ./script/multi_blink.nix) {inherit lib;};
@ -70,6 +77,10 @@ in {
camera =
(import ./camera/verkehrskamera.nix);
# not yet released
#person =
# (import ./person/team.nix );
frontend = { };
http = { };
conversation = {};
@ -82,36 +93,55 @@ in {
{ view = "yes";
entities = [
"group.sensors"
"group.camera"
"group.outside"
"group.switches"
"group.automation"
# "group.camera"
"group.team"
"group.nachtlicht"
# "group.switches"
];
};
automation = [
"timer.felix_10h"
"script.blitz_10s"
"script.buzz_red_led_fast"
"camera.Baumarkt"
];
switches = [
"switch.bauarbeiterlampe"
"switch.blitzdings"
"switch.fernseher"
"switch.feuer"
"switch.nachtlicht"
"light.status_felix"
"light.status_daniel"
"light.buslicht"
"light.redbutton_buzzer"
];
camera = [ ];
team = [
"device_tracker.thorsten_phone"
"device_tracker.felix_phone"
"device_tracker.ecki_tablet"
"device_tracker.daniel_phone"
"device_tracker.carsten_phone"
# "person.thorsten"
# "person.felix"
# "person.ecki"
# "person.daniel"
];
camera = [
"camera.Baumarkt"
"camera.Autobahn_Heilbronn"
"camera.Autobahn_Singen"
];
nachtlicht = [
"switch.nachtlicht_a"
"switch.nachtlicht_b"
"switch.nachtlicht_c"
"switch.nachtlicht_d"
];
sensors = [
"binary_sensor.motion"
"binary_sensor.redbutton"
"media_player.kodi"
"script.blitz_10s"
"script.buzz_red_led_fast"
"timer.felix_10h"
"sensor.easy2_dht22_humidity"
"sensor.easy2_dht22_temperature"
# "binary_sensor.redbutton"
];
outside = [
# "sensor.ditzingen_pm10"
@ -120,8 +150,7 @@ in {
"sensor.dark_sky_humidity"
# "sensor.dark_sky_pressure"
"sensor.dark_sky_hourly_summary"
"camera.Autobahn_Heilbronn"
"camera.Autobahn_Singen"
"device_tracker.router"
];
};
# only for automation
@ -131,7 +160,7 @@ in {
automation = (import ./automation/bureau-shutdown.nix) ++
(import ./automation/nachtlicht.nix) ++
(import ./automation/10h_timer.nix);
device_tracker = (import ./device_tracker/openwrt.nix );
};
};
}

View file

@ -0,0 +1,29 @@
[
{ name = "Thorsten";
id = 1;
device_trackers = [
"device_tracker.thorsten_phone"
"device_tracker.thorsten_arbeitphone"
];
}
{ name = "Felix";
id = 2;
device_trackers = [
"device_tracker.felix_phone"
"device_tracker.felix_laptop"
];
}
{ name = "Ecki";
id = 3;
device_trackers = [
"device_tracker.ecki_phone"
"device_tracker.ecki_tablet"
];
}
{ name = "Daniel";
id = 4;
device_trackers = [
"device_tracker.daniel_phone"
];
}
]

View file

@ -0,0 +1,17 @@
let
topic = "rfbridge";
bridge = name: payload_on: payload_off:
{ platform = "mqtt";
inherit name payload_on payload_off;
command_topic = "/bam/${topic}/cmnd/rfcode";
availability_topic = "/bam/${topic}/tele/LWT";
payload_available= "Online";
payload_not_available= "Offline";
};
in
[
(bridge "Nachtlicht A" "#414551" "#414554")
(bridge "Nachtlicht B" "#415151" "#415154")
(bridge "Nachtlicht C" "#415451" "#415454")
(bridge "Nachtlicht D" "#41551F" "#415514")
]

View file

@ -15,5 +15,5 @@ in [
(tasmota_plug "Blitzdings" "plug2")
(tasmota_plug "Fernseher" "plug3")
(tasmota_plug "Feuer" "plug4")
(tasmota_plug "Nachtlicht" "plug5")
(tasmota_plug "Blaulicht" "plug5")
]