openHAB2 und MQTT 2.4
- netZr0t
- Beiträge: 56
- Registriert: 9. Jan 2018 10:22
Re: openHAB2 und MQTT 2.4
... Frage bezüglich mqtt2 und Homie Convention
https://homieiot.github.io/
Heißt das, dass wenn ich im tasmota den topic homie/sonoff_s01 nenne, er in Zukunft ggf. vom Openhab paperui als Thing erkannt wird?
Gesendet von meinem MI 6 mit Tapatalk
https://homieiot.github.io/
Heißt das, dass wenn ich im tasmota den topic homie/sonoff_s01 nenne, er in Zukunft ggf. vom Openhab paperui als Thing erkannt wird?
Gesendet von meinem MI 6 mit Tapatalk
- netZr0t
- Beiträge: 56
- Registriert: 9. Jan 2018 10:22
Re: openHAB2 und MQTT 2.4
Hi, ich habe es nochnicht gemacht. Aber werde mich hieran orientieren:madmike hat geschrieben:Hallo netZrüT,
Hast du mal ein Beispiel wie dein Thing bzw Item aussieht ??
LG
Micha
https://community.openhab.org/t/using-s ... ding/59969
Er hat wirklich für so ziemlich alles im Sonnoff einen Channel definiert.
Ich werde erst Mal nur den Schalter machen
Code: Alles auswählen
Bridge mqtt:broker:MosquittoMqttBroker "Mosquitto MQTT Broker" @ "MQTT" [ host="x.x.x.x", secure=false, port=1883, qos=0, retain=false, clientid="Oh2Mqtt2Thing", //certificate="", //certificatepin=false, //publickey="", //publickeypin=false, keep_alive_time=30000, reconnect_time=60000, //lastwill_message="", //lastwill_qos=1, //lastwill_topic="", username="mymqttuser", password="mymqttpass" ] { // Sonoff Power Switch 01 Thing mqtt:topic:SonoffPs01 "Sonoff Power Switch 01" @ "MQTT"
{
Channels:
Type switch : switch "Power Switch" [ stateTopic="tasmota/sonoff-ps01/POWER", commandTopic="tasmota/sonoff-ps01/cmnd/POWER",
//retained=false, //postCommand="", //transformationPattern="JSONPATH:$.POWER", //formatBeforePublish="%s", on="ON", off="OFF" ]
Type string : state01 "Switch State 01" [ stateTopic="tasmota/sonoff-ps01/STATE", transformationPattern="JSONPATH:$.POWER", on="ON", off="OFF" ] Type string : state02 "Switch State 02" [ stateTopic="stat/sonoff-ps01/POWER", on="ON", off="OFF" ]
Type string : state03 "Switch State 03" [ stateTopic="stat/sonoff-ps01/RESULT", transformationPattern="JSONPATH:$.POWER", on="ON", off="OFF" ] Type number : vcc "VCC" [ stateTopic="tasmota/sonoff-ps01/STATE", transformationPattern="JSONPATH:$.Vcc" ]
Type string : wifi-ap "Wifi AP" [ stateTopic="tasmota/sonoff-ps01/STATE", transformationPattern="JSONPATH:$.Wifi.AP" ]
Type string : wifi-ssid "Wifi SSID" [ stateTopic="tasmota/sonoff-ps01/STATE", transformationPattern="JSONPATH:$.Wifi.SSId" ]
Type string : wifi-channel "Wifi Channel" [ stateTopic="tasmota/sonoff-ps01/STATE", transformationPattern="JSONPATH:$.Wifi.Channel" ]
Type string : wifi-rssi "Wifi RSSI" [ stateTopic="tasmota/sonoff-ps01/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI" ]
Type string : uptime "Uptime" [ stateTopic="tasmota/sonoff-ps01/STATE", transformationPattern="JSONPATH:$.Uptime" ]
Type string : time "Time" [ stateTopic="tasmota/sonoff-ps01/STATE", transformationPattern="JSONPATH:$.Time" ]
Type string : devicestate "Device State" [ stateTopic="tasmota/sonoff-ps01/LWT" ]
}
// Sonoff Power Switch 02 Thing mqtt:topic:SonoffPs02 "Sonoff
Power Switch 02" @ "MQTT" { Channels: Type switch : switch "Power Switch" [ stateTopic="tasmota/sonoff-ps02/POWER", commandTopic="tasmota/sonoff-ps02/cmnd/POWER", //retained=false, //postCommand="", //transformationPattern="JSONPATH:$.POWER", //formatBeforePublish="%s", on="ON", off="OFF" ]
Type string : state02 "Switch State 02" [ stateTopic="tasmota/sonoff-ps02/STATE", transformationPattern="JSONPATH:$.POWER", on="ON", off="OFF" ] Type string : state02 "Switch State 02" [ stateTopic="stat/sonoff-ps02/POWER", on="ON", off="OFF" ]
Type string : state03 "Switch State 03" [ stateTopic="stat/sonoff-ps02/RESULT", transformationPattern="JSONPATH:$.POWER", on="ON", off="OFF" ] Type number : vcc "VCC" [ stateTopic="tasmota/sonoff-ps02/STATE", transformationPattern="JSONPATH:$.Vcc" ]
Type string : wifi-ap "Wifi AP" [ stateTopic="tasmota/sonoff-ps02/STATE", transformationPattern="JSONPATH:$.Wifi.AP" ]
Type string : wifi-ssid "Wifi SSID" [ stateTopic="tasmota/sonoff-ps02/STATE", transformationPattern="JSONPATH:$.Wifi.SSId" ]
Type string : wifi-channel "Wifi Channel" [ stateTopic="tasmota/sonoff-ps02/STATE", transformationPattern="JSONPATH:$.Wifi.Channel" ]
Type string : wifi-rssi "Wifi RSSI" [ stateTopic="tasmota/sonoff-ps02/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI" ]
Type string : uptime "Uptime" [ stateTopic="tasmota/sonoff-ps02/STATE", transformationPattern="JSONPATH:$.Uptime" ] Type string : time "Time" [ stateTopic="tasmota/sonoff-ps02/STATE", transformationPattern="JSONPATH:$.Time" ]
Type string : devicestate "Device State" [ stateTopic="tasmota/sonoff-ps02/LWT" ]
}
}
-
- Beiträge: 278
- Registriert: 15. Apr 2018 17:09
Re: openHAB2 und MQTT 2.4
Was ich nicht ganz verstehe ist die erste Zeile in Anführungszeichen setzt du doch deine Bezeichnung für den Broker was ist dann das @ MQTT ??
-
- Beiträge: 278
- Registriert: 15. Apr 2018 17:09
Re: openHAB2 und MQTT 2.4
und muss ich nun das Binding setzen oder nicht ??? alles rätselhaft war irgendwie vorher einfacher.
- netZr0t
- Beiträge: 56
- Registriert: 9. Jan 2018 10:22
Re: openHAB2 und MQTT 2.4
ja das binding musst du installieren. was das @ "MQTT" bedeutet weiss ich nicht. *EDIT* das ist der String, der in der UI unter Location auftaucht
Ich habe jetzt mal den ganzen thing part übernommen und nur im broker Abschnitt meine Daten eingetragen. Der Broker ist jetzt in der PaperUI online sichtbar.

