Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • infrastruktur/ansible-warpzone
  • specki/ansible-warpzone
2 results
Show changes
Showing
with 1025 additions and 116 deletions
# Nameskonvention für Server: Pratchett Name/Charaktere
# Nächste freie Namen: ogg, carrot, vimes
[prod]
# Interner Server Warpzone
# Umgebaute Watchguard im Serverschrank
# https://wiki.warpzone.ms/intern:warpzone_internal_it_infrastructure#host_fuer_interne_dienste_watchguard_xtm_505
# Für Verbindungen über den Webserver als Jumphost folgende Parameter ergänzen:
# ansible_ssh_common_args='-o ForwardAgent=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand="ssh -W %h:%p -q 159.69.57.51"'
# Interner Proxmox-Server (neu ab 09-2022)
weatherwax ansible_ssh_host=192.168.0.200
# Server für interne Dienste (neu ab 09-2022)
# Container auf dem internen Proxmox Server
# Wichtige Optionen: Nesting = Yes, keyctl = enabled
ogg ansible_ssh_host=192.168.0.201
# Externe Server Warpzone
# Öffentlicher Root Server Warpzone bei Hetzner
tiffany ansible_ssh_host=159.69.57.15
# Öffentlicher Webserver Warpzone
# VM auf dem Webtropia-Server
webserver ansible_ssh_host=159.69.57.51
# Vorstands-VM
# VM auf dem Webtropia-Server
# Auch erreichbar unter werwaltung.warpzone.ms
verwaltung ansible_ssh_host=195.201.179.60
---
# Nameskonvention für Server: Pratchett Name/Charaktere
# Namensliste: https://wiki.lspace.org/List_of_Pratchett_characters
# Nächste freie Namen: vimes, cake, colon, detritus, dibbler, dorfl, gaspode, quirm, cherry, nobby, ramkin, ron, shoe, slant, angua, vetinary, bursar, coin, dean, worblehat, luggage. mustrum, rincewind, wrangler, stibbons, whitlow
test:
hosts:
test-warpzone-de:
ansible_ssh_host: 159.69.57.56
ansible_user: root
prod:
hosts:
# Interner Proxmox-Server
# Für Verbindungen über den Webserver als Jumphost folgende Parameter ergänzen:
# ansible_ssh_common_args='-o ForwardAgent=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand="ssh -W %h:%p -q 159.69.57.51"'
weatherwax:
ansible_ssh_host: 192.168.0.200
ansible_user: root
# Externe Server Warpzone
# Öffentlicher Root Server Warpzone bei Hetzner
tiffany:
ansible_ssh_host: 159.69.57.15
ansible_user: root
# Server für interne Dienste
# Container auf dem internen Proxmox Server
# Wichtige Optionen: Nesting = Yes, keyctl = enabled
ogg:
ansible_ssh_host: 192.168.0.201
ansible_user: root
# Server für VPN Verbindung zum Webserver
# Container auf dem internen Proxmox Server
# Wichtige Optionen: Nesting = Yes, keyctl = enabled
carrot:
ansible_ssh_host: 192.168.0.202
ansible_user: root
dhcpdns:
ansible_ssh_host: 10.0.0.2
ansible_user: root
#ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q root@webserver.warpzone.ms"'
# Öffentlicher Webserver Warpzone
# VM auf Tiffany
webserver:
ansible_ssh_host: 159.69.57.51
ansible_user: root
# Vorstands-VM
# VM auf Tiffany
# Auch erreichbar unter verwaltung.warpzone.ms
verwaltung:
ansible_ssh_host: 195.201.179.60
ansible_user: root
event:
hosts:
# Physischer Server für Veranstaltungen / Camps
# warpzone.remote Proxmox-Server
hex:
ansible_ssh_host: 10.111.10.100
ansible_user: root
# Virtueller Server für Infrastruktur-Dienste auf Veranstaltungen / Camps
# Container auf dem warpzone.remote Proxmox-Server
# Wichtige Optionen: Nesting = Yes, keyctl = enabled
hix:
ansible_ssh_host: 10.111.10.101
ansible_user: root
\ No newline at end of file
File added
intern/docker_esphome/files/config/circle.gif

305 KiB

