Skip to content
Snippets Groups Projects
Commit 1a880c3b authored by void's avatar void
Browse files

delete openhab

parent 42b00beb
No related branches found
No related tags found
No related merge requests found
Showing
with 1 addition and 459 deletions
Subproject commit 900377e4f72486f6699ecf736f96adfbc04e92da Subproject commit e8a049414bca2b14b158444dac1b94c2ca90d9be
---
- include: ../functions/get_secret.yml
with_items:
- { path: "{{ basedir }}/openweathermap_apikey", length: -1 }
- { path: "{{ basedir }}/warpai_status_update_key", length: -1 }
- { path: "{{ basedir }}/influxdb_password", length: 12 }
- { path: "{{ basedir }}/influxdb_token", length: 32 }
- name: pakete installieren
apt:
state: present
name:
- logrotate
- name: openhab LogRotate config erstellen
template:
src: logrotate
dest: /etc/logrotate.d/openhab
- name: "create folder struct for {{ basedir }}"
file:
path: "{{ item }}"
state: "directory"
with_items:
- "{{ basedir }}"
- "{{ basedir }}/addons/"
- "{{ basedir }}/conf/"
- "{{ basedir }}/conf/items/"
- "{{ basedir }}/conf/services/"
- "{{ basedir }}/conf/persistence/"
- "{{ basedir }}/conf/rules/"
- "{{ basedir }}/conf/things/"
- "{{ basedir }}/userdata/"
- "{{ basedir }}/influxdb/"
- name: "copy config files for {{ basedir }}"
template:
src: "{{ item }}"
dest: "{{ basedir }}/{{ item }}"
with_items:
- docker-compose.yml
register: docker_config_files
- name: "copy config files for {{ basedir }} 2"
template:
src: "{{ item }}"
dest: "{{ basedir }}/{{ item }}"
with_items:
- conf/items/groups.items
- conf/items/mqtt.items
- conf/items/network.items
- conf/items/other.items
- conf/items/weather.items
- conf/items/wled.items
- conf/persistence/influxdb.persist
- conf/persistence/rrd4j.persist
- conf/rules/zonestatus.rules
- conf/services/addons.cfg
- conf/services/influxdb.cfg
- conf/services/mqtt.cfg
- conf/services/network.cfg
- conf/services/runtime.cfg
- conf/things/astro.things
- conf/things/mqtt.things
- conf/things/network.things
- conf/things/weather.things
- conf/things/wled.things
- name: stop openhab docker
docker_compose:
project_src: "{{ basedir }}"
state: absent
when: docker_config_files.changed
- name: start openhab docker
docker_compose:
project_src: "{{ basedir }}"
state: present
// Gruppendefinitionen
// ID, Name, Icon, Tag
// Liste der Icons: https://www.openhab.org/docs/configuration/iconsets/classic/
// Liste der Semantic Tags: https://github.com/openhab/openhab-core/blob/main/bundles/org.openhab.core.semantics/model/SemanticTags.csv
Group gFlur "Flur" <corridor> ["Corridor"]
Group gHauptraum "Hauptraum" <settings> ["GuestRoom"]
Group gHolzwerkstatt "Holzwerkstatt" <settings> ["GuestRoom"]
Group gKueche "Küche" <kitchen> ["Kitchen"]
Group gLounge "Lounge" <sofa> ["LivingRoom"]
Group gToilet "Toilette" <toilet> ["Bathroom"]
Group gVortragsraum "Vortragsraum" <screen> ["GuestRoom"]
Number Werkstatt_Licht "Werkstatt Licht [%.0f (0-225)]" <light> (gHauptraum) ["Light"] {
channel="mqtt:topic:mosquitto:werkstattlicht:level"
}
{% for device in esphome_devices %}
{% if device.sensors is defined %}
{% for sensor in device.sensors %}
{% if sensor == "Temp" or sensor == "HeizungVorlauf" or sensor == "HeizungRuecklauf" or sensor == "Kuehlschrank-Temp" %}
Number MQTT_{{ device.id }}_{{ sensor | replace("-","") }} "Sensor {{ device.name }} {{ sensor }} [%.1f °C]" <temperature> ({{ device.groups }}) ["Measurement","Temperature","CurrentTemperature"] {
channel="mqtt:topic:mosquitto:{{ device.id }}:{{ sensor | replace("-","") | lower }}"
}
{% elif sensor == "pressure" %}
Number MQTT_{{ device.id }}_{{ sensor }} "Sensor {{ device.name }} Pressure [%.1f hPa]" <pressure> ({{ device.groups }}) ["Measurement","Pressure"] {
channel="mqtt:topic:mosquitto:{{ device.id }}:{{ sensor }}"
}
{% elif sensor == "humidity" %}
Number MQTT_{{ device.id }}_{{ sensor }} "Sensor {{ device.name }} Humidity [%.1f %%]" <humidity> ({{ device.groups }}) ["Measurement","Humidity","CurrentHumidity"] {
channel="mqtt:topic:mosquitto:{{ device.id }}:{{ sensor }}"
}
{% elif sensor == "feinstaub_2_5" %}
Number MQTT_{{ device.id }}_{{ sensor }} "Sensor {{ device.name }} 2.5 PM [%.1f µg/m³]" ({{ device.groups }}) ["Measurement"] {
channel="mqtt:topic:mosquitto:{{ device.id }}:{{ sensor }}"
}
{% elif sensor == "stromverbrauch" %}
Number MQTT_{{ device.id }}_{{ sensor }} "Sensor {{ device.name }} kW [%.1f kW]" ({{ device.groups }}) ["Measurement"] {
channel="mqtt:topic:mosquitto:{{ device.id }}:{{ sensor }}"
}
{% elif sensor == "Kuehlschrank-Door" or sensor == "warpzone_status" %}
Switch MQTT_{{ device.id }}_{{ sensor | replace("-","") | lower }} "Sensor {{ device.name }} {{ sensor }}" ({{ device.groups }}) {
channel="mqtt:topic:mosquitto:{{ device.id }}:{{ sensor | replace("-","") | lower }}"
}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
// Netzwerkgeräte für Präsenzinformationen
Switch Switch01 "Switch 01" <network> ["Measurement", "Presence"] { channel="network:pingdevice:switch01:online" }
Switch Switch02 "Switch 02" <network> ["Measurement", "Presence"] { channel="network:pingdevice:switch02:online" }
// Sonne über Horizont (positiv) bzw. unter Horizint (negativ)
// Check in Regeln: if(Sun_Elevation.state < 0)
Number Sun_Elevation "Sun Elevation" <sun_clouds> (gAussen) ["Measurement"] {
channel="astro:sun:local:position#elevation"
}
Number:Temperature Weather_OWM_Temperature "Temperature [%.1f %unit%]" <temperature> (gAussen) ["Measurement","Temperature","CurrentTemperature"] {
channel="openweathermap:weather-and-forecast:api:local:current#temperature",
alexa="TemperatureSensor.temperature" [scale="Celsius"]
}
Number:Dimensionless Weather_OWM_Humidity "Humidity [%d %unit%]" <humidity> (gAussen) ["Measurement","Humidity","CurrentHumidity"] {
channel="openweathermap:weather-and-forecast:api:local:current#humidity",
alexa="RangeController.rangeValue" [friendlyNames="@Setting.Humidity", nonControllable=true, supportedRange="0:100:1", unitOfMeasure="Percent"]
}
{% for device in wled_devices %}
Color WLED_{{ device.id }}_Master "WLED {{ device.id }} Master" <colorlight> ({{ device.groups }}) [ "Switch","Light" ] {
channel="wled:wled:{{ device.id }}:masterControls"
}
String WLED_{{ device.id }}_FX "WLED {{ device.id }} Effect" ({{ device.groups }}) [ "Light" ] {
channel="wled:wled:{{ device.id }}:fx"
}
String WLED_{{ device.id }}_Palettes "WLED {{ device.id }} Palettes" ({{ device.groups }}) [ "Light" ] {
channel="wled:wled:{{ device.id }}:palettes"
}
String WLED_{{ device.id }}_Presets "WLED {{ device.id }} Presets" ({{ device.groups }}) [ "Light" ] {
channel="wled:wled:{{ device.id }}:presets"
}
Switch WLED_{{ device.id }}_PresetCycle "WLED {{ device.id }} PresetCycle" ({{ device.groups }}) [ "Light" ] {
channel="wled:wled:{{ device.id }}:presetCycle"
}
{% endfor %}
Strategies {
everyMinute : "0 * * * * ?"
}
Items {
* : strategy = everyChange, everyMinute
}
Strategies {
// for rrd charts, we need a cron strategy
everyMinute : "0 * * * * ?"
}
Items {
// persist items on every change and every minute
* : strategy = everyChange, everyMinute
}
rule "Zonestatus"
when
Item Switch02 received update
then
val topic = "warpzone/door/status"
val message = if (Switch02.state == ON) "OPEN" else "CLOSED"
logInfo("default.rules","Switch02 updated to: " + Switch02.state + " sending: " + message + " to " + topic)
val mqttActions = getActions("mqtt", "mqtt:broker:mosquitto")
mqttActions.publishMQTT(topic, message)
val headers = newHashMap()
val output = sendHttpGetRequest("https://api.warpzone.ms/setstatus?newstatus=" + message + "&update_key={{ warpai_status_update_key }}", headers, 1000)
end
# The base installation package of this openHAB instance
# Note: This is only regarded at the VERY FIRST START of openHAB
# Optional. If not set, the dashboard (https://<yourserver>:8080/) will ask you to choose a package.
#
# Valid options:
# - minimal : Installation only with dashboard, but no UIs or other addons
# - simple : Setup for using openHAB purely through UIs - you need to expect MANY constraints in functionality!
# - standard : Default setup for normal users, best for textual setup
# - expert : Setup for expert users, especially for people migrating from openHAB 1.x
# - demo : A demo setup which includes UIs, a few bindings, config files etc.
#
package = standard
# Access Remote Add-on Repositories
# Defines whether the remote openHAB add-on repository should be used for browsing and installing add-ons.
# This not only makes latest snapshots of add-ons available, it is also required for the installation of
# any legacy 1.x add-on and all experimental features. (default is false for offline distro, true for online distro)
#
remote = true
# A comma-separated list of bindings to install (e.g. "sonos,knx,zwave")
binding = astro,mqtt,network,openweathermap,wled
# A comma-separated list of UIs to install (e.g. "basic,paper")
# ui = habpanel
# A comma-separated list of persistence services to install (e.g. "rrd4j,jpa")
persistence = rrd4j,influxdb
# A comma-separated list of actions to install (e.g. "mail,pushover")
# action = pushover
# A comma-separated list of transformation services to install (e.g. "map,jsonpath")
transformation = map,regex,jsonpath,jinja
# A comma-separated list of voice services to install (e.g. "marytts,freetts")
#voice =
# A comma-separated list of miscellaneous services to install (e.g. "myopenhab")
# misc = openhabcloud
version=V2
url=http://influxdb:8086
user=openhab
token={{ influxdb_token }}
db=openhab
retentionPolicy=openhab
binding.network:allowSystemPings=true
binding.network:allowDHCPlisten=false
binding.network:arpPingToolPath=arping
binding.network:cacheDeviceStateTimeInMS=2000
##################### LOCALE ####################
# The default language that should be used. If not specified, the system default locale is used.
# The ISO 639 alpha-2 or alpha-3 language code (if there is no alpha-2 one).
# Example: "en" (English), "de" (German), "ja" (Japanese), "kok" (Konkani)
#
org.openhab.i18n:language=de
# The region that should be used.
# ISO 3166 alpha-2 country code or UN M.49 numeric-3 area code.
# Example: "US" (United States), "DE" (Germany), "FR" (France), "029" (Caribbean)
#
org.openhab.i18n:region=DE
# Location
org.openhab.i18n:location=51.944514, 7.638933
# Timezone
org.openhab.i18n:timezon=Europe/Berlin
################ PERSISTENCE ####################
# The persistence service to use if no other is specified.
#
org.openhab.persistence:default=rrd4j
################### AUDIO #######################
# This parameter defines the default audio source to use (if not set, the first available one will be used.
#
#org.openhab.audio:defaultSource=
# This parameter defines the default audio sink to use (if not set, the first available one will be used.
#
#org.openhab.audio:defaultSink=
##################### VOICE #####################
# This parameter defines the default text-to-speech service to use (if not set, the first available one will be used.
#
#org.openhab.voice:defaultTTS=
# This parameter defines the default speech-to-text service to use (if not set, the first available one will be used.
#
#org.openhab.voice:defaultSTT=
# The default voice to use if no specific TTS service or voice is specified.
#
#org.openhab.voice:defaultVoice=
# The default human language interpreter to use if no other is specified.
#
#org.openhab.voice:defaultHLI=
################ MISCELLANOUS ###################
# The karaf sshHost parameter configures the bind address for the ssh login to karaf.
# Default is 127.0.0.1 (localhost), so it is only possible to login from the local machine.
#
# Setting this to the address of another network interfaces will allow login from this network.
# Setting this to 0.0.0.0 will allow login from all network interfaces.
#
# !!! Security warning !!!
# Remember to change default login/password, if you allow external login.
# See https://www.openhab.org/docs/administration/console.html for details.
#
#org.apache.karaf.shell:sshHost = 0.0.0.0
# Setting this to true will automatically approve all inbox entries and create Things for them,
# so that they are immediately available in the system (default is false)
#
#org.openhab.inbox:autoApprove=true
# Cross-origin resource sharing (CORS) is a browser security feature that restricts cross-origin
# HTTP requests that are initiated from scripts running in the browser. Setting this option to 'true'
# will disable the browser cross-origin check. This is required if you want to use a web UI that is not
# hosted on the openHAB server domain.
#org.openhab.cors:enable=true
# This parameter defines how the members of a group are sorted in UIs rendering sitemaps.
# 3 values are accepted:
# - NONE: no sorting (this is the default)
# - LABEL: sorted by label
# - NAME: sorted by name
#org.openhab.sitemap:groupMembersSorting=NONE
################ REST API ###################
# Allow the use of Basic authentication to access protected API resources, in addition to access tokens and API tokens
#
#org.openhab.restauth:allowBasicAuth=true
# When basic authentication is activated, credentials are put in a cache in order to speed up request
# authorization. The entries in the cache expire after a while in order to not keep credentials in memory indefinitely.
# This value defines the expiration time in hours. Set it to 0 for disabling the cache.
#
#org.openhab.restauth:cacheExpiration=6
# By default, operations requiring the "user" role are available when unauthenticated.
# Disabling this option will enforce authorization for these operations.
# Warning: This causes clients that do not support authentication to break.
#
#org.openhab.restauth:implicitUserRole=false
astro:sun:home [ geolocation="51.944514, 7.638933", interval=60 ]
Bridge mqtt:broker:mosquitto [ host="{{ int_ip4 }}", secure=false, enableDiscovery=false, qos=1, retain=true, async=false ]
{
Thing topic werkstattlicht "Werkstatt Licht (dali)" {
Channels:
Type number : level "Werkstatt Licht (dali)" [ stateTopic="light/dali", commandTopic="light/dali", postCommand=true, min=0, max=255 ]
}
{% for device in esphome_devices %}
Thing topic {{ device.id }} "Sensor {{ device.name }}" {
{% if device.sensors is defined %}
Channels:
{% for sensor in device.sensors %}
{% if sensor == "Temp" or sensor == "HeizungVorlauf" or sensor == "HeizungRuecklauf" or sensor == "Kuehlschrank-Temp" %}
Type number : {{ sensor | replace("-","") | lower }} "Sensor {{ device.name }} {{ sensor }}" [ stateTopic="ESPHome/esphome_{{ device.id }}/sensor/{{ sensor | lower }}/state" ]
{% elif sensor == "pressure" %}
Type number : {{ sensor }} "Sensor {{ device.name }} Pressure" [ stateTopic="ESPHome/esphome_{{ device.id }}/sensor/{{ sensor }}/state" ]
{% elif sensor == "humidity" %}
Type number : {{ sensor }} "Sensor {{ device.name }} Humidity" [ stateTopic="ESPHome/esphome_{{ device.id }}/sensor/{{ sensor }}/state" ]
{% elif sensor == "feinstaub_2_5" %}
Type number : {{ sensor }} "Sensor {{ device.name }} 2.5 PM" [ stateTopic="ESPHome/esphome_{{ device.id }}/sensor/{{ sensor }}/state" ]
{% elif sensor == "stromverbrauch" %}
Type number : {{ sensor }} "Sensor {{ device.name }} kW" [ stateTopic="ESPHome/esphome_{{ device.id }}/sensor/{{ sensor }}/state" ]
{% elif sensor == "Kuehlschrank-Door" or sensor == "warpzone_status" %}
Type switch : {{ sensor | replace("-","") | lower }} "Sensor {{ device.name }} {{ sensor }}" [ stateTopic="ESPHome/esphome_{{ device.id }}/binary_sensor/{{ sensor | lower }}/state", on="ON", off="OFF" ]
{% endif %}
{% endfor %}
{% endif %}
}
{% endfor %}
}
// Netzwerk Geräte
network:pingdevice:switch01 [ hostname="TL-SG3428XMP", retry=3, timeout=5000, refreshInterval=10000, uses_arp_ping="no" ]
network:pingdevice:switch02 [ hostname="TL-SG3452X", retry=3, timeout=5000, refreshInterval=10000, uses_arp_ping="no" ]
Bridge openweathermap:weather-api:api "OpenWeatherMap" [apikey="{{ openweathermap_apikey }}", refreshInterval=15, language="de"] {
Thing weather-and-forecast local "Local Weather And Forecast" [location="51.944514, 7.638933", forecastHours=0, forecastDays=7]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment