udo1toni hat geschrieben: ↑10. Feb 2024 17:58
Das LWT ist als Funktion definiert, nicht jedoch, wie das Topic lautet, wo es zu finden ist und welchen Inhalt es hat.
Ein Client kann sich mit ONLINE/OFFLINE oder On/Off oder auch an/aus melden, das bleibt dem Entwickler überlassen. Enstprechend muss man im Client auch definieren, welche Payload die jeweilige Bedeutung hat.
..hab's leider immer noch nicht verstanden.!?
Hier ein Beispiel-Thing aus meinem SetUp mit ergänztem "Payload":
Code: Alles auswählen
Thing mqtt:topic:claudi:nous01 "Nous A1T" (mqtt:broker:claudi ) @ "MQTT2" [
availabilityTopic="tele/nous_01/LWT",
payloadNotAvailable="Offline",
payloadAvailable= "Online"
]{
Channels:
Type switch : power "Power " [ stateTopic="stat/nous_01/POWER", commandTopic="cmnd/nous_01/POWER" ]
Type number : rssi "WiFi Signal Strength" [ stateTopic="tele/nous_01/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
Type string : version "Firmware Version " [ stateTopic="stat/nous_01/STATUS2", transformationPattern="JSONPATH:$.StatusFWR.Version"]
Type string : reachable "Reachable" [ stateTopic="tele/nous_01/LWT" ]
Type string : hardware "Chip Set " [ stateTopic="stat/nous_01/STATUS2", transformationPattern="JSONPATH:$.StatusFWR.Hardware"]
Type string : ipaddress "IP Address " [ stateTopic="stat/nous_01/STATUS5", transformationPattern="JSONPATH:$.StatusNET.IPAddress"]
Type number : powerload "Power load" [ stateTopic="tele/nous_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
Type number : voltage "Line voltage" [ stateTopic="tele/nous_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
Type number : current "Line current" [ stateTopic="tele/nous_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
Type number : total "Total energy " [ stateTopic="tele/nous_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total"]
Type number : totalday "Total energy today" [ stateTopic="tele/nous_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
Type number : totalyest "Total energy yesterday" [ stateTopic="tele/nous_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
Type string : ssid "WiFi" [ stateTopic="tele/nous_01/STATE", transformationPattern="JSONPATH:$.Wifi.SSId"]
Type datetime : time "Time" [ stateTopic="tele/nous_01/STATE", transformationPattern="JSONPATH:$.Time"]
Type string : grouptop "Group Topic" [ stateTopic="stat/nous_01/STATUS1", transformationPattern="JSONPATH:$.StatusPRM.GroupTopic"]
}
Einen Channel ("reachable") mit verlinktem Item, habe ich auch.
Code: Alles auswählen
Switch nous_01_Unreach "Nous 01 Dyson Erreichbarkeit [%s]" <siren1> (gNous_01,gLWT) ["Point"] { channel="mqtt:topic:claudi:nous01:reachable" }
Die Infos unter
https://tasmota.github.io/docs/MQTT/#lw ... -testament sagen mir auch nichts direkt. Ich muss auch dazu sagen, dass ich das bisher nie so richtig beachtet habe.
Wenn ich in der Shell-Konsole den Befehl eingebe, bekomme ich folgendes als Ergebnis:
Code: Alles auswählen
hab3@oh3ssd:~ $ mosquitto_sub -t "tele/nous_01/LWT"
Online
hab3@oh3ssd:~ $
Was ich bisher gefunden habe, ist mir bis jetzt etwas zu "abstrakt". Gibt's dafür ein praktisches Beispiel, wie ich erkennen kann bzw. wie ich die Info erhalte, dass das Gerät offline ist ?
Also irgendwie steh' ich da "auf dem Schlauch."