Browse Source

openHAB-configfiles added

master
Torsten Stauder 5 years ago
parent
commit
a69618555b
  1. 6
      README.md
  2. 17
      openHAB/README.md
  3. 21
      openHAB/items/Home.items
  4. 36
      openHAB/sitemaps/Home.sitemap
  5. 18
      openHAB/things/mqttConntections.things
  6. 11
      openHAB/transform/playmodes.map

6
README.md

@ -177,7 +177,11 @@ This mode is different from the other ones because the last playposition is save
* playlist is over (playposition is set back to the first track and file-position 0)
### Webinterface-configuration
Todo; currently under development. Will make it possible to assign actions/files/folders to RFID-tags and configure some things.
After having Tonuino running on your ESP32 in your local WiFi, the webinterface-configuration is accessable. Using this GUI you can configure:
* Link between RFID-tag and corresponding action
* MQTT-configuration (broker's IP)
* FTP-configuration (username and password)
* General-configuration (volume, neopixel-brightness, sleep after inactivity)
### FTP (optional)
In order to avoid exposing uSD-card or disassembling the Tonuino all the time for adding new music, it's possible to transfer music onto the uSD-card using FTP. Please make sure to set the max. number of parallel connections to ONE in your FTP-client. My recommendation is [Filezilla](https://filezilla-project.org/). But don't expect fast transfer, it's only around 145 kB/s and decreases dramatically, if music is played in parallel. Better stop playback then doing a FTP-transfer. Default-user and password are set via `ftpUser` and `ftpPassword`.

17
openHAB/README.md

@ -0,0 +1,17 @@
# OpenHAB-integration for Tonuino
## Disclaimer
[OpenHAB](https://www.openhab.org/) is a pretty complex software for home automation. I Just extracted that parts of my local config, that's necessary for Tonuino. Hopefully I didn't forget anything :-) Said this I want to rule out that this document's aim isn't to provide a fully-featured howto. For further informations please have a look at the project's [documentation](https://www.openhab.org/docs/).
## What's necessary
In order to make use of my config-files you need to have a running openHAB-installation. Mine is running on the Raspberry Pi. In general there are two ways to achieve this:
* [Raspbian with manual openHAB-installation](https://www.openhab.org/docs/installation/rasppi.html)
* [openHABian](https://www.openhab.org/docs/installation/openhabian.html)
After completing the installation, [PaperUI](http://<ip>:8080/paperui/index.html) should be browsable. In order to get Tonuino running you need at least the MQTT-binding (Add-ons -> Bindings) and the Map-transformation (Add-ons -> transformations).
Beside of openHAB you need a MQTT-broker. You can use a public one but if there's already a Raspberry Pi running with openHAB, it probably makes sense to install [Mosquitto](https://mosquitto.org/) as MQTT-broker in parallel.
## MQTT
After MQTT-broker is set up have look at mqttConnections.things in order to configure the MQTTT-connection between openHAB and the broker. In doubt restart openHAB as changes sometimes don't get recognized immediately without restart. If nothing happens have a look at the logfiles /var/log/openhab2/openhab.log or /var/log/openhab2/events.log. In general, to debug MQTT-stuff, [MQTT fx](https://mqttfx.jensd.de/) is a good tool to refer.
## Important
In openHAB it's your choice to make use of configuration via Paper UI or textfiles. Sounds basically good but in fact it's not, because mixing up both can be really crappy and painstaking to debug. Make sure to only use one way.

21
openHAB/items/Home.items

@ -0,0 +1,21 @@
// Gruppen
Group Daheim
// OG
Group Obergeschoss "Obergeschoss" <firstfloor> (Daheim)
Group ZimmerTim "Kinderzimmer Tim" <boy_2> (Obergeschoss)
// Zimmer Kind
Switch Tonuino_Sleep { channel="mqtt:topic:MQTT:tonuino:tonuino_sleep_mqtt", autoupdate="true" }
String Tonuino_Track { channel="mqtt:topic:MQTT:tonuino:tonuino_track_mqtt", autoupdate="true" }
Number Tonuino_Loudness "Lautstärke [%d]" { channel="mqtt:topic:MQTT:tonuino:tonuino_loudness_mqtt", autoupdate="true" }
String Tonuino_SleepTimer { channel="mqtt:topic:MQTT:tonuino:tonuino_sleeptimer_mqtt", autoupdate="true" }
String Tonuino_Status { channel="mqtt:topic:MQTT:tonuino:tonuino_status_mqtt", autoupdate="true", expire="2m, command=Offline" }
String Tonuino_CurrentTrack "Aktueller Track" { channel="mqtt:topic:MQTT:tonuino:tonuino_current_track_mqtt", autoupdate="true" }
String Tonuino_TrackControl "Track-Control" { channel="mqtt:topic:MQTT:tonuino:tonuino_track_control_mqtt", autoupdate="false" }
String Tonuino_IPv4 "IPv4-Adresse" { channel="mqtt:topic:MQTT:tonuino:tonuino_ipv4_mqtt", autoupdate="true" }
Switch Tonuino_LockControls "Bedienung sperren" { channel="mqtt:topic:MQTT:tonuino:tonuino_lock_controls_mqtt", autoupdate="true" }
Number Tonuino_Playmode "Aktueller Playmode [MAP(playmodes.map):%d]" { channel="mqtt:topic:MQTT:tonuino:tonuino_playmode_mqtt", autoupdate="true" }
Number Tonuino_LedBrightness "Helligkeit LEDs" { channel="mqtt:topic:MQTT:tonuino:tonuino_led_brightness_mqtt", autoupdate="true" }
DateTime Tonuino_LastUpdate "Letztes Update [%1$ta %1$tR]" <time>
Number Tonuino_Repeatmode "Wiederholung" { channel="mqtt:topic:MQTT:tonuino:tonuino_led_repeatmode_mqtt", autoupdate="true" }

36
openHAB/sitemaps/Home.sitemap

@ -0,0 +1,36 @@
sitemap Home label="Home" {
Frame label="Huette" {
Text label="Obergeschoss" icon="firstfloor" {
Text label="Zimmer Kind" icon="boy_2" {
Text label="Tonuino" icon="receiver" {
Text item=Tonuino_Status label="Status" valuecolor=[Tonuino_Status==Online="green", ==Offline="red"] icon="network"
Switch item=Tonuino_Sleep label="Ausschalten" icon="wallswitch" mappings=[OFF="AUS"] visibility=[Tonuino_Status=="Online"]
Switch item=Tonuino_LockControls label="Sperren" icon="wallswitch" mappings=[OFF="AUS", ON="AN"] visibility=[Tonuino_Status=="Online"]
Selection item=Tonuino_Track label="Titelauswahl" icon="text" visibility=[Tonuino_Status=="Online"] mappings=[
"244189084042"="Yakari und die Pferdediebe",
"244042007042"="Yakari - Der Gesang des Raben",
"004134024043"="Yakari - Schneeball in Gefahr",
"212130160042"="Yakari-Sammlung 2",
"020073020043"="Yakari-Sammlung 1",
"176063100050"="Yakari - Best of Lagerfeuergeschichten",
"160243107050"="Dingi und der Containerdieb",
"242216118051"="Weihnachten mit A. Lindgren",
"176008145050"="Janosch - Oh wie schoen ist Panama",
"036073235043"="Paw Patrol rettet Weihnachten",
"215123125075"="Kinderlieder",
"182146124043"="Ibiza Global Radio"
]
Setpoint item=Tonuino_Loudness icon="soundvolume" minValue=0 maxValue=21 step=1 label="Lautstärke [%d/21]" visibility=[Tonuino_Status=="Online"]
Selection item=Tonuino_SleepTimer label="Ausschalten in..." icon="time" visibility=[Tonuino_Status=="Online"] mappings=[0="Nicht gesetzt", 1="1 Minute", 5="5 Minuten", 10="10 Minuten", 30="30 Minuten", 45="45 Minuten", 60="1 Stunde", 120="2 Stunden", EOT="Ende des Titels", EOP="Ende der Playlist", EO5T="Nach fünf Titeln"]
Switch item=Tonuino_TrackControl label="Steuerung" mappings=["6"="⏮", "5"="⏪", "3"="⏸", "4"="⏩", "7"="⏭"] visibility=[Tonuino_Status=="Online" ] icon="movecontrol"
Switch item=Tonuino_Repeatmode label="Wiederholung" mappings=["0"="Nein", "1"="Titel", "2"="Playlist", "3"="Titel+Playlist"] visibility=[Tonuino_Status=="Online" ] icon="mediacontrol"
Text item=Tonuino_LastUpdate label="Letztes Update" visibility=[Tonuino_Status=="Online"]
Text item=Tonuino_Playmode label="Modus" icon="mediacontrol" visibility=[Tonuino_Status=="Online"]
Setpoint item=Tonuino_LedBrightness icon="lightbulb" label="LED-Helligkeit" visibility=[Tonuino_Status=="Online"] maxValue=64 step=2
Text item=Tonuino_IPv4 label="IP-Adresse" icon="network" visibility=[Tonuino_Status=="Online"]
Text item=Tonuino_CurrentTrack label="Aktuell:" icon="mediacontrol" visibility=[Tonuino_Status=="Online"]
}
}
}
}
}

18
openHAB/things/mqttConntections.things

@ -0,0 +1,18 @@
Bridge mqtt:broker:MQTT [ host="<mqttServerIP>", secure=false, username="<username>", password="<password>", clientID="openHAB2", retain=false ] {
Thing topic tonuino "Tonuino" {
Channels:
Type switch: tonuino_sleep_mqtt "Ausschalten" [ stateTopic="State/Tonuino/Sleep", commandTopic="Cmnd/Tonuino/Sleep", on="ON", off="OFF" ]
Type string: tonuino_track_mqtt "Track" [ stateTopic="State/Tonuino/Track", commandTopic="Cmnd/Tonuino/Track" ]
Type number: tonuino_loudness_mqtt "Lautstaerke" [ stateTopic="State/Tonuino/Loudness", commandTopic="Cmnd/Tonuino/Loudness" ]
Type string: tonuino_sleeptimer_mqtt "Sleep-Timer" [ stateTopic="State/Tonuino/SleepTimer", commandTopic="Cmnd/Tonuino/SleepTimer" ]
Type string: tonuino_status_mqtt "Status" [ stateTopic="State/Tonuino/State" ]
Type string: tonuino_current_track_mqtt "Aktueller Track" [ stateTopic="State/Tonuino/Track" ]
Type string: tonuino_track_control_mqtt "Track-Control" [ stateTopic="State/Tonuino/TrackControl", commandTopic="Cmnd/Tonuino/TrackControl" ]
Type string: tonuino_ipv4_mqtt "IPv4-Adresse" [ stateTopic="State/Tonuino/IPv4" ]
Type switch: tonuino_lock_controls_mqtt "Bedienung sperren" [ stateTopic="State/Tonuino/LockControls", commandTopic="Cmnd/Tonuino/LockControls", on="ON", off="OFF" ]
Type number: tonuino_playmode_mqtt "Aktueller Playmode" [ stateTopic="State/Tonuino/Playmode", commandTopic="Cmnd/Tonuino/Playmode" ]
Type number: tonuino_led_brightness_mqtt "Aktuelle LED-Helligkeit" [ stateTopic="State/Tonuino/LedBrightness", commandTopic="Cmnd/Tonuino/LedBrightness" ]
Type number: tonuino_led_repeatmode_mqtt "Aktueller Wiederholungsmodus" [ stateTopic="State/Tonuino/RepeatMode", commandTopic="Cmnd/Tonuino/RepeatMode" ]
}
}

11
openHAB/transform/playmodes.map

@ -0,0 +1,11 @@
0=Keine Playlist
1=Einzelner Titel
2=Einzelner Titel (Loop)
3=Hörbuch
4=Hörbuch (Loop)
5=Playlist sortiert
6=Playlist zufällig
7=Playlist sortiert (Loop)
9=Playlist zufällig (Loop)
8=Webradio
10=Beschäftigt
Loading…
Cancel
Save