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
......@@ -54,32 +54,13 @@ influxdb:
token: {{ influxdb_token }}
default_measurement: units
# Homematic CCU2
# https://www.home-assistant.io/integrations/homematic/
homematic:
local_port: {{ homematic_callback_port }}
interfaces:
rf:
host: {{ homematic.ccu2_host }}
resolvenames: json
callback_ip: {{ int_ip4 }}
callback_port: {{ homematic_callback_port }}
ip:
host: {{ homematic.ccu2_host }}
port: 2010
callback_ip: {{ int_ip4 }}
callback_port: {{ homematic_callback_port }}
groups:
host: {{ homematic.ccu2_host }}
port: 9292
resolvenames: json
path: /groups
callback_ip: {{ int_ip4 }}
callback_port: {{ homematic_callback_port }}
hosts:
ccu2:
host: {{ homematic.ccu2_host }}
# eQ3 Max
maxcube:
gateways:
- host: {{ eq3max.cube_host }}
port: 62910
scan_interval: 60
# zonenstatus wird vom hauptschalter gesteuert, switch02 ping ist nicht mehr notwendig
# https://www.home-assistant.io/integrations/ping/
......@@ -267,3 +248,555 @@ automation ansible:
timeout: 30
message: Die warpzone ist seit {{ '{{' }} states('sensor.time') {{ '}}' }} geschlossen!
mode: restart
# Stromverbrauch auf Telegram senden
- alias: ANSIBLE_stromverbrauch_send_telegram
description: Sendet alle 10 Minuten den Stromverbrauch per Telegram
trigger:
- platform: time_pattern
minutes: /10
condition: []
action:
- if:
- condition: state
entity_id: automation.ansible_zonenstatus_send_telegram
attribute: current
state: "1"
then:
- wait_for_trigger:
- platform: state
entity_id:
- automation.ansible_zonenstatus_send_telegram
attribute: current
to: "0"
- service: telegram_bot.send_message
data:
target: -1001341516106
timeout: 30
message: >-
{{ '{{' }} states('sensor.esphome_status_power') {{ '}}' }} kW bei angenehmen {{ '{{' }} states('sensor.temp') {{ '}}' }}°C
mode: restart
# Licht im Hackcenter dimmen
- alias: ANSIBLE_dali_licht_hackcenter
description: Ruft den Helper aus um per MQTT das Licht zu dimmen
trigger:
- platform: state
entity_id:
- input_number.dali_licht_hackcenter
for:
hours: 0
minutes: 0
seconds: 0
action:
- service: mqtt.publish
data:
topic: light/dali
payload_template: "{{ '{{' }} states('input_number.dali_licht_hackcenter') | int {{ '}}' }}"
mode: restart
# turn off all radiators
- alias: ANSIBLE_heizung_aus
description: Schaltet alle Heizungen aus
trigger: []
condition: []
action:
- service: climate.turn_off
target:
entity_id:
- climate.hackcenter_mitte
- climate.lounge_vorne
- climate.treppenhaus_thermostat_1
- climate.vortragsraum_vorne
- climate.holzwerkstatt_vorne
- climate.kackcenter_klo
mode: single
# turn on all radiators
- alias: ANSIBLE_heizung_an
description: Schaltet alle Heizungen an
trigger: []
condition: []
action:
- service: climate.turn_on
target:
entity_id:
- climate.hackcenter_mitte
- climate.lounge_vorne
- climate.treppenhaus_thermostat_1
- climate.vortragsraum_vorne
- climate.holzwerkstatt_vorne
- climate.kackcenter_klo
- service: climate.set_temperature
target:
entity_id:
- climate.hackcenter_mitte
- climate.lounge_vorne
- climate.treppenhaus_termostat_1
- climate.vortragsraum_vorne
- climate.holzwerkstatt_vorne
- climate.kackcenter_klo
data:
temperature: 30
mode: single
# turn on all radiators to 18.5 degrees
- alias: ANSIBLE_heizung_18.5
description: Schaltet alle Heizungen auf 18.5 Grad
trigger: []
condition: []
action:
- service: climate.turn_on
target:
entity_id:
- climate.hackcenter_mitte
- climate.lounge_vorne
- climate.treppenhaus_thermostat_1
- climate.vortragsraum_vorne
- climate.holzwerkstatt_vorne
- climate.kackcenter_klo
- service: climate.set_temperature
target:
entity_id:
- climate.hackcenter_mitte
- climate.lounge_vorne
- climate.treppenhaus_termostat_1
- climate.vortragsraum_vorne
- climate.holzwerkstatt_vorne
- climate.kackcenter_klo
data:
temperature: 18.5
mode: single
# Feinstaubsensor steuert Luftfilter
- alias: ANSIBLE_Feinstaubsensor_Luftfilter
description: Feinstaubsensor steuer Luftfilter
trigger:
- platform: time_pattern
seconds: /10
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.feinstaub_2_5
below: 36
sequence:
- service: fan.set_percentage
data:
percentage: 33
target:
device_id: 8b6ff876340558ef11d13441afecec8d
- conditions:
- condition: numeric_state
entity_id: sensor.feinstaub_2_5
above: 35
below: 86
sequence:
- service: fan.set_percentage
data:
percentage: 66
target:
device_id: 8b6ff876340558ef11d13441afecec8d
- conditions:
- condition: numeric_state
entity_id: sensor.feinstaub_2_5
above: 85
sequence:
- service: fan.set_percentage
data:
percentage: 100
target:
device_id: 8b6ff876340558ef11d13441afecec8d
mode: restart
# Feinstaubsensor steuert Ampel
- alias: ANSIBLE_Feinstaubsensor_Ampel
description: Feinstaubsensor status auf Ampel anzeigen
trigger:
- platform: time_pattern
seconds: /10
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.feinstaub_2_5
below: 36
sequence:
- device_id: e26403f906b93f7c6b4f5339a21f9b26
domain: select
entity_id: select.ampel_preset
type: select_option
option: Green static
- conditions:
- condition: numeric_state
entity_id: sensor.feinstaub_2_5
above: 35
below: 86
sequence:
- device_id: e26403f906b93f7c6b4f5339a21f9b26
domain: select
entity_id: select.ampel_preset
type: select_option
option: Orange static
- conditions:
- condition: numeric_state
entity_id: sensor.feinstaub_2_5
above: 85
sequence:
- device_id: e26403f906b93f7c6b4f5339a21f9b26
domain: select
entity_id: select.ampel_preset
type: select_option
option: Red static
mode: restart
# WLED rot
- alias: ANSIBLE_WLED_red
description: WLED rot
trigger:
- type: turned_on
platform: device
device_id: 33915e12bd114226dcd4718e77a27779
entity_id: binary_sensor.button_4
domain: binary_sensor
condition: []
action:
- service: light.turn_on
data:
rgb_color:
- 255
- 0
- 0
effect: Solid
target:
area_id:
- hackcenter
- kuche
- lounge
- serverrack
- eingang
mode: queued
max: 30
# WLED gruen
- alias: ANSIBLE_WLED_green
description: WLED gruen
trigger:
- type: turned_on
platform: device
device_id: 33915e12bd114226dcd4718e77a27779
entity_id: binary_sensor.button_5
domain: binary_sensor
condition: []
action:
- service: light.turn_on
data:
rgb_color:
- 0
- 255
- 0
effect: Solid
target:
area_id:
- hackcenter
- kuche
- lounge
- serverrack
- eingang
mode: queued
max: 30
# WLED blue
- alias: ANSIBLE_WLED_blue
description: wLED blau
trigger:
- type: turned_on
platform: device
device_id: 33915e12bd114226dcd4718e77a27779
entity_id: binary_sensor.button_6
domain: binary_sensor
condition: []
action:
- service: light.turn_on
data:
rgb_color:
- 0
- 0
- 255
effect: Solid
target:
area_id:
- hackcenter
- kuche
- lounge
- serverrack
- eingang
mode: queued
max: 30
# WLED white
- alias: ANSIBLE_WLED_white
description: WLED weiss
trigger:
- type: turned_on
platform: device
device_id: 33915e12bd114226dcd4718e77a27779
entity_id: binary_sensor.button_2
domain: binary_sensor
condition: []
action:
- service: light.turn_on
data:
rgb_color:
- 255
- 255
- 255
effect: Solid
target:
area_id:
- hackcenter
- kuche
- lounge
- serverrack
- eingang
mode: queued
max: 30
# WLED off
- alias: ANSIBLE_WLED_off
description: WLED aus
trigger:
- type: turned_on
platform: device
device_id: 33915e12bd114226dcd4718e77a27779
entity_id: binary_sensor.button_3
domain: binary_sensor
condition: []
action:
- service: light.turn_off
target:
area_id:
- hackcenter
- kuche
- lounge
- serverrack
- eingang
mode: queued
max: 30
# WLED default
- alias: "ANSIBLE_WLED_default"
description: WLED Default effect
trigger:
- type: turned_on
platform: device
device_id: 33915e12bd114226dcd4718e77a27779
entity_id: binary_sensor.button_1
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 0
condition: []
action:
- service: light.turn_on
data: {}
target:
area_id:
- hackcenter
- kuche
- lounge
- serverriack
- eingang
- service: select.select_option
data:
option: default
target:
entity_id:
- select.icicles_preset
- select.kueche_preset
- select.lightsaber01_preset
- select.lightsaber02_preset
- select.loetecke_preset
- select.loungedecke_preset
- select.rack_preset
- select.schild_preset
- select.theke_preset
- select.trocknerschlauch_preset
- select.warpcubes_preset
- select.loungetisch_preset
- select.matrix01_preset
- select.vorhang_preset
- select.lampan_preset
- select.clock_preset
mode: single
# WLED meteor
- alias: "ANSIBLE_WLED_Meteor"
description: WLED Meteor effect
trigger:
- type: turned_on
platform: device
device_id: 33915e12bd114226dcd4718e77a27779
entity_id: binary_sensor.button_1
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 10
condition: []
action:
- service: light.turn_on
data: {}
target:
area_id:
- hackcenter
- kuche
- lounge
- serverrack
- eingang
- service: select.select_option
data:
option: Meteor
target:
entity_id:
- select.icicles_preset
- select.kueche_preset
- select.lightsaber01_preset
- select.lightsaber02_preset
- select.loetecke_preset
- select.loungedecke_preset
- select.rack_preset
- select.schild_preset
- select.theke_preset
- select.trocknerschlauch_preset
- select.warpcubes_preset
- select.loungetisch_preset
- select.matrix01_preset
- select.vorhang_preset
- select.lampan_preset
- select.clock_preset
mode: single
# WLED Zonenstatus
- alias: "ANSIBLE_WLED_Zonenstatus"
description: "Turn WLED devices on, when opened, off when closed"
mode: single
trigger:
- platform: state
entity_id:
- input_select.zonenstatus
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.zonenstatus
state: open
sequence:
- service: light.turn_on
data: {}
target:
area_id:
- eingang
- hackcenter
- kuche
- lounge
- conditions:
- condition: state
entity_id: input_select.zonenstatus
state: closed
sequence:
- service: light.turn_off
data: {}
target:
area_id:
- eingang
- hackcenter
- kuche
- lounge
# ESPHOME Zonenstatus
- alias: "ANSIBLE_ESPHOME_Zonenstatus"
description: ""
mode: single
trigger:
- platform: state
entity_id:
- input_select.zonenstatus
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.zonenstatus
state: "opened"
sequence:
- service: light.turn_on
data:
effect: Rainbow
target:
entity_id:
- light.liba_logo_leds
- light.kuehl_leds
- type: turn_on
device_id: 7ba91dde6b1413340fdc66f2984dfd00
entity_id: light.brightness
domain: light
- conditions:
- condition: state
entity_id: input_select.zonenstatus
state: "closed"
sequence:
- type: turn_off
device_id: 1dace6e3f89d85152cde6383312792eb
entity_id: switch.esphome_plug01_relay
domain: switch
- type: turn_off
device_id: 9f6aded98a4a96ab85c96b829895f449
entity_id: switch.esphome_plug02_relay
domain: switch
- type: turn_off
device_id: 502f88ff07aa71cb053ad4112e0dd6bd
entity_id: switch.esphome_plug03_relay
domain: switch
- type: turn_off
device_id: b9ea4fd30dabfe365b5098c66eb1f4ba
entity_id: switch.esphome_plug04_relay
domain: switch
- type: turn_off
device_id: c5f54add49fda7640497b1883315d48b
entity_id: switch.esphome_plug05_relay
domain: switch
- type: turn_off
device_id: a0788c8cf4ee036ce43e0d563fdbdb3a
entity_id: switch.esphome_plug06_relay
domain: switch
- type: turn_off
device_id: 1637a583963ba02dc7baa17427f8ac00
entity_id: switch.esphome_plug07_relay
domain: switch
- type: turn_off
device_id: 1da3229859c49c822fd8e9c630fa9004
entity_id: switch.esphome_plug08_relay
domain: switch
- service: light.turn_off
data: {}
target:
entity_id:
- light.liba_logo_leds
- light.kuehl_leds
- type: turn_off
device_id: 7ba91dde6b1413340fdc66f2984dfd00
entity_id: light.brightness
domain: light
- type: turn_off
device_id: f65f71ef46e86492b79d75223670013a
entity_id: switch.licht_hackcenter
domain: switch
\ No newline at end of file
......@@ -5,7 +5,7 @@ services:
app:
image: homeassistant/home-assistant:2023.3
image: homeassistant/home-assistant:2023.6
restart: always
ports:
- "{{ int_ip4 }}:{{ homematic_callback_port }}:{{ homematic_callback_port }}"
......
---
- include: ../functions/get_secret.yml
with_items:
- { path: "{{ basedir }}/influxdb_password", length: 12 }
- { path: "{{ basedir }}/influxdb_token", length: 32 }
- name: "create folder struct for {{ basedir }}"
file:
path: "{{ item }}"
state: "directory"
with_items:
- "{{ basedir }}"
- name: "copy config files for {{ basedir }}"
template:
src: "{{ item }}"
dest: "{{ basedir }}/{{ item }}"
with_items:
- docker-compose.yml
- telegraf.conf
register: config_files
- name: "stop {{ servicename }} docker"
docker_compose:
project_src: "{{ basedir }}"
state: absent
when: config_files.changed
- name: "start {{ servicename }} docker"
docker_compose:
project_src: "{{ basedir }}"
state: present
version: "3"
services:
app:
image: sfudeus/homematic_exporter:2023-05-21
restart: always
command: "--ccu_host {{ homematic.ccu2_host }} --ccu_port 2001 --port {{ homematic_metrics_port }}"
ports:
- "{{ int_ip4 }}:{{ homematic_metrics_port }}:{{ homematic_metrics_port }}"
networks:
- default
influxdb:
image: influxdb:2.6.1
restart: always
ports:
- "{{ int_ip4 }}:{{ influxdb_port }}:8086"
volumes:
- "{{ basedir }}/influxdb:/var/lib/influxdb2"
environment:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME: homematic
DOCKER_INFLUXDB_INIT_PASSWORD: {{ influxdb_password }}
DOCKER_INFLUXDB_INIT_ORG: homematic
DOCKER_INFLUXDB_INIT_BUCKET: homematic
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: {{ influxdb_token }}
networks:
- default
telegraf:
image: telegraf:1.25.3
restart: always
depends_on:
- app
- influxdb
volumes:
- "{{ basedir }}/telegraf.conf:/etc/telegraf/telegraf.conf:ro"
# Telegraf Configuration
#
# Telegraf is entirely plugin driven. All metrics are gathered from the
# declared inputs, and sent to the declared outputs.
#
# Plugins must be declared in here to be active.
# To deactivate a plugin, comment out the name and any variables.
#
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
# file would generate.
#
# Environment variables can be used anywhere in this config file, simply surround
# them with ${}. For strings the variable must be within quotes (ie, "${STR_VAR}"),
# for numbers and booleans they should be plain (ie, ${INT_VAR}, ${BOOL_VAR})
# Global tags can be specified here in key="value" format.
[global_tags]
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# rack = "1a"
## Environment variables can be used as tags, and throughout the config file
# user = "$USER"
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "5s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## Telegraf will send metrics to outputs in batches of at most
## metric_batch_size metrics.
## This controls the size of writes that Telegraf sends to output plugins.
metric_batch_size = 100
## Maximum number of unwritten metrics per output. Increasing this value
## allows for longer periods of output downtime without dropping metrics at the
## cost of higher maximum memory usage.
metric_buffer_limit = 10000
## Collection jitter is used to jitter the collection by a random amount.
## Each plugin will sleep for a random time within jitter before collecting.
## This can be used to avoid many plugins querying things like sysfs at the
## same time, which can have a measurable effect on the system.
collection_jitter = "0s"
## Default flushing interval for all outputs. Maximum flush_interval will be
## flush_interval + flush_jitter
flush_interval = "10s"
## Jitter the flush interval by a random amount. This is primarily to avoid
## large write spikes for users running a large number of telegraf instances.
## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
flush_jitter = "0s"
## By default or when set to "0s", precision will be set to the same
## timestamp order as the collection interval, with the maximum being 1s.
## ie, when interval = "10s", precision will be "1s"
## when interval = "250ms", precision will be "1ms"
## Precision will NOT be used for service inputs. It is up to each individual
## service input to set the timestamp at the appropriate precision.
## Valid time units are "ns", "us" (or "µs"), "ms", "s".
precision = ""
## Log at debug level.
# debug = false
## Log only error level messages.
# quiet = false
## Log target controls the destination for logs and can be one of "file",
## "stderr" or, on Windows, "eventlog". When set to "file", the output file
## is determined by the "logfile" setting.
# logtarget = "file"
## Name of the file to be logged to when using the "file" logtarget. If set to
## the empty string then logs are written to stderr.
# logfile = ""
## The logfile will be rotated after the time interval specified. When set
## to 0 no time based rotation is performed. Logs are rotated only when
## written to, if there is no log activity rotation may be delayed.
# logfile_rotation_interval = "0d"
## The logfile will be rotated when it becomes larger than the specified
## size. When set to 0 no size based rotation is performed.
# logfile_rotation_max_size = "0MB"
## Maximum number of rotated archives to keep, any older logs are deleted.
## If set to -1, no archives are removed.
# logfile_rotation_max_archives = 5
## Pick a timezone to use when logging or type 'local' for local time.
## Example: America/Chicago
# log_with_timezone = ""
## Override default hostname, if empty use os.Hostname()
hostname = ""
## If set to true, do no set the "host" tag in the telegraf agent.
omit_hostname = false
###############################################################################
# OUTPUT PLUGINS #
###############################################################################
# Configuration for sending metrics to InfluxDB 2.0
[[outputs.influxdb_v2]]
## The URLs of the InfluxDB cluster nodes.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
## ex: urls = ["https://us-west-2-1.aws.cloud2.influxdata.com"]
urls = ["http://influxdb:8086"]
## Token for authentication.
token = "{{ influxdb_token }}"
## Organization is the name of the organization you wish to write to.
organization = "homematic"
## Destination bucket to write into.
bucket = "homematic"
## The value of this tag will be used to determine the bucket. If this
## tag is not set the 'bucket' option is used as the default.
# bucket_tag = ""
## If true, the bucket tag will not be added to the metric.
# exclude_bucket_tag = false
## Timeout for HTTP messages.
# timeout = "5s"
## Additional HTTP headers
# http_headers = {"X-Special-Header" = "Special-Value"}
## HTTP Proxy override, if unset values the standard proxy environment
## variables are consulted to determine which proxy, if any, should be used.
# http_proxy = "http://corporate.proxy:3128"
## HTTP User-Agent
# user_agent = "telegraf"
## Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "gzip"
## Enable or disable uint support for writing uints influxdb 2.0.
# influx_uint_support = false
## Optional TLS Config for use on HTTP connections.
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
###############################################################################
# INPUT PLUGINS #
###############################################################################
# Read metrics from one or many prometheus clients
[[inputs.prometheus]]
## An array of urls to scrape metrics from.
urls = ["http://app:{{ homematic_metrics_port }}/metrics"]
## Metric version controls the mapping from Prometheus metrics into Telegraf metrics.
## See "Metric Format Configuration" in plugins/inputs/prometheus/README.md for details.
## Valid options: 1, 2
# metric_version = 1
## Url tag name (tag containing scrapped url. optional, default is "url")
# url_tag = "url"
## Whether the timestamp of the scraped metrics will be ignored.
## If set to true, the gather time will be used.
# ignore_timestamp = false
......@@ -5,7 +5,7 @@ services:
app:
image: homeassistant/home-assistant:2023.3.3
image: homeassistant/home-assistant:2023.6.1
restart: always
volumes:
- "/etc/localtime:/etc/localtime:ro"
......
......@@ -95,13 +95,6 @@
homematic_callback_port: 8060,
influxdb_port: 38086
}
- {
role: intern/docker_homematic, tags: homematic,
servicename: homematic,
basedir: /srv/homematic,
homematic_metrics_port: 8010,
influxdb_port: 48086
}
- {
role: intern/docker_mqtt, tags: mqtt,
servicename: mqtt,
......@@ -154,6 +147,7 @@
- { role: common/kvm-guest, tags: kvm-guest }
- { role: common/openvpn, tags: openvpn }
- { role: common/prometheus-node, tags: prometheus-node }
- { role: common/wireguard, tags: wireguard }
- {
role: common/docker_dockerstats, tags: dockerstats,
servicename: dockerstats,
......@@ -276,7 +270,6 @@
servicename: traefik,
basedir: /srv/traefik,
domain: "warpzone.ms",
domain_default: "www.warpzone.ms"
}
- {
role: verwaltung/docker_gitea, tags: gitea,
......
......@@ -74,10 +74,10 @@ object Host "wz-ap-werkstatt" {
groups = [ "network" ]
}
object Host "homematic-ccu2" {
object Host "eq3max-cube" {
import "generic-host"
address = "{{ homematic.ccu2_host }}"
address = "{{ eq3max.cube_host }}"
groups = [ "network" ]
}
......@@ -3,7 +3,10 @@
###################################
# Set Version
MAILU_VERSION=2.0.4
MAILU_VERSION=2.0.16
# enable IPv6
SUBNET6=fd00:dead:beef:25::/64
# Autocreate Admin User
INITIAL_ADMIN_ACCOUNT=mailadmin
......@@ -24,9 +27,6 @@ SQLALCHEMY_DATABASE_URI_ROUNDCUBE=mysql://roundcube:{{ roundcube_db_pass }}@db/r
# Common configuration variables
###################################
# Set mailu version
MAILU_VERSION=2.0
# Set to a randomly generated 16 bytes string
SECRET_KEY={{ mailu_secret_key }}
......