File added
File added
......@@ -20,20 +20,31 @@
dest: "{{ basedir }}/{{ item }}"
with_items:
- config/04B03.ttf
- config/C64_Pro_Mono-STYLE.ttf
- config/tall-pixel-8x3.ttf
- config/tall-pixel-edit.ttf
- config/frekvens-dot.ttf
register: config
- name: "create config files for {{ servicename }}"
- name: "create docker config for {{ servicename }}"
template:
src: "{{ item }}"
dest: "{{ basedir }}/{{ item }}"
with_items:
- docker-compose.yml
- compile.sh
register: config
- name: "create {{ servicename }} configs"
template:
src: "{{ item }}"
dest: "{{ basedir }}/{{ item }}"
with_items:
- config/esphome_abluft.yaml
- config/esphome_alarm.yaml
- config/esphome_dach.yaml
- config/esphome_display01.yaml
- config/esphome_display02.yaml
- config/esphome_display03.yaml
- config/esphome_feinstaub01.yaml
- config/esphome_hauptraum.yaml
- config/esphome_holzwerkstatt.yaml
......@@ -41,17 +52,27 @@
- config/esphome_kuehlschrank.yaml
- config/esphome_lounge.yaml
- config/esphome_luftfilter01.yaml
- config/esphome_strommesser.yaml
- config/esphome_status.yaml
- config/esphome_vortragsraum.yaml
register: config
- config/esphome_plug01.yaml
- config/esphome_plug02.yaml
- config/esphome_plug03.yaml
- config/esphome_plug04.yaml
- config/esphome_plug05.yaml
- config/esphome_plug06.yaml
- config/esphome_plug07.yaml
- config/esphome_plug08.yaml
- config/esphome_popcorn.yaml
- config/esphome_power.yaml
- config/esphome_switchboard.yaml
- name: "stop {{ servicename }} docker"
docker_compose:
community.docker.docker_compose_v2:
project_src: "{{ basedir }}"
state: absent
when: config.changed
- name: "start {{ servicename }} docker"
docker_compose:
community.docker.docker_compose_v2:
project_src: "{{ basedir }}"
state: present
{% set devicename = "esphome_abluft" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.d1_mini.inc.yaml" %}
{% include "/includes/common.inc.yaml" %}
# fan control
output:
- platform: esp8266_pwm
inverted: true
min_power: 0.15
max_power: 0.82
zero_means_zero: true
pin: D1
id: pwmout
fan:
- platform: speed
output: pwmout
name: Speed
sensor:
- platform: pulse_counter
pin:
number: D2
mode: INPUT_PULLUP
unit_of_measurement: 'RPM'
name: RPM
update_interval: 5s
......@@ -3,9 +3,9 @@
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.d1_mini.inc.yaml" %}
# force newline
platformio_options:
upload_speed: 115200
lib_deps:
- Wire # Also required by GFX.
- SPI # Also required by GFX.
......@@ -20,6 +20,7 @@ external_components:
{% include "/includes/common.inc.yaml" %}
light:
- platform: monochromatic
name: 'Brightness'
......@@ -35,39 +36,23 @@ output:
number: GPIO14
inverted: True
globals:
- id: coords
type: int
restore_value: no
initial_value: '0'
- id: length
type: int
restore_value: no
initial_value: '0'
interval:
- interval: 300ms
then:
lambda: |-
if (id(coords) < -(id(length))) {
id(coords) = 0;
}
else {
id(coords) -= 2;
}
time:
- platform: sntp
id: ntp_time
timezone: 'Europe/Berlin'
font:
- file: "04B03.ttf"
id: b03
size: 16
size: 8
display:
- platform: frekvens_panel
latch_pin: 12
clock_pin: 04
data_pin: 05
id: my_display
lambda: |-
std::string printout=" warpzone";
int clength = printout.length();
id(length)=clength*16;
it.print(id(coords), 0, id(b03), printout.c_str());;
\ No newline at end of file
it.strftime(4, 0, id(b03), "%H", id(ntp_time).now());
it.strftime(4, 8, id(b03), "%M", id(ntp_time).now());
\ No newline at end of file
{% set devicename = "esphome_display02" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp32-doit-devkit-v1.inc.yaml" %}
{% include "/includes/board.d1_mini.inc.yaml" %}
# force newline
comment: Display Kuehlschrank
platformio_options:
upload_speed: 115200
lib_deps:
- Wire # Also required by GFX.
- SPI # Also required by GFX.
......@@ -17,56 +16,133 @@ external_components:
- source: github://phiten/esphome-ikea-led-matrix@master
components: [ obegraensad_panel ]
refresh: 0s
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: ESPHome/{{ devicename }}/state/command
payload: "ON"
then:
- light.turn_on: matrix_light
- topic: ESPHome/{{ devicename }}/state/command
payload: "OFF"
then:
- light.turn_off: matrix_light
- topic: warpzone/door/status
payload: "CLOSED"
then:
- light.turn_off: matrix_light
light:
- platform: monochromatic
name: 'Brightness'
id: matrix_light
output: matrix_brightness
restore_mode: RESTORE_DEFAULT_ON
restore_mode: ALWAYS_ON
output:
- platform: esp8266_pwm
- platform: ledc
# Enables brightness control.
id: matrix_brightness
pin:
number: GPIO14
number: GPIO25
inverted: True
globals:
- id: coords
type: int
restore_value: no
initial_value: '0'
- id: length
type: int
restore_value: no
initial_value: '0'
- id: coords
type: int
restore_value: no
initial_value: '0'
- id: length
type: int
restore_value: no
initial_value: '0'
binary_sensor:
- platform: gpio
pin:
number: GPIO26
inverted: true
mode:
input: true
pullup: true
id: button
name: button
time:
- platform: sntp
id: ntp_time
timezone: 'Europe/Berlin'
interval:
- interval: 300ms
- interval: 5s
then:
lambda: |-
if (id(coords) < -(id(length))) {
id(coords) = 0;
}
else {
id(coords) -= 2;
}
- display.page.show_next: my_display
- component.update: my_display
font:
- file: "04B03.ttf"
- file: "tall-pixel-edit.ttf"
id: b03
size: 16
size: 6
glyphs: '!"%()+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzüµ '
text_sensor:
- platform: mqtt_subscribe
name: "Sensor Hauptraum Temp"
id: sensor_hauptraum_temp
topic: ESPHome/esphome_hauptraum/sensor/temp/state
- platform: mqtt_subscribe
name: "Sensor Vortragsraum Temp"
id: sensor_vortragsraum_temp
topic: ESPHome/esphome_vortragsraum/sensor/temp/state
- platform: mqtt_subscribe
name: "Sensor Kuehlschrank Temp"
id: sensor_kuehlschrank_temp
topic: ESPHome/esphome_kuehlschrank/sensor/kuehlschrank-temp/state
- platform: mqtt_subscribe
name: "Sensor Feinstaub 2.5"
id: sensor_feinstaub_2_5
topic: ESPHome/esphome_feinstaub01/sensor/feinstaub_2_5/state
- platform: mqtt_subscribe
name: "Sensor warpzone Status"
id: sensor_warpzone_status
topic: warpzone/door/status
- platform: mqtt_subscribe
name: "Sensor Stromverbrauch kW"
id: sensor_stromverbrauch_kw
topic: ESPHome/esphome_status/sensor/stromverbrauch/state
display:
- platform: obegraensad_panel
latch_pin: 12
clock_pin: 04
data_pin: 05
lambda: |-
std::string printout=" warpzone";
int clength = printout.length();
id(length)=clength*16;
it.print(id(coords), 0, id(b03), printout.c_str());;
\ No newline at end of file
clock_pin: 14
data_pin: 27
id: my_display
pages:
- id: Page1
lambda: |-
it.printf(0,-1,id(b03),"Haup");
it.printf(0,7,id(b03),"%s°C",id(sensor_hauptraum_temp).state.c_str());
- id: Page2
lambda: |-
it.printf(0,-1,id(b03),"Vort");
it.printf(0,7,id(b03),"%s°C",id(sensor_vortragsraum_temp).state.c_str());
- id: Page3
lambda: |-
it.printf(0,-1,id(b03),"Kühl");
it.printf(0,7,id(b03),"%s°C",id(sensor_kuehlschrank_temp).state.c_str());
- id: Page4
lambda: |-
it.strftime(4,-1,id(b03),"%H",id(ntp_time).now());
it.strftime(4,7,id(b03),"%M",id(ntp_time).now());
- id: Page5
lambda: |-
it.printf(0,-1,id(b03),"Luft");
it.printf(0,7,id(b03),"%sµg",id(sensor_feinstaub_2_5).state.c_str());
- id: Page6
lambda: |-
it.printf(0,-1,id(b03),"Stro");
it.printf(0,7,id(b03),"%s",id(sensor_stromverbrauch_kw).state.c_str());
- id: Page7
lambda: |-
it.printf(0,-1,id(b03)," WZ");
it.printf(0,7,id(b03),id(sensor_warpzone_status).state.c_str());
\ No newline at end of file
{% set devicename = "esphome_display03" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp32-doit-devkit-v1.inc.yaml" %}
# force newline
platformio_options:
upload_speed: 115200
lib_deps:
- Wire # Also required by GFX.
- SPI # Also required by GFX.
- adafruit/Adafruit BusIO # Required by GFX Library.
- adafruit/Adafruit GFX Library # Required for FrekvensPanel.
- me-no-dev/ESPAsyncTCP
external_components:
- source: github://phiten/esphome-ikea-led-matrix@master
components: [ frekvens_panel ]
refresh: 0s
{% include "/includes/common.inc.yaml" %}
light:
- platform: monochromatic
name: 'Brightness'
output: matrix_brightness
restore_mode: RESTORE_DEFAULT_ON
output:
- platform: ledc
# Enables brightness control.
max_power: 0.05
id: matrix_brightness
pin:
number: GPIO27
inverted: True
time:
- platform: sntp
id: ntp_time
timezone: 'Europe/Berlin'
font:
- file: "04B03.ttf"
id: b03
size: 8
display:
- platform: frekvens_panel
latch_pin: 13
clock_pin: 26
data_pin: 14
id: my_display
pages:
- id: Page1
lambda: |-
it.strftime(4, 0, id(b03), "%H", id(ntp_time).now());
it.strftime(4, 8, id(b03), "%M", id(ntp_time).now());
interval:
- interval: 5s
then:
- display.page.show_next: my_display
- component.update: my_display
......@@ -15,7 +15,7 @@ i2c:
# Sensor configs
sensor:
- platform: bme280
- platform: bme280_i2c
temperature:
name: "Temp"
oversampling: 16x
......
{% set devicename = "esphome_kuehlschrank" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.d1_mini.inc.yaml" %}
{% include "/includes/board.esp32-doit-devkit-v1.inc.yaml" %}
on_boot:
- priority: -100
then:
- light.addressable_set:
id: logo_led
white: 0%
- light.addressable_set:
id: kuehl_led
white: 0%
- priority: -100
then:
- light.turn_on:
id: logo_led
effect: "Rainbow"
brightness: 100%
- light.turn_on:
id: kuehl_led
effect: "Rainbow"
brightness: 100%
- media_player.volume_set:
id: speaker
volume: 100%
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: warpzone/door/status
payload: "OPEN"
then:
- light.turn_on:
id: logo_led
effect: "Rainbow"
brightness: 100%
- light.turn_on:
id: kuehl_led
effect: "Rainbow"
brightness: 100%
- topic: warpzone/door/status
payload: "CLOSED"
then:
- light.turn_off: logo_led
- light.turn_off: kuehl_led
# Dallas DS18B20
dallas:
- pin: D3
update_interval: 10s
- pin: GPIO32
update_interval: 10s
# Sensor configs
sensor:
- platform: dallas
address: 0x4301143CAC4BAA28
name: "Kuehlschrank-Temp"
filters:
- sliding_window_moving_average:
window_size: 3
send_every: 3
send_first_at: 3
- platform: dallas
address: 0x4301143CAC4BAA28
name: "Kuehlschrank-Temp"
filters:
- sliding_window_moving_average:
window_size: 3
send_every: 3
send_first_at: 3
binary_sensor:
- platform: gpio
pin:
number: GPIO33
mode:
input: true
pullup: true
id: kuehlschrank_door
name: Kuehlschrank-Door
on_release:
then:
- light.turn_on:
id: kuehl_led
effect: "Rainbow"
brightness: 100%
- light.addressable_set:
id: kuehl_led
white: 0%
on_press:
then:
- light.turn_on:
id: kuehl_led
effect: "None"
brightness: 100%
- light.addressable_set:
id: kuehl_led
red: 100%
green: 100%
blue: 100%
white: 100%
- media_player.play_media:
id: speaker
media_url: 'http://fridgeserver.warpzone.lan:5000/audio.php'
light:
- platform: neopixelbus
type: RGBW
variant: SK6812
id: logo_led
pin: GPIO26
num_leds: 30
name: "Liba Logo LEDs"
restore_mode: ALWAYS_ON
method:
type: esp32_rmt
channel: 0
effects:
- addressable_color_wipe:
- addressable_color_wipe:
name: Color Wipe Effect With Custom Values
colors:
- red: 100%
green: 100%
blue: 100%
num_leds: 3
- red: 0%
green: 0%
blue: 0%
num_leds: 3
add_led_interval: 100ms
reverse: false
- addressable_rainbow:
- addressable_rainbow:
name: Rainbow Effect With Custom Values
speed: 2
width: 8
- addressable_scan:
- addressable_scan:
name: Scan Effect With Custom Values
move_interval: 100ms
scan_width: 2
- addressable_random_twinkle:
- addressable_random_twinkle:
name: Random Twinkle Effect With Custom Values
twinkle_probability: 5%
progress_interval: 32ms
- addressable_fireworks:
- addressable_fireworks:
name: Fireworks Effect With Custom Values
update_interval: 32ms
spark_probability: 10%
use_random_color: false
fade_out_rate: 120
- addressable_color_wipe:
name: BootUp
colors:
- red: 100%
green: 0%
blue: 0%
num_leds: 8
- red: 0%
green: 0%
blue: 0%
num_leds: 8
add_led_interval: 100ms
reverse: False
- platform: neopixelbus
type: RGBW
variant: SK6812
id: kuehl_led
pin: GPIO23
num_leds: 72
name: "Kuehl LEDs"
restore_mode: ALWAYS_ON
method:
type: esp32_rmt
channel: 1
effects:
- addressable_color_wipe:
- addressable_color_wipe:
name: Color Wipe Effect With Custom Values
colors:
- red: 100%
green: 100%
blue: 100%
num_leds: 3
- red: 0%
green: 0%
blue: 0%
num_leds: 3
add_led_interval: 100ms
reverse: false
- addressable_rainbow:
- addressable_rainbow:
name: Rainbow Effect With Custom Values
speed: 2
width: 8
- addressable_scan:
- addressable_scan:
name: Scan Effect With Custom Values
move_interval: 100ms
scan_width: 2
- addressable_random_twinkle:
- addressable_random_twinkle:
name: Random Twinkle Effect With Custom Values
twinkle_probability: 5%
progress_interval: 32ms
- addressable_fireworks:
- addressable_fireworks:
name: Fireworks Effect With Custom Values
update_interval: 32ms
spark_probability: 10%
use_random_color: false
fade_out_rate: 120
- addressable_color_wipe:
name: BootUp
colors:
- red: 100%
green: 0%
blue: 0%
num_leds: 8
- red: 0%
green: 0%
blue: 0%
num_leds: 8
add_led_interval: 100ms
reverse: False
i2s_audio:
- id: i2s_out
i2s_lrclk_pin: GPIO21
i2s_bclk_pin: GPIO19
- platform: gpio
pin: D2
id: kuehlschrank_door
name: Kuehlschrank-Door
\ No newline at end of file
media_player:
- platform: i2s_audio
name: ESPHome I2S Media Player
id: speaker
dac_type: external
i2s_audio_id: i2s_out
i2s_dout_pin: GPIO18
mode: mono
{% set devicename = "esphome_plug01" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp01_1m.inc.yaml" %}
comment: Bullhorn Kuhhorn Muuuuh!
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: ESPHome/{{ devicename }}/state/command
payload: "ON"
then:
- switch.turn_on: relay
- topic: ESPHome/{{ devicename }}/state/command
payload: "OFF"
then:
- switch.turn_off: relay
- topic: warpzone/door/status
payload: "CLOSED"
then:
- switch.turn_off: relay
status_led:
pin:
number: GPIO13
inverted: false
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "{{ devicename }} Button"
on_press:
- switch.toggle: relay
- platform: status
name: "{{ devicename }} Status"
switch:
- platform: gpio
name: "{{ devicename }} Relay"
pin: GPIO12
id: "relay"
restore_mode: RESTORE_DEFAULT_ON
\ No newline at end of file
{% set devicename = "esphome_plug02" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp01_1m.inc.yaml" %}
comment: LED Theke
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: ESPHome/{{ devicename }}/state/command
payload: "ON"
then:
- switch.turn_on: relay
- topic: ESPHome/{{ devicename }}/state/command
payload: "OFF"
then:
- switch.turn_off: relay
- topic: warpzone/door/status
payload: "CLOSED"
then:
- switch.turn_off: relay
- topic: warpzone/door/status_once
payload: "OPEN"
then:
- switch.turn_on: relay
status_led:
pin:
number: GPIO13
inverted: false
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "{{ devicename }} Button"
on_press:
- switch.toggle: relay
- platform: status
name: "{{ devicename }} Status"
switch:
- platform: gpio
name: "{{ devicename }} Relay"
pin: GPIO12
id: "relay"
restore_mode: RESTORE_DEFAULT_ON
\ No newline at end of file
{% set devicename = "esphome_plug03" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp01_1m.inc.yaml" %}
comment: Fernseher Lounge
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: ESPHome/{{ devicename }}/state/command
payload: "ON"
then:
- switch.turn_on: relay
- topic: ESPHome/{{ devicename }}/state/command
payload: "OFF"
then:
- switch.turn_off: relay
- topic: warpzone/door/status
payload: "CLOSED"
then:
- switch.turn_off: relay
- topic: warpzone/door/status_once
payload: "OPEN"
then:
- switch.turn_on: relay
status_led:
pin:
number: GPIO13
inverted: false
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "{{ devicename }} Button"
on_press:
- switch.toggle: relay
- platform: status
name: "{{ devicename }} Status"
switch:
- platform: gpio
name: "{{ devicename }} Relay"
pin: GPIO12
id: "relay"
restore_mode: RESTORE_DEFAULT_ON
\ No newline at end of file
{% set devicename = "esphome_plug04" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp01_1m.inc.yaml" %}
comment: frei
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: ESPHome/{{ devicename }}/state/command
payload: "ON"
then:
- switch.turn_on: relay
- topic: ESPHome/{{ devicename }}/state/command
payload: "OFF"
then:
- switch.turn_off: relay
- topic: warpzone/door/status
payload: "CLOSED"
then:
- switch.turn_off: relay
status_led:
pin:
number: GPIO13
inverted: false
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "{{ devicename }} Button"
on_press:
- switch.toggle: relay
- platform: status
name: "{{ devicename }} Status"
switch:
- platform: gpio
name: "{{ devicename }} Relay"
pin: GPIO12
id: "relay"
restore_mode: RESTORE_DEFAULT_OFF
{% set devicename = "esphome_plug05" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp01_1m.inc.yaml" %}
comment: Propaganda Bildschirm
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: ESPHome/{{ devicename }}/state/command
payload: "ON"
then:
- switch.turn_on: relay
- topic: ESPHome/{{ devicename }}/state/command
payload: "OFF"
then:
- switch.turn_off: relay
- topic: warpzone/door/status
payload: "CLOSED"
then:
- switch.turn_off: relay
substitutions:
plug_name: {{ devicename }}
# Higher value gives lower watt readout
current_res: "0.00221"
# Lower value gives lower voltage readout
voltage_div: "920"
binary_sensor:
# Binary sensor for the button press
- platform: gpio
name: "${plug_name}_button"
pin:
number: GPIO3
inverted: true
on_press:
- switch.toggle: relay
switch:
- platform: gpio
id: relay
name: "${plug_name}_Relay"
restore_mode: RESTORE_DEFAULT_OFF
pin: GPIO14
on_turn_on:
- light.turn_on: led
on_turn_off:
- light.turn_off: led
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO04
cf1_pin: GPIO05
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${plug_name}_Amperage"
unit_of_measurement: A
voltage:
name: "${plug_name}_Voltage"
unit_of_measurement: V
power:
name: "${plug_name}_Wattage"
unit_of_measurement: W
id: "${plug_name}_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: ${plug_name}_Energy
power_id: "${plug_name}_Wattage"
# Enable time for energy monitoring
time:
- platform: sntp
output:
# Relay state led
- platform: esp8266_pwm
id: state_led
pin:
number: GPIO1
inverted: true
light:
# Relay state light
- platform: monochromatic
output: state_led
id: led
# Uses the red LED as a status indicator
status_led:
pin:
number: GPIO13
inverted: true
{% set devicename = "esphome_plug06" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp01_1m.inc.yaml" %}
comment: Pixelflut Server Rack
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: ESPHome/{{ devicename }}/state/command
payload: "ON"
then:
- switch.turn_on: relay
- topic: ESPHome/{{ devicename }}/state/command
payload: "OFF"
then:
- switch.turn_off: relay
- topic: warpzone/door/status
payload: "CLOSED"
then:
- switch.turn_off: relay
substitutions:
plug_name: {{ devicename }}
# Higher value gives lower watt readout
current_res: "0.00221"
# Lower value gives lower voltage readout
voltage_div: "920"
binary_sensor:
# Binary sensor for the button press
- platform: gpio
name: "${plug_name}_button"
pin:
number: GPIO3
inverted: true
on_press:
- switch.toggle: relay
switch:
- platform: gpio
id: relay
name: "${plug_name}_Relay"
restore_mode: ALWAYS_OFF
pin: GPIO14
on_turn_on:
- light.turn_on: led
on_turn_off:
- light.turn_off: led
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO04
cf1_pin: GPIO05
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${plug_name}_Amperage"
unit_of_measurement: A
voltage:
name: "${plug_name}_Voltage"
unit_of_measurement: V
power:
name: "${plug_name}_Wattage"
unit_of_measurement: W
id: "${plug_name}_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: ${plug_name}_Energy
power_id: "${plug_name}_Wattage"
# Enable time for energy monitoring
time:
- platform: sntp
output:
# Relay state led
- platform: esp8266_pwm
id: state_led
pin:
number: GPIO1
inverted: true
light:
# Relay state light
- platform: monochromatic
output: state_led
id: led
# Uses the red LED as a status indicator
status_led:
pin:
number: GPIO13
inverted: true
{% set devicename = "esphome_plug07" %}
{% include "/includes/ansible.inc.yaml" %}
{% include "/includes/board.esp01_1m.inc.yaml" %}
comment: Starroof Lounge
{% include "/includes/common.inc.yaml" %}
on_message:
- topic: ESPHome/{{ devicename }}/state/command
payload: "ON"
then:
- switch.turn_on: relay
- topic: ESPHome/{{ devicename }}/state/command
payload: "OFF"
then:
- switch.turn_off: relay
- topic: warpzone/door/status
payload: "CLOSED"
then:
- switch.turn_off: relay
- topic: warpzone/door/status_once
payload: "OPEN"
then:
- switch.turn_on: relay
substitutions:
plug_name: {{ devicename }}
# Higher value gives lower watt readout
current_res: "0.00221"
# Lower value gives lower voltage readout
voltage_div: "920"
binary_sensor:
# Binary sensor for the button press
- platform: gpio
name: "${plug_name}_button"
pin:
number: GPIO3
inverted: true
on_press:
- switch.toggle: relay
switch:
- platform: gpio
id: relay
name: "${plug_name}_Relay"
restore_mode: ALWAYS_OFF
pin: GPIO14
on_turn_on:
- light.turn_on: led
on_turn_off:
- light.turn_off: led
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO04
cf1_pin: GPIO05
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${plug_name}_Amperage"
unit_of_measurement: A
voltage:
name: "${plug_name}_Voltage"
unit_of_measurement: V
power:
name: "${plug_name}_Wattage"
unit_of_measurement: W
id: "${plug_name}_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: ${plug_name}_Energy
power_id: "${plug_name}_Wattage"
# Enable time for energy monitoring
time:
- platform: sntp
output:
# Relay state led
- platform: esp8266_pwm
id: state_led
pin:
number: GPIO1
inverted: true
light:
# Relay state light
- platform: monochromatic
output: state_led
id: led
# Uses the red LED as a status indicator
status_led:
pin:
number: GPIO13
inverted: true