home assistant and matrix changes

This commit is contained in:
2024-11-11 00:28:41 +01:00
parent 21d2e34025
commit 96d26c5431
15 changed files with 241 additions and 123 deletions

View File

@@ -8,14 +8,27 @@ esphome:
platform: ESP8266 platform: ESP8266
board: esp01_1m board: esp01_1m
on_boot: on_boot:
priority: 300
then: then:
- light.turn_on: my_light - light.turn_on:
id: my_light
# Enable logging red: 0.2
logger: green: 0.1
blue: 0
web_server: white: 0.2
port: 80 color_brightness: 0.2
brightness: 0.2
interval:
- interval: 15s
then:
- if:
condition:
api.connected: # check if api connected
else:
- light.dim_relative:
id: my_light
relative_brightness: 1
# Enable Home Assistant API # Enable Home Assistant API
api: api:
@@ -29,8 +42,6 @@ wifi:
fast_connect: True fast_connect: True
domain: .cloonar.smart domain: .cloonar.smart
captive_portal:
light: light:
- platform: rgbw - platform: rgbw
id: my_light id: my_light
@@ -39,10 +50,6 @@ light:
green: pwm_g green: pwm_g
blue: pwm_b blue: pwm_b
white: pwm_w white: pwm_w
effects:
- random:
- strobe:
- flicker:
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm

View File

@@ -8,14 +8,27 @@ esphome:
platform: ESP8266 platform: ESP8266
board: esp01_1m board: esp01_1m
on_boot: on_boot:
priority: 300
then: then:
- light.turn_on: my_light - light.turn_on:
id: my_light
# Enable logging red: 0.2
logger: green: 0.1
blue: 0
web_server: white: 0.2
port: 80 color_brightness: 0.2
brightness: 0.2
interval:
- interval: 15s
then:
- if:
condition:
api.connected: # check if api connected
else:
- light.dim_relative:
id: my_light
relative_brightness: 1
# Enable Home Assistant API # Enable Home Assistant API
api: api:
@@ -29,8 +42,6 @@ wifi:
fast_connect: True fast_connect: True
domain: .cloonar.smart domain: .cloonar.smart
captive_portal:
light: light:
- platform: rgbw - platform: rgbw
id: my_light id: my_light
@@ -39,10 +50,6 @@ light:
green: pwm_g green: pwm_g
blue: pwm_b blue: pwm_b
white: pwm_w white: pwm_w
effects:
- random:
- strobe:
- flicker:
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm

View File

@@ -9,14 +9,26 @@ esphome:
board: esp01_1m board: esp01_1m
on_boot: on_boot:
then: then:
- light.turn_on: my_light - light.turn_on:
id: my_light
# Enable logging red: 0.2
logger: green: 0.1
blue: 0
web_server: white: 0.2
port: 80 color_brightness: 0.2
brightness: 0.2
interval:
- interval: 15s
then:
- if:
condition:
api.connected: # check if api connected
else:
- light.dim_relative:
id: my_light
relative_brightness: 1
# Enable Home Assistant API # Enable Home Assistant API
api: api:
@@ -29,8 +41,6 @@ wifi:
fast_connect: True fast_connect: True
domain: .cloonar.smart domain: .cloonar.smart
captive_portal:
light: light:
- platform: rgbw - platform: rgbw
id: my_light id: my_light
@@ -39,10 +49,6 @@ light:
green: pwm_g green: pwm_g
blue: pwm_b blue: pwm_b
white: pwm_w white: pwm_w
effects:
- random:
- strobe:
- flicker:
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm

View File

@@ -9,13 +9,25 @@ esphome:
board: esp01_1m board: esp01_1m
on_boot: on_boot:
then: then:
- light.turn_on: my_light - light.turn_on:
id: my_light
# Enable logging red: 0.2
logger: green: 0.1
blue: 0
web_server: white: 0.2
port: 80 color_brightness: 0.2
brightness: 0.2
interval:
- interval: 15s
then:
- if:
condition:
api.connected: # check if api connected
else:
- light.dim_relative:
id: my_light
relative_brightness: 1
# Enable Home Assistant API # Enable Home Assistant API
api: api:
@@ -29,8 +41,6 @@ wifi:
fast_connect: True fast_connect: True
domain: .cloonar.smart domain: .cloonar.smart
captive_portal:
light: light:
- platform: rgbw - platform: rgbw
id: my_light id: my_light
@@ -39,10 +49,6 @@ light:
green: pwm_g green: pwm_g
blue: pwm_b blue: pwm_b
white: pwm_w white: pwm_w
effects:
- random:
- strobe:
- flicker:
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm

