Mehrere Items greifen auf ein Thing zu

Einrichtung der openHAB Umgebung und allgemeine Konfigurationsthemen.

Moderatoren: seppy, udo1toni

Antworten
julianpe
Beiträge: 39
Registriert: 28. Sep 2020 11:38

Mehrere Items greifen auf ein Thing zu

Beitrag von julianpe »

Hallo zusammen,

ich habe in Openhab nun eine MQTT Verbindung für meine unterschiedlichen Tasmota Geräte eingerichtet.
Aktuell möchte ich zwei Tasmota Geräte (Kaffeemaschine und Spitzboden) einbinden.

mqtt.things

Code: Alles auswählen

Bridge mqtt:broker:myMQTTBroker "MQTT server" 
[
    host="localhost",
    username="XXXX",
    password="XXXX",
    clientID="myopenHABMQTTClient"
]

Thing mqtt:topic:tasmota:coffee "Kaffeemaschine" (mqtt:broker:myMQTTBroker) {
    Channels:
        // Sonoff Basic / Sonoff S20 Smart Socket (Read and switch on-state)
        Type switch : PowerSwitch  [stateTopic="stat/coffee/POWER",   commandTopic="cmnd/coffee/POWER", on="ON", off="OFF"]
}

Thing mqtt:topic:tasmota:spitzboden "Spitzboden" (mqtt:broker:myMQTTBroker) {
    Channels:
        // Sonoff Basic / Sonoff S20 Smart Socket (Read and switch on-state)
        Type switch : PowerSwitch  [stateTopic="stat/spitzboden/POWER",   commandTopic="cmnd/spitzboden/POWER", on="ON", off="OFF"]
}
tasmota.items

Code: Alles auswählen

Switch             coffee      "Kaffeemaschine"                       <switch>    {channel="mqtt:topic:tasmota:coffee:PowerSwitch"}
Switch             spitzboden      "Spitzboden"                       <switch>   {channel="mqtt:topic:tasmota:spitzboden:PowerSwitch"}

Wenn ich nun im PaperUI bspw. Spitzboden aktivieren möchte, dann springt Kaffeemaschine gleich parallel mit an.
Was habe ich in meiner Config falsch?

Benutzeravatar
udo1toni
Beiträge: 13942
Registriert: 11. Apr 2018 18:05
Answers: 222
Wohnort: Darmstadt

Re: Mehrere Items greifen auf ein Thing zu

Beitrag von udo1toni »

Deine Thing UIDs sind falsch. Der Aufbau der UIDs ist nicht wahlfrei. Wenn Du die Konfiguration hierarchisch vornimmst, werden die UIDs automatisch gebildet. Das sieht dann so aus:

Code: Alles auswählen

Bridge mqtt:broker:myMQTTBroker "MQTT server" [
        host="localhost",
        username="XXXX",
        password="XXXX",
        clientID="myopenHABMQTTClient"
    ] {
    Thing topic coffee "Kaffeemaschine" {
        Channels:
            // Sonoff Basic / Sonoff S20 Smart Socket (Read and switch on-state)
            Type switch : PowerSwitch  [stateTopic="stat/coffee/POWER",   commandTopic="cmnd/coffee/POWER", on="ON", off="OFF"]
    }
    Thing topic spitzboden "Spitzboden" {
        Channels:
            // Sonoff Basic / Sonoff S20 Smart Socket (Read and switch on-state)
            Type switch : PowerSwitch  [stateTopic="stat/spitzboden/POWER",   commandTopic="cmnd/spitzboden/POWER", on="ON", off="OFF"]
    }
}
Und die passenden Items:

Code: Alles auswählen

Switch coffee      "Kaffeemaschine" {channel="mqtt:topic:myMQTTBroker:coffee:PowerSwitch"}
Switch spitzboden  "Spitzboden"     {channel="mqtt:topic:myMQTTBroker:spitzboden:PowerSwitch"}
openHAB4.1.2 stable in einem Debian-Container (bookworm) (Proxmox 8.1.5, LXC), mit openHABian eingerichtet

julianpe
Beiträge: 39
Registriert: 28. Sep 2020 11:38

Re: Mehrere Items greifen auf ein Thing zu

Beitrag von julianpe »

Hallo udo1toni,

danke für deine Antwort.
Habe das mal entsprechend übernommen.
Jetzt sehe ich die Items jedoch gar nicht mehr in der Paper UI Control Übersicht - jedoch finde ich diese nur unter Items.
Des Weiteren spuckt der LogViewer folgende Zeilen aus

Code: Alles auswählen

2020-10-25 19:16:02.836 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'mqtt.things', using it anyway:

Provide a thing UID in this format:

 <bindingId>:<thingTypeId>:<thingId>

Provide a thing UID in this format:

 <bindingId>:<thingTypeId>:<thingId>

2020-10-25 19:16:02.851 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mqtt.things'

2020-10-25 19:16:02.901 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like <bindingId>:topic:coffee

2020-10-25 19:16:02.904 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like <bindingId>:topic:spitzboden

2020-10-25 19:16:02.913 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like <bindingId>:topic:coffee

2020-10-25 19:16:02.916 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like <bindingId>:topic:spitzboden

2020-10-25 19:16:02.996 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'localhost' with clientid myopenHABMQTTClient
// Edit:
hat sich erledigt, habe eine } zu wenig gehabt ;)

Benutzeravatar
udo1toni
Beiträge: 13942
Registriert: 11. Apr 2018 18:05
Answers: 222
Wohnort: Darmstadt

Re: Mehrere Items greifen auf ein Thing zu

Beitrag von udo1toni »

Du hast die geschweiften Klammern nicht gesetzt.
openHAB4.1.2 stable in einem Debian-Container (bookworm) (Proxmox 8.1.5, LXC), mit openHABian eingerichtet

Antworten