Skip to content
Snippets Groups Projects
Commit e6ee0e1f authored by Christian Elberfeld's avatar Christian Elberfeld
Browse files

Grundlegende Openhab Instanz auf warpsrvint

parent 99c37310
No related branches found
No related tags found
No related merge requests found
Showing
with 333 additions and 0 deletions
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
- { role: warpsrvint/docker_matestatdb, tags: matestatdb } - { role: warpsrvint/docker_matestatdb, tags: matestatdb }
- { role: warpsrvint/docker_mqtt, tags: mqtt } - { role: warpsrvint/docker_mqtt, tags: mqtt }
- { role: warpsrvint/docker_nodered, tags: nodered } - { role: warpsrvint/docker_nodered, tags: nodered }
- { role: warpsrvint/docker_openhab, tags: openhab }
- { role: warpsrvint/docker_unifi, tags: unifi } - { role: warpsrvint/docker_unifi, tags: unifi }
- { role: warpsrvint/docker_warpinfra, tags: warpinfra } - { role: warpsrvint/docker_warpinfra, tags: warpinfra }
......
---
- include: ../functions/get_secret.yml
with_items:
- { path: /srv/openhab/openweathermap_apikey, length: -1 }
- { path: /srv/openhab/influxdb_password, length: 1 }
- name: pakete installieren
apt:
state: present
name:
- logrotate
- name: openhab LogRotate config erstellen
template:
src: logrotate
dest: /etc/logrotate.d/openhab
- name: Get a timestamp
command: "date +%Y%m%d%H%M%S"
register: timestamp
- name: create folder struct for openhab
file:
path: "{{ item }}"
state: "directory"
with_items:
- /srv/openhab/
- /srv/openhab/addons/
- /srv/openhab/conf/
- /srv/openhab/conf/items/
- /srv/openhab/conf/services/
- /srv/openhab/conf/persistence/
- /srv/openhab/conf/rules/
- /srv/openhab/conf/things/
- /srv/openhab/userdata/
- /srv/openhab/influxdb-data/
- /srv/openhab/influxdb-conf/
- name: Docker-Konfig-Dateien erstellen
template:
src: "{{ item }}"
dest: "/srv/openhab/{{ item }}"
with_items:
- docker-compose.yml
register: docker_config_files
- name: Openhab-Konfig-Dateien erstellen
template:
src: "{{ item }}"
dest: "/srv/openhab/{{ item }}"
with_items:
- conf/items/groups.items
- conf/items/network.items
- conf/items/other.items
- conf/items/weather.items
- conf/persistence/influxdb.persist
- conf/persistence/rrd4j.persist
- conf/services/addons.cfg
- conf/services/influxdb.cfg
- conf/services/network.cfg
- conf/services/runtime.cfg
- conf/things/astro.things
- conf/things/network.things
- conf/things/weather.things
- name: stop openhab docker
docker_compose:
project_src: /srv/openhab/
state: absent
when: docker_config_files.changed
- name: start openhab docker
docker_compose:
project_src: /srv/openhab/
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 gEWerkstatt "EWerkstatt" <settings> ["GuestRoom"]
Group gFlur "Flur" <corridor> ["Corridor"]
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"]
// 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"]
}
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
}
# 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
# 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 = influxdb,rrd4j
# 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
url=http://influxdb:8086
user=openhab
password={{ influxdb_password }}
db=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.eclipse.smarthome.core.localeprovider: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.eclipse.smarthome.core.localeprovider:region=DE
# Location
org.eclipse.smarthome.core.i18nprovider:location=51.944514, 7.638933
# Timezone
org.eclipse.smarthome.core.i18nprovider:timezone=Europe/Berlin
################ PERSISTENCE ####################
# The persistence service to use if no other is specified.
#
org.eclipse.smarthome.persistence:default=influxdb
################### AUDIO #######################
# This parameter defines the default audio source to use (if not set, the first available one will be used.
#
#org.eclipse.smarthome.audio:defaultSource=
# This parameter defines the default audio sink to use (if not set, the first available one will be used.
#
#org.eclipse.smarthome.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.eclipse.smarthome.voice:defaultTTS=
# This parameter defines the default speech-to-text service to use (if not set, the first available one will be used.
#
#org.eclipse.smarthome.voice:defaultSTT=
# The default voice to use if no specific TTS service or voice is specified.
#
#org.eclipse.smarthome.voice:defaultVoice=
# The default human language interpreter to use if no other is specified.
#
#org.eclipse.smarthome.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.eclipse.smarthome.inbox:autoApprove=true
# This setting allows to switch between a "simple" and an "advanced" mode for item management.
# In simple mode (autoLinks=true), links and their according items are automatically created for new Things.
# In advanced mode (autoLinks=false), the user has the full control about which items channels are linked to.
# Existing links will remain untouched. (default is true)
#
org.eclipse.smarthome.links:autoLinks=false
astro:sun:home [ geolocation="51.944514, 7.638933", interval=60 ]
// Netzwerk Geräte
network:pingdevice:switch01 [ hostname="192.168.0.100", retry=1, timeout=5000, refreshInterval=10000, uses_arp_ping="yes" ]
network:pingdevice:switch02 [ hostname="192.168.0.101", retry=1, timeout=5000, refreshInterval=10000, uses_arp_ping="yes" ]
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]
}
version: "3"
services:
app:
image: openhab/openhab:3.1.0-debian
restart: always
privileged: true
network_mode: host
cap_add:
- NET_ADMIN
- NET_RAW
# The command node is very important. It overrides
# the "gosu openhab tini -s ./start.sh" command from Dockerfile and runs as root!
command: "tini -s ./start.sh server"
volumes:
- /boot/cmdline.txt:/boot/cmdline.txt:ro
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- /srv/openhab/addons:/openhab/addons
- /srv/openhab/conf:/openhab/conf
- /srv/openhab/userdata:/openhab/userdata
environment:
OPENHAB_HTTP_PORT: 8081
OPENHAB_HTTPS_PORT: 8444
EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"
influxdb:
image: influxdb:2.0.8
restart: always
ports:
- {{ int_ip4 }}:18086:8086
volumes:
- /srv/openhab/influxdb-data:/var/lib/influxdb2
- /srv/openhab/influxdb-conf:/etc/influxdb2
environment:
DOCKER_INFLUXDB_INIT_USERNAME: openhab
DOCKER_INFLUXDB_INIT_PASSWORD: {{ influxdb_password }}
DOCKER_INFLUXDB_INIT_ORG: openhab
DOCKER_INFLUXDB_INIT_BUCKET: openhab
/srv/openhab/userdata/logs/*.log {
rotate 12
monthly
compress
missingok
notifempty
}
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