OpenHab

De Breizh-Entropy
Aller à la navigation Aller à la recherche


Fichier de configuration : mqttbridge.things

<syntaxhighlight lang="python" line copy=1> Bridge mqtt:broker:MosquittoMqttBroker "Mosquitto MQTT Broker" [

       host="192.168.1.18",
       secure=false,
       port=1883,
       clientID="OpenHAB2",
       username="",
       password="" 

] </syntaxhighlight>

Fichier de configuration : mqttdevices.things

Thing mqtt:topic:swPriseBureau "Prise Tasmota de mon bureau" (mqtt:broker:MosquittoMqttBroker) {

       Channels:
               Type switch : power "Power Switch" [
                       commandTopic="cmnd/swPriseBureau/POWER",
                       stateTopic="stat/swPriseBureau/POWER",
                       on="ON",
                       off="OFF"
               ]
               Type number : energy "Consommation electrique du jour" [
                       stateTopic="tele/swPriseBureau/SENSOR"
               ]

}

Fichier de configuration : mqtt.items

Switch sPriseBureauPower "Prise Tasmota de mon bureau" { channel="mqtt:topic:swPriseBureau:power" } Number sPriseBureauConsoJ "Conso journaliere [%.1f kWh]" { channel="mqtt:topic:swPriseBureau:energy" }