View File

@@ -9,13 +9,25 @@ esphome:
board: esp01_1m board: esp01_1m
on_boot: on_boot:
then: then:
- light.turn_on: my_light - light.turn_on:
id: my_light
# Enable logging red: 0.2
logger: green: 0.1
blue: 0
web_server: white: 0.2
port: 80 color_brightness: 0.2
brightness: 0.2
interval:
- interval: 15s
then:
- if:
condition:
api.connected: # check if api connected
else:
- light.dim_relative:
id: my_light
relative_brightness: 1
# Enable Home Assistant API # Enable Home Assistant API
api: api:
@@ -29,8 +41,6 @@ wifi:
fast_connect: True fast_connect: True
domain: .cloonar.smart domain: .cloonar.smart
captive_portal:
light: light:
- platform: rgbw - platform: rgbw
id: my_light id: my_light
@@ -39,10 +49,6 @@ light:
green: pwm_g green: pwm_g
blue: pwm_b blue: pwm_b
white: pwm_w white: pwm_w
effects:
- random:
- strobe:
- flicker:
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm

View File

@@ -9,13 +9,25 @@ esphome:
board: esp01_1m board: esp01_1m
on_boot: on_boot:
then: then:
- light.turn_on: my_light - light.turn_on:
id: my_light
# Enable logging red: 0.2
logger: green: 0.1
blue: 0
web_server: white: 0.2
port: 80 color_brightness: 0.2
brightness: 0.2
interval:
- interval: 15s
then:
- if:
condition:
api.connected: # check if api connected
else:
- light.dim_relative:
id: my_light
relative_brightness: 1
# Enable Home Assistant API # Enable Home Assistant API
api: api:
@@ -29,8 +41,6 @@ wifi:
fast_connect: True fast_connect: True
domain: .cloonar.smart domain: .cloonar.smart
captive_portal:
light: light:
- platform: rgbw - platform: rgbw
id: my_light id: my_light
@@ -39,10 +49,6 @@ light:
green: pwm_g green: pwm_g
blue: pwm_b blue: pwm_b
white: pwm_w white: pwm_w
effects:
- random:
- strobe:
- flicker:
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm

49
esphome/toilet-bulb.yaml Normal file
View File

@@ -0,0 +1,49 @@
substitutions:
device_name: "toilet-bulb"
friendly_name: "Toilet Bulb"
esphome:
name: ${device_name}
comment: ${friendly_name}
platform: ESP8266
board: esp01_1m
on_boot:
then:
- light.turn_on: my_light
# Enable logging
logger:
web_server:
port: 80
# Enable Home Assistant API
api:
ota:
platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: True
domain: .cloonar.smart
captive_portal:
output:
- platform: esp8266_pwm
id: warm_white
pin: GPIO4
- platform: esp8266_pwm
id: brightness
pin: GPIO5
light:
- platform: cwww
id: my_light
name: ${friendly_name}
warm_white: warm_white
cold_white: brightness
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K

View File

@@ -40,6 +40,7 @@ in
localAddress = "10.42.113.20/24"; localAddress = "10.42.113.20/24";
extraFlags = [ extraFlags = [
"--capability=CAP_NET_ADMIN" "--capability=CAP_NET_ADMIN"
"--capability=CAP_MKNOD"
]; ];
# allowedDevices = [ # allowedDevices = [
# { # {
@@ -50,12 +51,16 @@ in
# modifier = "rwm"; # modifier = "rwm";
# node = "char-ttyUSB"; # node = "char-ttyUSB";
# } # }
# {
# modifier = "rwm";
# node = "/dev/ttyUSB0";
# }
# ]; # ];
bindMounts = { bindMounts = {
# "/dev/ttyUSB0" = { "/dev/ttyUSB0" = {
# hostPath = "/dev/ttyUSB0"; hostPath = "/dev/ttyUSB0";
# isReadOnly = false; isReadOnly = false;
# }; };
"/etc/localtime" = { "/etc/localtime" = {
hostPath = "/etc/localtime"; hostPath = "/etc/localtime";
}; };
@@ -113,6 +118,11 @@ in
pkgs.mariadb pkgs.mariadb
]; ];
# Allow access to the USB device
services.udev.extraRules = ''
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666"
'';
services.nginx.enable = true; services.nginx.enable = true;
services.nginx.virtualHosts."${domain}" = { services.nginx.virtualHosts."${domain}" = {
sslCertificate = "/var/lib/acme/hass/fullchain.pem"; sslCertificate = "/var/lib/acme/hass/fullchain.pem";
@@ -247,7 +257,7 @@ in
]; ];
}; };
users.users.hass.extraGroups = [ "dialout" ]; users.users.hass.extraGroups = [ "dialout" "tty" ];
system.stateVersion = "23.05"; system.stateVersion = "23.05";
}; };
}; };