mache jetzt mal mit einem sonoff thing weiter
Ich habe jetzt mal den ganzen thing part übernommen und nur im broker Abschnitt meine Daten eingetragen. Der Broker ist jetzt in der PaperUI online sichtbar.

mache jetzt mal mit einem sonoff thing weiter
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Zuletzt geändert von netZr0t am 19. Dez 2018 15:58, insgesamt 1-mal geändert.
-
- Beiträge: 278
- Registriert: 15. Apr 2018 17:09
Re: openHAB2 und MQTT 2.4
ok ich bin gespannt
- netZr0t
- Beiträge: 56
- Registriert: 9. Jan 2018 10:22
Re: openHAB2 und MQTT 2.4
Code: Alles auswählen
Bridge mqtt:broker:mosquitto "Mosquitto MQTT Broker" @ "MQTT" [
host="192.168.178.xx",
secure=false,
port=1883,
qos=0,
retain=false,
clientid="Oh2Mqtt2Thing",
//certificate="",
//certificatepin=false,
//publickey="",
//publickeypin=false,
keep_alive_time=30000,
reconnect_time=60000,
//lastwill_message="",
//lastwill_qos=1,
//lastwill_topic="",
username="xxxxxxxx",
password="xxxxxxxx"
]
{
// Sonoff sonoff_s04 mehrfachstecker s04
Thing mqtt:topic:sonoff_s04 "Mehrfachstecker Sonoffbasic_s04" @ "MQTT" {
Channels:
Type switch : switch "Power Switch" [
stateTopic="homie/sonoff_s04/POWER",
commandTopic="homie/sonoff_s04/cmnd/POWER",
//retained=false,
//postCommand="",
//transformationPattern="JSONPATH:$.POWER",
//formatBeforePublish="%s",
on="ON",
off="OFF"
]
Type string : state01 "Switch State 01" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.POWER",
on="ON",
off="OFF"
]
Type string : state02 "Switch State 02" [
stateTopic="homie/sonoff_s04/POWER",
on="ON",
off="OFF"
]
Type string : state03 "Switch State 03" [
stateTopic="homie/sonoff_s04/RESULT",
transformationPattern="JSONPATH:$.POWER",
on="ON",
off="OFF"
]
Type number : vcc "VCC" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.Vcc"
]
Type string : wifi-ap "Wifi AP" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.Wifi.AP"
]
Type string : wifi-ssid "Wifi SSID" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.Wifi.SSId"
]
Type string : wifi-channel "Wifi Channel" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.Wifi.Channel"
]
Type string : wifi-rssi "Wifi RSSI" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.Wifi.RSSI"
]
Type string : uptime "Uptime" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.Uptime"
]
Type string : time "Time" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.Time"
]
Type string : devicestate "Device State" [
stateTopic="homie/sonoff_s04/LWT"
]
}
}
Ich habe festgestellt, dass die beste Methode ist Änderungen wirksam zu bekommen ist erstmal im xxx.things // vor die Bridge zu schreiben, kurz zu sichern, im PAperUI checken, dass keine Things vorhanden sind, falls doch loeschen ... anschliessend die beiden // wieder wegmachen um die Things aus dem file scharfzuschalten. Teilweise bekommt man sonst die schalter things nicht online.
so sieht das item aus:
Code: Alles auswählen
Switch mehrfachstecker_Switch "SPS01 Switch" <light> (SonoffPowerSwitches_Basic) { channel="mqtt:topic:sonoff_s04:switch" }
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
-
- Beiträge: 278
- Registriert: 15. Apr 2018 17:09
Re: openHAB2 und MQTT 2.4
Hört sich spannend an, werde ich gleich mal selbst probieren. Das sind deine Einträge als Thing und Item und dem Thing Sonoff mußt du dann den Broker voranstellen habe ich das richtig verstanden ??
Ergo kommt die Frage auf muss ich nun jeden Schalter als Thing anlegen, oder kann ich den Broker voran schreibend alle Sonoffs so in ein Thing schreiben. Zum anderen siehst du nun auch die Rückmeldung ob das Item geschaltet hat?
Ergo kommt die Frage auf muss ich nun jeden Schalter als Thing anlegen, oder kann ich den Broker voran schreibend alle Sonoffs so in ein Thing schreiben. Zum anderen siehst du nun auch die Rückmeldung ob das Item geschaltet hat?
- netZr0t
- Beiträge: 56
- Registriert: 9. Jan 2018 10:22
Re: openHAB2 und MQTT 2.4
so sieht die thing.thing struktur aus :
Bridge [ ] // das ist der link zum mosquitto broker
{
Thing { } //das ist ein sonoff
Thing { } //das ist ein sonoff
}
und ja die sonoffs schalten
du musst fuer jeden sonoff ein Thing schreiben (ist ja schnell kopiert , du musst ja nicht wie im Beispiel alle Channels "bereitstellen". i.d.R. reicht ja der switch kanal
z.b. so:
Bridge [ ] // das ist der link zum mosquitto broker
{
Thing { } //das ist ein sonoff
Thing { } //das ist ein sonoff
}
und ja die sonoffs schalten
du musst fuer jeden sonoff ein Thing schreiben (ist ja schnell kopiert , du musst ja nicht wie im Beispiel alle Channels "bereitstellen". i.d.R. reicht ja der switch kanal
z.b. so:
Code: Alles auswählen
Thing mqtt:topic:sonoff_s04 "Mehrfachstecker Sonoffbasic_s04" @ "MQTT" {
Channels:
Type switch : switch "Power Switch" [
stateTopic="homie/sonoff_s04/POWER",
commandTopic="homie/sonoff_s04/cmnd/POWER",
on="ON",
off="OFF"
]
Type string : state01 "Switch State 01" [
stateTopic="homie/sonoff_s04/STATE",
transformationPattern="JSONPATH:$.POWER",
on="ON",
off="OFF"
}
-
- Beiträge: 278
- Registriert: 15. Apr 2018 17:09
Re: openHAB2 und MQTT 2.4
He super ich werde es gleich malprobieren danke für Deine Unterstützung
mfg
Micha
mfg
Micha