shack/glados: use host consistently

This commit is contained in:
makefu 2020-01-10 09:59:11 +01:00
parent 8c0cf30a2d
commit 5f3dcaa958
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
4 changed files with 17 additions and 16 deletions

View File

@ -11,6 +11,7 @@
data = { data = {
entity_id = "light.fablab_led"; entity_id = "light.fablab_led";
effect = "Rainbow"; effect = "Rainbow";
color_name = "yellow";
}; };
} }
]; ];

View File

@ -4,32 +4,32 @@ in
{ {
esphome = esphome =
{ {
temp = {name, topic ? "temperature" }: temp = {host, topic ? "temperature" }:
{ {
platform = "mqtt"; platform = "mqtt";
name = "${name} Temperature"; name = "${host} Temperature";
device_class = "temperature"; device_class = "temperature";
unit_of_measurement = "°C"; unit_of_measurement = "°C";
icon = "mdi:thermometer"; icon = "mdi:thermometer";
state_topic = "${prefix}/${name}/sensor/${topic}/state"; state_topic = "${prefix}/${host}/sensor/${topic}/state";
availability_topic = "${prefix}/${name}/status"; availability_topic = "${prefix}/${host}/status";
payload_available = "online"; payload_available = "online";
payload_not_available = "offline"; payload_not_available = "offline";
}; };
hum = {name, topic ? "humidity" }: hum = {host, topic ? "humidity" }:
{ {
platform = "mqtt"; platform = "mqtt";
unit_of_measurement = "%"; unit_of_measurement = "%";
icon = "mdi:water-percent"; icon = "mdi:water-percent";
device_class = "humidity"; device_class = "humidity";
name = "${name} Humidity"; name = "${host} Humidity";
state_topic = "${prefix}/${name}/sensor/${topic}/state"; state_topic = "${prefix}/${host}/sensor/${topic}/state";
availability_topic = "${prefix}/${name}/status"; availability_topic = "${prefix}/${host}/status";
payload_available = "online"; payload_available = "online";
payload_not_available = "offline"; payload_not_available = "offline";
}; };
# copied from "homeassistant/light/fablab_led/led_ring/config" # copied from "homeassistant/light/fablab_led/led_ring/config"
led = {name, topic ? "led", host ? name }: led = {host, topic ? "led", name ? host}:
{ # name: fablab_led { # name: fablab_led
# topic: led_ring # topic: led_ring
platform = "mqtt"; platform = "mqtt";
@ -64,7 +64,7 @@ in
icon = "mdi:chemical-weapon"; icon = "mdi:chemical-weapon";
inherit name; inherit name;
state_topic = "${prefix}/${host}/sensor/${topic}/state"; state_topic = "${prefix}/${host}/sensor/${topic}/state";
availability_topic = "${prefix}/${name}/status"; availability_topic = "${prefix}/${host}/status";
}; };
dust_100m = {host, name ? "${host} < 10µm", topic ? "particulate_matter_100m_concentration" }: dust_100m = {host, name ? "${host} < 10µm", topic ? "particulate_matter_100m_concentration" }:
{ {
@ -72,8 +72,8 @@ in
unit_of_measurement = "µg/m³"; unit_of_measurement = "µg/m³";
icon = "mdi:chemical-weapon"; icon = "mdi:chemical-weapon";
inherit name; inherit name;
state_topic = "${prefix}/${name}/sensor/${topic}/state"; state_topic = "${prefix}/${host}/sensor/${topic}/state";
availability_topic = "${prefix}/${name}/status"; availability_topic = "${prefix}/${host}/status";
}; };
switch = {host, name ? "${host} Button", topic ? "btn" }: switch = {host, name ? "${host} Button", topic ? "btn" }:
# host: ampel # host: ampel
@ -89,7 +89,7 @@ in
}; };
tasmota = tasmota =
{ {
plug = {name, topic ? name }: plug = {host, name ? host, topic ? host}:
{ {
platform = "mqtt"; platform = "mqtt";
inherit name; inherit name;

View File

@ -4,7 +4,7 @@ let
in in
{ {
switch = [ switch = [
(glados.tasmota.plug { name = "Wasser"; topic = "plug";} ) (glados.tasmota.plug { host = "Wasser"; topic = "plug";} )
]; ];
automation = automation =

View File

@ -1,5 +1,5 @@
let let
glados = import ../lib; glados = import ../lib;
in in
(map (name: glados.esphome.temp {inherit name;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ]) (map (host: glados.esphome.temp {inherit host;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])
++ (map (name: glados.esphome.hum {inherit name;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ]) ++ (map (host: glados.esphome.hum {inherit host;}) [ "lounge" "werkstatt" "herrenklo" "dusche" "fablab" "whc" ])