View File

@@ -58,7 +58,7 @@
"light.livingroom_lights" "light.livingroom_lights"
"light.hallway_lights" "light.hallway_lights"
"light.bathroom_lights" "light.bathroom_lights"
"light.toilett_lights" "light.toilet_lights"
"light.storage_lights" "light.storage_lights"
]; ];
to = "on"; to = "on";
@@ -67,7 +67,7 @@
{ {
choose = [ choose = [
{ {
conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.toilett_lights' }}" ]; conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.toilet_lights' }}" ];
sequence = [ sequence = [
{ {
delay = 10; delay = 10;
@@ -78,7 +78,7 @@
entity_id = "{{ trigger.entity_id }}"; entity_id = "{{ trigger.entity_id }}";
}; };
data = { data = {
brightness_pct = 10; brightness_pct = 20;
color_temp = 450; color_temp = 450;
}; };
} }
@@ -398,6 +398,20 @@
"light.bedroom_bulb_4" "light.bedroom_bulb_4"
]; ];
} }
{
platform = "switch";
name = "Toilet Switch";
entity_id = "switch.toilet";
}
{
platform = "group";
name = "Toilet Lights";
all = true;
entities = [
"light.toilet"
"light.toilet_bulb"
];
}
]; ];
}; };
} }

View File

@@ -248,12 +248,6 @@
reservations = [ reservations = [
# need fixed ips for all shelly devices # need fixed ips for all shelly devices
# living room 1 - 14 # living room 1 - 14
# 10.42.100.2 # bulb1
# 10.42.100.3 # bulb2
# 10.42.100.4 # bulb3
# 10.42.100.5 # bulb4
# 10.42.100.6 # bulb5
# 10.42.100.7 # bulb6
# 10.42.100.8 # piano # 10.42.100.8 # piano
# 10.42.100.9 # switch # 10.42.100.9 # switch
# 10.42.100.10 # steamdeck # 10.42.100.10 # steamdeck
@@ -268,23 +262,21 @@
# 10.42.100.37 # readingled2 # 10.42.100.37 # readingled2
# 10.42.100.38 # bedled # 10.42.100.38 # bedled
# bath: # bath:
# 10.42.100.49 # switch
# 10.42.100.50 # bulb1
# 10.42.100.51 # bulb2
# 10.42.100.52 # smallswitch # 10.42.100.52 # smallswitch
# 10.42.100.53 # ht # 10.42.100.53 # ht
# hallway: # hallway:
# 10.42.100.65 # switch # 10.42.100.65 # switch
# 10.42.100.66 # bulb1
# 10.42.100.67 # bulb2
# 10.42.100.68 # bulb3
# 10.42.100.69 # bulb4
# toilet: # toilet:
# 10.42.100.81 # switch # 10.42.100.81 # switch
# 10.42.100.82 # bulb # 10.42.100.82 # bulb
# storage: # storage:
# 10.42.100.97 # switch # 10.42.100.97 # switch
{
hw-address = "fc:ee:28:03:63:e9";
ip-address = "10.42.100.148";
server-hostname = "k1c";
}
{ {
hw-address = "60:a4:23:97:4a:ec"; hw-address = "60:a4:23:97:4a:ec";
ip-address = "10.42.100.21"; ip-address = "10.42.100.21";

View File

@@ -39,22 +39,23 @@ in
localAddress = "10.42.97.20/24"; localAddress = "10.42.97.20/24";
extraFlags = [ extraFlags = [
"--capability=CAP_NET_ADMIN" "--capability=CAP_NET_ADMIN"
"--capability=CAP_MKNOD"
];
allowedDevices = [
{
modifier = "rwm";
node = "char-usb_device";
}
{
modifier = "rwm";
node = "char-ttyUSB";
}
]; ];
# allowedDevices = [
# {
# modifier = "rwm";
# node = "char-usb_device";
# }
# {
# modifier = "rwm";
# node = "char-ttyUSB";
# }
# ];
bindMounts = { bindMounts = {
# "/dev/ttyUSB0" = { "/dev/ttyUSB0" = {
# hostPath = "/dev/ttyUSB0"; hostPath = "/dev/ttyUSB0";
# isReadOnly = false; isReadOnly = false;
# }; };
"/etc/localtime" = { "/etc/localtime" = {
hostPath = "/etc/localtime"; hostPath = "/etc/localtime";
}; };

View File

@@ -18,7 +18,7 @@ in {
friendly_name = "Current Price of electricity"; friendly_name = "Current Price of electricity";
unit_of_measurement = "EUR/kWh"; unit_of_measurement = "EUR/kWh";
value_template = '' value_template = ''
{{ (((states('sensor.epex_spot_data_price') | int ) / 1000) + (0.0149 + 0.0053 + 0.00866)) | float }} {{ (((states('sensor.epex_spot_data_price') | int ) / 1000) + (0.0149 + 0.053 + 0.00866)) | float }}
''; '';
}; };
}; };

View File

@@ -75,7 +75,7 @@
entity_id = "{{ trigger.entity_id }}"; entity_id = "{{ trigger.entity_id }}";
}; };
data = { data = {
brightness_pct = 10; brightness_pct = 20;
color_temp = 450; color_temp = 450;
}; };
} }
@@ -120,7 +120,7 @@
entity_id = "{{ trigger.entity_id }}"; entity_id = "{{ trigger.entity_id }}";
}; };
data = { data = {
brightness_pct = 25; brightness_pct = 20;
rgbw_color = [ 255 126 0 255 ]; rgbw_color = [ 255 126 0 255 ];
}; };
} }
@@ -416,6 +416,20 @@
"light.hallway_bulb_2" "light.hallway_bulb_2"
]; ];
} }
{
platform = "switch";
name = "Toilet Switch";
entity_id = "switch.toilet";
}
{
platform = "group";
name = "Toilet Lights";
all = true;
entities = [
"light.toilet_switch"
"light.toilet_bulb"
];
}
]; ];
}; };
} }

View File

@@ -1,8 +1,4 @@
{ {
services.home-assistant.extraComponents = [
"nuki"
];
services.home-assistant.config = { services.home-assistant.config = {
"automation power leave home" = { "automation power leave home" = {
alias = "leave house power"; alias = "leave house power";

View File

@@ -268,7 +268,7 @@ in {
}; };
bridge = { bridge = {
username_template = "signal_{{.}}"; username_template = "signal_{{.}}";
displayname_template = "{{or .ProfileName .PhoneNumber \"Unknown user\"}}"; displayname_template = "{{or .ProfileName .PhoneNumber \"Unknown user\"}} (Signal)";
double_puppet_server_map = { }; double_puppet_server_map = { };
login_shared_secret_map = { }; login_shared_secret_map = { };
command_prefix = "!signal"; command_prefix = "!signal";
@@ -281,6 +281,9 @@ in {
require = true; require = true;
}; };
}; };
matrix = {
sync_direct_chat_list = true;
};
logging = { logging = {
min_level = "info"; min_level = "info";
writers = lib.singleton { writers = lib.singleton {
@@ -408,13 +411,14 @@ in {
}; };
bridge = { bridge = {
username_template = "discord_{{.}}"; username_template = "discord_{{.}}";
displayname_template = "{{or .ProfileName .PhoneNumber \"Unknown user\"}}"; displayname_template = "{{or .GlobalName .Username}} (Discord{{if .Bot}} bot{{end}})";
double_puppet_server_map = { }; double_puppet_server_map = { };
login_shared_secret_map = { }; login_shared_secret_map = { };
command_prefix = "!discord"; command_prefix = "!discord";
permissions."*" = "relay"; permissions."*" = "relay";
permissions."cloonar.com" = "user"; permissions."cloonar.com" = "user";
relay.enabled = true; relay.enabled = true;
restricted_rooms = true;
encryption = { encryption = {
allow = true; allow = true;
default = true; default = true;