Sonoff Tasmota with MQTT Binding 2.4 (using config files)

Apologies if this is a stupid question but can I use the things described in the OP with an embedded broker that I created with the Paper UI:

If so, what’s the syntax to put in the things file that works with this embedded broker?

After configuring the embedded broker, you next need to create a bridge to that broker in your things file like so:

Bridge mqtt:broker:bridge "MQTT Broker Bridge" [ host="localhost", port=1883, secure=false, username="username", password="S***tyPassword", clientID="openHAB2" ] 
{
    ...Things
}

Ah! SO I WAS being stupid? I thought the thing definition was a definition of a new MQTT broker, rather than a definition of a bridge that connects to a broker. I’d not understood quite how the droker and the bridge fit together. Also, how did know what my password was? :slight_smile:

I have this in my sonoff.things file:

Bridge mqtt:broker:bridge "MQTT Broker Bridge" [ host="localhost", port=1883, secure=false, username="openhab", password="blahblahblah", clientID="openHAB2" ] 

{
    // Sonoffs
    Thing topic sonoffpow "Sonoff POW R2 - 1" @ "Blue Room" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="tele/sonoffpowr2-1/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="stat/sonoffpowr2-1/POWER", commandTopic="cmnd/sonoffpowr2-1/POWER" ]
        Type number : powerload "Power load"             [ stateTopic="tele/sonoffpowr2-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="tele/sonoffpowr2-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="tele/sonoffpowr2-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="tele/sonoffpowr2-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="tele/sonoffpowr2-1/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="tele/sonoffpowr2-1/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }
} 

And this in my items file:

Group  Sonoff_POW           "Sonoff POW"                                   <sonoff_pow>    (Sonoff_POW)
String Sonoff_POW_Reachable "Reachable: [%s]"                   <contactable>   (Sonoff_POW) { channel="mqtt:topic:bridge:sonoffpow:reachable" }
Switch Sonoff_POW_Power     "Power []"                          <sonoff_pow>    (Sonoff_POW) { channel="mqtt:topic:bridge:sonoffpow:power" }
Number Sonoff_POW_Load      "Power load [%.1f W]"               <voltage>       (Sonoff_POW) { channel="mqtt:topic:bridge:sonoffpow:powerload" }
Number Sonoff_POW_Voltage   "Line voltage [%.1f V]"             <voltage>       (Sonoff_POW) { channel="mqtt:topic:bridge:sonoffpow:voltage" }
Number Sonoff_POW_Current   "Line current [%.3f A]"             <current>       (Sonoff_POW) { channel="mqtt:topic:bridge:sonoffpow:current" }
Number Sonoff_POW_Today     "Total energy today [%.3f kWh]"     <total_energy>  (Sonoff_POW) { channel="mqtt:topic:bridge:sonoffpow:total" }
Number Sonoff_POW_Yesterday "Total energy yesterday [%.3f kWh]" <total_energy>  (Sonoff_POW) { channel="mqtt:topic:bridge:sonoffpow:totalyest" }
Number Sonoff_POW_RSSI      "WiFi Signal Strength [%d %%]"      <wifi>          (Sonoff_POW) { channel="mqtt:topic:bridge:sonoffpow:rssi" }

And this in my sitemap:

Text label="Sonoff POW R2" {
                        Text item=Sonoff_POW_Reachable label="Status [%s]"
                        Switch item=Sonoff_POW_Power label="Power []"
                        Text item=Sonoff_POW_Load label="Power load [%.1f W]"
                        Text item=Sonoff_POW_Voltage label="Line voltage [%.1f V]"
                        Text item=Sonoff_POW_Current label="Line current [%.3f A]"
                        Text item=Sonoff_POW_Today label="Total energy today [%.3f kWh]"
                        // Text item=FF_Sonoff_POW_Yesterday label="Total energy yesterday [%.3f kWh]"
                        Text item=Sonoff_POW_RSSI label="WiFi Signal Strength [%d %%]"
                    }

I’ve turned DEBUG logging on for mqttgeneric and can see the following in the log:

10-Feb-2020 19:56:40.424 [DEBUG] [g.mqtt.generic.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:bridge:sonoffpow:reachable
10-Feb-2020 19:56:40.424 [DEBUG] [g.mqtt.generic.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:bridge:sonoffpow:power
10-Feb-2020 19:56:40.424 [DEBUG] [g.mqtt.generic.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:bridge:sonoffpow:powerload
10-Feb-2020 19:56:40.424 [DEBUG] [g.mqtt.generic.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:bridge:sonoffpow:voltage
10-Feb-2020 19:56:40.425 [DEBUG] [g.mqtt.generic.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:bridge:sonoffpow:current
10-Feb-2020 19:56:40.425 [DEBUG] [g.mqtt.generic.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:bridge:sonoffpow:total
10-Feb-2020 19:56:40.425 [DEBUG] [g.mqtt.generic.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:bridge:sonoffpow:totalyest
10-Feb-2020 19:56:40.425 [DEBUG] [g.mqtt.generic.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:bridge:sonoffpow:rssi
10-Feb-2020 19:56:40.426 [DEBUG] [org.openhab.binding.mqtt.generic.ChannelState     ] - Subscribed channel mqtt:topic:bridge:sonoffpow:current to topic: tele/sonoffpowr2-1/SENSOR
10-Feb-2020 19:56:40.427 [DEBUG] [org.openhab.binding.mqtt.generic.ChannelState     ] - Subscribed channel mqtt:topic:bridge:sonoffpow:powerload to topic: tele/sonoffpowr2-1/SENSOR
10-Feb-2020 19:56:40.430 [DEBUG] [org.openhab.binding.mqtt.generic.ChannelState     ] - Subscribed channel mqtt:topic:bridge:sonoffpow:totalyest to topic: tele/sonoffpowr2-1/SENSOR
10-Feb-2020 19:56:40.438 [DEBUG] [org.openhab.binding.mqtt.generic.ChannelState     ] - Subscribed channel mqtt:topic:bridge:sonoffpow:voltage to topic: tele/sonoffpowr2-1/SENSOR
10-Feb-2020 19:56:40.440 [DEBUG] [org.openhab.binding.mqtt.generic.ChannelState     ] - Subscribed channel mqtt:topic:bridge:sonoffpow:total to topic: tele/sonoffpowr2-1/SENSOR
10-Feb-2020 19:56:40.440 [DEBUG] [org.openhab.binding.mqtt.generic.ChannelState     ] - Subscribed channel mqtt:topic:bridge:sonoffpow:reachable to topic: tele/sonoffpowr2-1/LWT
10-Feb-2020 19:56:40.440 [DEBUG] [org.openhab.binding.mqtt.generic.ChannelState     ] - Subscribed channel mqtt:topic:bridge:sonoffpow:power to topic: stat/sonoffpowr2-1/POWER
10-Feb-2020 19:56:40.440 [DEBUG] [org.openhab.binding.mqtt.generic.ChannelState     ] - Subscribed channel mqtt:topic:bridge:sonoffpow:rssi to topic: tele/sonoffpowr2-1/STATE
10-Feb-2020 19:56:58.803 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:17af72a1:BoilerMQTT_CommandFlowTemperature_N received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.803 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:17af72a1:BoilerMQTT_CommandWWTemperature_N received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.803 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:bridge:sonoffpow:reachable received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.803 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:bridge:sonoffpow:power received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.803 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:bridge:sonoffpow:powerload received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.803 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:bridge:sonoffpow:voltage received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.803 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:bridge:sonoffpow:current received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.803 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:bridge:sonoffpow:total received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.804 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:bridge:sonoffpow:totalyest received REFRESH but no value cached, ignoring
10-Feb-2020 19:56:58.804 [DEBUG] [nhab.binding.mqtt.generic.AbstractMQTTThingHandler] - Channel mqtt:topic:bridge:sonoffpow:rssi received REFRESH but no value cached, ignoring

But for some reason the items are all remaining as null or blank in my sitemap. I’ve also set up MQTT explorer on my laptop and can see data being sent from my Sonoff POW R2.

Can anyone suggest what I’ve got wrong?

Add mapping to your thing as openhab is not the same as tasmota.

, on=“ON”, off="OFF"

 Type switch : power     "Power"                  [ stateTopic="stat/sonoffpowr2-1/POWER", commandTopic="cmnd/sonoffpowr2-1/POWER" , on="ON", off="OFF" ]

Gentleman,

4h later and after reading this thread a gazilion times, I solved the problem. For the ones struggling with this topic, do yourself a favor, go on your device page and check the Full Topic (%prefix%/%topic%/) and check what value you have there. All of the thread examples are %prefix%/%topic%/ but my devices are different, Don’t know why.

Mines are configured for Full Topic (%topic%/%prefix%/) instead of Full Topic (%prefix%/%topic%/). I tried to change it but always goes to the same one.

== Several Hours later ==

Now, the fully awaken me will correct the sleepy and angry me.

After checking the tasmota commands page, if you look at the setOption19, it says that it will change the full topic. So, if you have setOption19 active, remember that the examples above need to be corrected.

One will post the final files for your delight :grin:

== bridge.things ==

Bridge mqtt:broker:mosquitto "MQTT Broker Bridge" [ host="192.168.1.200", port=1883, secure=false, username="openhabian", password="supersecretpass", clientID="openHAB2" ] 
{
    //SALA
    Thing topic tomadasala "Tomada da Sala" @ "Sala" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-tomada-sala/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-tomada-sala/stat/POWER", commandTopic="sonoff-tomada-sala/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-tomada-sala/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-tomada-sala/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-tomada-sala/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-tomada-sala/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-tomada-sala/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-tomada-sala/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }


    Thing topic sonoffrf2 "RF Bridge 2" @ "Sala" {
    Channels:
        Type string : reachable     "Reachable"            [ stateTopic="sonoff-rf-bridge2/tele/LWT" ]
        Type string : recieveddata  "Received Data"        [ stateTopic="sonoff-rf-bridge2/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Data"]
        Type string : recievedsync  "Received Sync"        [ stateTopic="sonoff-rf-bridge2/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Sync"]
        Type string : recievedlow   "Received Low"         [ stateTopic="sonoff-rf-bridge2/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Low"]
        Type string : recievedhigh  "Received High"        [ stateTopic="sonoff-rf-bridge2/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.High"]
        Type string : recievedrfkey "Received RfKey"       [ stateTopic="sonoff-rf-bridge2/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.RfKey"]
        Type number : rssi          "WiFi Signal Strength" [ stateTopic="sonoff-rf-bridge2/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }

    Thing topic sonoffrf "RF Bridge" @ "Entrada" {
    Channels:
        Type string : reachable     "Reachable"            [ stateTopic="sonoff-rf-bridge/tele/LWT" ]
        Type string : recieveddata  "Received Data"        [ stateTopic="sonoff-rf-bridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Data"]
        Type string : recievedsync  "Received Sync"        [ stateTopic="sonoff-rf-bridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Sync"]
        Type string : recievedlow   "Received Low"         [ stateTopic="sonoff-rf-bridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Low"]
        Type string : recievedhigh  "Received High"        [ stateTopic="sonoff-rf-bridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.High"]
        Type string : recievedrfkey "Received RfKey"       [ stateTopic="sonoff-rf-bridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.RfKey"]
        Type number : rssi          "WiFi Signal Strength" [ stateTopic="sonoff-rf-bridge/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }

    //ESCRITÓRIO
    Thing topic maquinasecar "Máquina Secar" @ "Escritório" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-maquina-secar/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-maquina-secar/stat/POWER", commandTopic="sonoff-maquina-secar/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-maquina-secar/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-maquina-secar/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-maquina-secar/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-maquina-secar/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-maquina-secar/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-maquina-secar/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }
    Thing topic caldeira "Caldeira" @ "Escritório" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-caldeira/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-caldeira/stat/POWER", commandTopic="sonoff-caldeira/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-caldeira/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-caldeira/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-caldeira/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-caldeira/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-caldeira/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-caldeira/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }
    Thing topic pcpais "PC Pais" @ "Escritório" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-pc-pais/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-pc-pais/stat/POWER", commandTopic="sonoff-pc-pais/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-pc-pais/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-pc-pais/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-pc-pais/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-pc-pais/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-pc-pais/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-pc-pais/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }
    Thing topic pcfilhos "PC Filhos" @ "Escritório" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-pc-filhos/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-pc-filhos/stat/POWER", commandTopic="sonoff-pc-filhos/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-pc-filhos/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-pc-filhos/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-pc-filhos/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-pc-filhos/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-pc-filhos/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-pc-filhos/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }
    Thing topic switchrouter "Router" @ "Escritório" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-switch-escritorio/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-switch-escritorio/stat/POWER", commandTopic="sonoff-switch-escritorio/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-switch-escritorio/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-switch-escritorio/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-switch-escritorio/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-switch-escritorio/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-switch-escritorio/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-switch-escritorio/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }
    
    
    Thing topic impressora "Impressora" @ "Escritório" {
    Channels:
        Type switch : power     "Power"                [ stateTopic="sonoff-impressora/stat/POWER", commandTopic="sonoff-impressora/cmnd/POWER" ]
    }
    
    Thing topic servidor "Servidor" @ "Escritório" {
    Channels:
        Type switch : power     "Power"                [ stateTopic="sonoff-servidor/stat/POWER", commandTopic="sonoff-servidor/cmnd/POWER" ]
    }
    
    Thing topic luzpresecamaria "Luz Presença" @ "Quarto Maria" {
    Channels:
        Type switch : power     "Power"                [ stateTopic="sonoff-luz-presenca-quarto-maria/stat/POWER", commandTopic="sonoff-luz-presenca-quarto-maria/cmnd/POWER" ]
    }

    //COZINHA

    Thing topic cafeteira "Cafeteira" @ "Cozinha" {
    Channels:
        Type switch : power     "Power"                [ stateTopic="sonoff-cafeteira/stat/POWER", commandTopic="sonoff-cafeteira/cmnd/POWER" ]
    }

    Thing topic placainducao "Placa de Indução" @ "Cozinha" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-placa-inducao/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-placa-inducao/stat/POWER", commandTopic="sonoff-placa-inducao/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-placa-inducao/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-placa-inducao/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-placa-inducao/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-placa-inducao/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-placa-inducao/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-placa-inducao/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }

    Thing topic frigorifico "Frigorifico" @ "Cozinha" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-frigorifico/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-frigorifico/stat/POWER", commandTopic="sonoff-frigorifico/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-frigorifico/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-frigorifico/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-frigorifico/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-frigorifico/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-frigorifico/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-frigorifico/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }

    Thing topic exaustor "Exaustor" @ "Cozinha" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-exaustor/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-exaustor/stat/POWER", commandTopic="sonoff-exaustor/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-exaustor/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-exaustor/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-exaustor/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-exaustor/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-exaustor/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-exaustor/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }

    Thing topic maquinaloica "Máquina da Loiça" @ "Cozinha" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-maquina-loica/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-maquina-loica/stat/POWER", commandTopic="sonoff-maquina-loica/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-maquina-loica/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-maquina-loica/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-maquina-loica/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-maquina-loica/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-maquina-loica/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-maquina-loica/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }

    //QUARTO
    
    Thing topic carregadorpai "Carregador Pai" @ "Quarto" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-carregador-pai/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-carregador-pai/stat/POWER", commandTopic="sonoff-carregador-pai/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-carregador-pai/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-carregador-pai/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-carregador-pai/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-carregador-pai/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-carregador-pai/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-carregador-pai/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }
    
    Thing topic tvquarto "TV" @ "Quarto" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="sonoff-tv-quarto/tele/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="sonoff-tv-quarto/stat/POWER", commandTopic="sonoff-tv-quarto/cmnd/POWER"]
        Type number : powerload "Power load"             [ stateTopic="sonoff-tv-quarto/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="sonoff-tv-quarto/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="sonoff-tv-quarto/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="sonoff-tv-quarto/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="sonoff-tv-quarto/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="sonoff-tv-quarto/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    }
}

== stuff.items ==

// Main group
Group					gHome
//Groups - Location
Group					gQuarto4																							(gHome)
Group					gSala																								(gHome)
Group					gCozinha																							(gHome)
Group					gChartTVSamsung																						(gHome)
Group					gChartTVLG																							(gHome)
Group					gChartCaldeira																						(gHome)
Group					gChartFrigorifico																					(gHome)
Group					gMovimento																							(gHome)
Group:Number:SUM		gPowerSala						"Sala [%.3f kWh]"									<energy>		(gHome)
Group:Number:SUM		gPowerQuarto4					"Quarto Exterior [%.3f kWh]"						<energy>		(gHome)
Group:Number:SUM		gPowerEscritorio				"Escritório [%.3f kWh]"								<energy>		(gHome)
Group:Number:SUM		gPowerCaldeira					"Caldeira [%.3f kWh]"								<energy>		(gHome)
Group:Number:SUM		gPowerCozinha					"Cozinha [%.3f kWh]"								<energy>		(gHome)
Group:Number:SUM		gChartMaquinaLoica				"Máquina da Loiça [%.3f kWh]"						<energy>		(gHome)
Group:Number:SUM		gChartPlacaInducao				"Placa de Indução [%.3f kWh]"						<energy>		(gHome)
Group:Number:SUM		gChartMaquinaSecar				"Máquina Secar Congeladora [%.3f kWh]"				<energy>		(gHome)
Group:Number:SUM		gPowerAll						"Energia [%.2f kWh]"								<energy>		(gHome)
Group:Number:SUM		gPowerAllCorrente				"Amps [%.2f A]"										<energy>		(gHome)
Group:Switch:OR(ON,OFF)	gTomadas						"Desligar Tomadas"													(gHome)
Switch					TV_Quarto_Desabilitar_Regras	"Desabilitar Regras"								<switch>
Switch					Tomada_Sala_Desabilitar_Regras	"Desabilitar Regras"								<switch>
Switch					Tomada_Sala_Ferias				"Modo Férias"										<switch>
Switch					Casa_com_gente					"Gente em casa"										<switch>
Number					TV_Quarto_energia				"Energia [%.2f kWh]"												(gQuarto4, gPowerQuarto4,gPowerAll,gChartTVLG)												{channel="mqtt:topic:mosquitto:tvquarto:powerload"}
Number					TV_Quarto_voltagem				"Voltagem [%.2f V]"													(gQuarto4)																					{channel="mqtt:topic:mosquitto:tvquarto:voltage"}
Number					TV_Quarto_corrente				"Corrente [%.2f A]"													(gQuarto4, gPowerAllCorrente)																{channel="mqtt:topic:mosquitto:tvquarto:current"}
Number					TV_Quarto_energia_ontem			"Energia Consumida Ontem [%.2f W]"									(gQuarto4)																					{channel="mqtt:topic:mosquitto:tvquarto:totalyest"}
Number					TV_Quarto_consumo				"Energia Consumida Hoje [%.2f W]"									(gQuarto4)																					{channel="mqtt:topic:mosquitto:tvquarto:total"}
Switch					TV_Quarto						"Tv Quarto"															(gQuarto4)																					{channel="mqtt:topic:mosquitto:tvquarto:power"}
Number					Carregador_Pai_energia			"Energia [%.2f kWh]"												(gQuarto4, gPowerQuarto4,gCarregadorPai, gPowerAll)											{channel="mqtt:topic:mosquitto:carregadorpai:powerload"}
Number					Carregador_Pai_voltagem			"Voltagem [%.2f V]"													(gQuarto4)																					{channel="mqtt:topic:mosquitto:carregadorpai:voltage"}
Number					Carregador_Pai_corrente			"Corrente [%.2f A]"													(gQuarto4, gPowerAllCorrente)																{channel="mqtt:topic:mosquitto:carregadorpai:current"}
Number					Carregador_Pai_energia_ontem	"Energia Consumida Ontem [%.2f W]"									(gQuarto4)																					{channel="mqtt:topic:mosquitto:carregadorpai:totalyest"}
Number					Carregador_Pai_energia_hoje		"Energia Consumida Hoje [%.2f W]"									(gQuarto4)																					{channel="mqtt:topic:mosquitto:carregadorpai:total"}
Switch					Carregador_Pai					"Carregador Pai"													(gQuarto4)																					{channel="mqtt:topic:mosquitto:carregadorpai:power"}
Number					Caldeira_energia				"Energia [%.2f kWh]"												(gEscritorio, gPowerCaldeira, gPowerEscritorio, gPowerAll, gChartCaldeira)					{channel="mqtt:topic:mosquitto:caldeira:powerload"}
Number					Caldeira_voltagem				"Voltagem [%.2f V]"													(gEscritorio)																				{channel="mqtt:topic:mosquitto:caldeira:voltage"}
Number					Caldeira_corrente				"Corrente [%.2f A]"													(gEscritorio, gPowerAllCorrente)															{channel="mqtt:topic:mosquitto:caldeira:current"}
Number					Caldeira_energia_ontem			"Energia Consumida Ontem [%.2f W]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:caldeira:totalyest"}
Number					Caldeira_energia_hoje			"Energia Consumida Hoje [%.2f W]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:caldeira:total"}
Switch					Caldeira						"Caldeira"															(gEscritorio)																				{channel="mqtt:topic:mosquitto:caldeira:power"}
Number					Frigorifico_energia				"Energia [%.2f kWh]"												(gCozinha, gPowerFrigorifico, gPowerCozinha, gPowerAll, gChartFrigorifico)					{channel="mqtt:topic:mosquitto:frigorifico:powerload"}
Number					Frigorifico_voltagem			"Voltagem [%.2f V]"													(gCozinha)																					{channel="mqtt:topic:mosquitto:frigorifico:voltage"}
Number					Frigorifico_corrente			"Corrente [%.2f A]"													(gCozinha, gPowerAllCorrente)																{channel="mqtt:topic:mosquitto:frigorifico:current"}
Number					Frigorifico_energia_ontem		"Energia Consumida Ontem [%.2f W]"									(gCozinha)																					{channel="mqtt:topic:mosquitto:frigorifico:totalyest"}
Number					Frigorifico_energia_hoje		"Energia Consumida Hoje [%.2f W]"									(gCozinha)																					{channel="mqtt:topic:mosquitto:frigorifico:total"}
Switch					Frigorifico						"Frigorífico"														(gCozinha)																					{channel="mqtt:topic:mosquitto:frigorifico:power"}
Number					Maquina_Loica_energia			"Energia [%.2f kWh]"												(gCozinha, gPowerMaquinaLoica, gPowerCozinha, gPowerAll, gChartMaquinaLoica)				{channel="mqtt:topic:mosquitto:maquinaloica:powerload"}
Number					Maquina_Loica_voltagem			"Voltagem [%.2f V]"													(gCozinha)																					{channel="mqtt:topic:mosquitto:maquinaloica:voltage"}
Number					Maquina_Loica_corrente			"Corrente [%.2f A]"													(gCozinha, gPowerAllCorrente)																{channel="mqtt:topic:mosquitto:maquinaloica:current"}
Number					Maquina_Loica_energia_ontem		"Energia Consumida Ontem [%.2f W]"									(gCozinha)																					{channel="mqtt:topic:mosquitto:maquinaloica:totalyest"}
Number					Maquina_Loica_energia_hoje		"Energia Consumida Hoje [%.2f W]"									(gCozinha)																					{channel="mqtt:topic:mosquitto:maquinaloica:total"}
Switch					Maquina_Loica					"Máquina da Loiça"													(gCozinha)																					{channel="mqtt:topic:mosquitto:maquinaloica:power"}
Number					Tomada_Sala_energia				"Energia [%.2f kWh]"												(gSala, gPowerSala, gPowerAll)																{channel="mqtt:topic:mosquitto:tomadasala:powerload"}
Number					Tomada_Sala_voltagem			"Voltagem [%.2f V]"													(gSala)																						{channel="mqtt:topic:mosquitto:tomadasala:voltage"}
Number					Tomada_Sala_corrente			"Corrente [%.2f A]"													(gSala, gPowerAllCorrente)																	{channel="mqtt:topic:mosquitto:tomadasala:current"}
Number					Tomada_Sala_energia_ontem		"Energia Consumida Ontem [%.2f W]"									(gSala)																						{channel="mqtt:topic:mosquitto:tomadasala:totalyest"}
Number					Tomada_Sala_energia_hoje		"Energia Consumida Hoje [%.2f W]"									(gSala)																						{channel="mqtt:topic:mosquitto:tomadasala:total"}
Switch					Tomada_Sala						"Tomada Sala"														(gSala)																						{channel="mqtt:topic:mosquitto:tomadasala:power"}
Number					Placa_Inducao_energia			"Energia [%.2f kWh]"												(gCozinha, gPowerPlacaInducao, gPowerCozinha, gPowerAll, gChartPlacaInducao)				{channel="mqtt:topic:mosquitto:placainducao:powerload"}
Number					Placa_Inducao_voltagem			"Voltagem [%.2f V]"													(gCozinha)																					{channel="mqtt:topic:mosquitto:placainducao:voltage"}
Number					Placa_Inducao_corrente			"Corrente [%.2f A]"													(gCozinha, gPowerAllCorrente)																{channel="mqtt:topic:mosquitto:placainducao:current"}
Number					Placa_Inducao_energia_ontem		"Energia Consumida Ontem [%.2f W]"									(gCozinha)																					{channel="mqtt:topic:mosquitto:placainducao:totalyest"}
Number					Placa_Inducao_energia_hoje		"Energia Consumida Hoje [%.2f W]"									(gCozinha)																					{channel="mqtt:topic:mosquitto:placainducao:total"}
Switch					Placa_Inducao					"Placa de Indução"													(gCozinha)																					{channel="mqtt:topic:mosquitto:placainducao:power"}
Number					Exaustor_energia				"Energia [%.2f kWh]"												(gCozinha, gPowerExaustor, gPowerCozinha, gPowerAll, gChartExaustor)						{channel="mqtt:topic:mosquitto:exaustor:powerload"}
Number					Exaustor_voltagem				"Voltagem [%.2f V]"													(gCozinha)																					{channel="mqtt:topic:mosquitto:exaustor:voltage"}
Number					Exaustor_corrente				"Corrente [%.2f A]"													(gCozinha, gPowerAllCorrente)																{channel="mqtt:topic:mosquitto:exaustor:current"}
Number					Exaustor_energia_ontem			"Energia Consumida Ontem [%.2f W]"									(gCozinha)																					{channel="mqtt:topic:mosquitto:exaustor:totalyest"}
Number					Exaustor_energia_hoje			"Energia Consumida Hoje [%.2f W]"									(gCozinha)																					{channel="mqtt:topic:mosquitto:exaustor:total"}
Switch					Exaustor						"Exaustor"															(gCozinha)																					{channel="mqtt:topic:mosquitto:exaustor:power"}
Switch					Forno							"Forno"																(gCozinha, gPowerCozinha, gChartForno)														{channel="tplinksmarthome:hs110:F77D1E:switch"}
Switch					Forno_led						"LED"																(gCozinha)																					{channel="tplinksmarthome:hs110:F77D1E:led"}
Number					Forno_energia					"Energia"															(gCozinha, gPowerCozinha, gChartForno,gPowerAll)											{channel="tplinksmarthome:hs110:F77D1E:power"}
Number					Forno_consumo					"Consumo"															(gCozinha, gChartForno)																		{channel="tplinksmarthome:hs110:F77D1E:energyUsage"}
Number					Forno_corrente					"Corrente"															(gCozinha, gChartForno)																		{channel="tplinksmarthome:hs110:F77D1E:current"}
Number					Forno_voltagem					"Voltagem"															(gCozinha, gChartForno)																		{channel="tplinksmarthome:hs110:F77D1E:voltage"}
Number					Maquina_Secar_energia			"Energia [%.1f W]"													(gEscritorio)																				{channel="mqtt:topic:mosquitto:maquinasecar:powerload"}
Number					Maquina_Secar_voltagem			"Line voltage [%.1f V]"												(gEscritorio)																				{channel="mqtt:topic:mosquitto:maquinasecar:voltage"}
Number					Maquina_Secar_corrente			"Line current [%.3f A]"												(gEscritorio, gPowerAllCorrente)															{channel="mqtt:topic:mosquitto:maquinasecar:current"}
Number					Maquina_Secar_energia_hoje		"Total energy today [%.3f kWh]"										(gEscritorio)																				{channel="mqtt:topic:mosquitto:maquinasecar:totalyest"}
Number					Maquina_Secar_energia_ontem		"Total energy yesterday [%.3f kWh]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:maquinasecar:total"}
Switch					Maquina_Secar					"Máquina Secar"														(gEscritorio, gPowerMaquina_Secar, gPowerEscritorio, gPowerAll, gChartMaquina_Secar)		{channel="mqtt:topic:mosquitto:maquinasecar:power"}
Number					Tomada_PC_Pai_energia			"Energia [%.2f kWh]"												(gEscritorio, gPowerTomadaPCPai, gPowerEscritorio, gPowerAll, gChartTomadaPCPai)			{channel="mqtt:topic:mosquitto:pcpais:powerload"}
Number					Tomada_PC_Pai_voltagem			"Voltagem [%.0f V]"													(gEscritorio)																				{channel="mqtt:topic:mosquitto:pcpais:voltage"}
Number					Tomada_PC_Pai_corrente			"Corrente [%.3f A]"													(gEscritorio, gPowerAllCorrente)															{channel="mqtt:topic:mosquitto:pcpais:current"}
Number					Tomada_PC_Pai_energia_ontem		"Energia Consumida Ontem [%.2f W]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:pcpais:totalyest"}
Number					Tomada_PC_Pai_energia_hoje		"Energia Consumida Hoje [%.2f W]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:pcpais:total"}
Switch					Tomada_PC_Pai					"PC Pai"															(gEscritorio)																				{channel="mqtt:topic:mosquitto:pcpais:power"}
Number					Tomada_PC_Filho_energia			"Energia [%.2f kWh]"												(gEscritorio, gPowerTomadaPCFilho, gPowerEscritorio, gPowerAll, gChartTomadaPCFilho)		{channel="mqtt:topic:mosquitto:pcfilhos:powerload"}
Number					Tomada_PC_Filho_voltagem		"Voltagem [%.2f V]"													(gEscritorio)																				{channel="mqtt:topic:mosquitto:pcfilhos:voltage"}
Number					Tomada_PC_Filho_corrente		"Corrente [%.3f A]"													(gEscritorio, gPowerAllCorrente)															{channel="mqtt:topic:mosquitto:pcfilhos:current"}
Number					Tomada_PC_Filho_energia_ontem	"Energia Consumida Ontem [%.2f W]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:pcfilhos:totalyest"}
Number					Tomada_PC_Filho_energia_hoje	"Energia Consumida Hoje [%.2f W]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:pcfilhos:total"}
Switch					Tomada_PC_Filho					"Tomada_PC_Filho"													(gEscritorio)																				{channel="mqtt:topic:mosquitto:pcfilhos:power"}
Number					Tomada_Switch_energia			"Energia [%.2f kWh]"												(gEscritorio, gPowerTomadaSwitch, gPowerEscritorio, gPowerAll, gChartTomadaSwitch)			{channel="mqtt:topic:mosquitto:switchrouter:powerload"}
Number					Tomada_Switch_voltagem			"Voltagem [%.2f V]"													(gEscritorio)																				{channel="mqtt:topic:mosquitto:switchrouter:voltage"}
Number					Tomada_Switch_corrente			"Corrente [%.3f A]"													(gEscritorio, gPowerAllCorrente)															{channel="mqtt:topic:mosquitto:switchrouter:current"}
Number					Tomada_Switch_energia_ontem		"Energia Consumida Ontem [%.2f W]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:switchrouter:totalyest"}
Number					Tomada_Switch_energia_hoje		"Energia Consumida Hoje [%.2f W]"									(gEscritorio)																				{channel="mqtt:topic:mosquitto:switchrouter:total"}
Switch					Tomada_Switch					"Tomada_PC_Filho"													(gEscritorio)																				{channel="mqtt:topic:mosquitto:switchrouter:power"}

//Sonoff S26
Switch					Servidor						"Servidor"															(gEscritorio)																				{channel="mqtt:topic:mosquitto:servidor:power"}

//Sonoff S20
Switch					Cafeteira_Cozinha				"Cafeita Cozinha"													(gCozinha)																					{channel="mqtt:topic:mosquitto:cafeteira:power"}
Switch					Impressora						"Impressora"														(gEscritorio)																				{channel="mqtt:topic:mosquitto:impressora:power"}
Switch					Luz_Presenca_Quarto_Maria		"Luz Presença"														(gQuartoMaria)																				{channel="mqtt:topic:mosquitto:luzpresecamaria:power"}

//RF Bridge
Group					GF_Sonoff_RF					"RF Bridge"											<sonoff_rf>		(Sonoff_RF)
String					GF_Sonoff_RF_Reachable			"Reachable: [%s]"									<contactable>	(GF_Sonoff_RF)																				{channel="mqtt:topic:mosquitto:sonoffrf:reachable"}
String					GF_Sonoff_RF_Received_Data		"Received Data: [%s]"								<none>			(GF_Sonoff_RF)																				{channel="mqtt:topic:mosquitto:sonoffrf:recieveddata"}
String					GF_Sonoff_RF_Received_Sync		"Received Sync: [%s]"								<none>			(GF_Sonoff_RF)																				{channel="mqtt:topic:mosquitto:sonoffrf:recievedsync"}
String					GF_Sonoff_RF_Received_Low		"Received Low: [%s]"								<none>			(GF_Sonoff_RF)																				{channel="mqtt:topic:mosquitto:sonoffrf:recievedlow"}
String					GF_Sonoff_RF_Received_High		"Received High: [%s]"								<none>			(GF_Sonoff_RF)																				{channel="mqtt:topic:mosquitto:sonoffrf:recievedhigh"}
String					GF_Sonoff_RF_Received_RfKey		"Received RfKey: [%s]"								<none>			(GF_Sonoff_RF)																				{channel="mqtt:topic:mosquitto:sonoffrf:recievedrfkey"}
Number					GF_Sonoff_RF_RSSI				"WiFi Signal Strength [%d %%]"						<wifi>			(GF_Sonoff_RF)																				{channel="mqtt:topic:mosquitto:sonoffrf:rssi"}
Group					GF_Sonoff_RF2					"RF Bridge"											<sonoff_rf>		(Sonoff_RF2)
String					GF_Sonoff_RF2_Reachable			"Reachable: [%s]"									<contactable>	(GF_Sonoff_RF2)																				{channel="mqtt:topic:mosquitto:sonoffrf2:reachable"}
String					GF_Sonoff_RF2_Received_Data		"Received Data: [%s]"								<none>			(GF_Sonoff_RF2)																				{channel="mqtt:topic:mosquitto:sonoffrf2:recieveddata"}
String					GF_Sonoff_RF2_Received_Sync		"Received Sync: [%s]"								<none>			(GF_Sonoff_RF2)																				{channel="mqtt:topic:mosquitto:sonoffrf2:recievedsync"}
String					GF_Sonoff_RF2_Received_Low		"Received Low: [%s]"								<none>			(GF_Sonoff_RF2)																				{channel="mqtt:topic:mosquitto:sonoffrf2:recievedlow"}
String					GF_Sonoff_RF2_Received_High		"Received High: [%s]"								<none>			(GF_Sonoff_RF2)																				{channel="mqtt:topic:mosquitto:sonoffrf2:recievedhigh"}
String					GF_Sonoff_RF2_Received_RfKey	"Received RfKey: [%s]"								<none>			(GF_Sonoff_RF2)																				{channel="mqtt:topic:mosquitto:sonoffrf2:recievedrfkey"}
Number					GF_Sonoff_RF2_RSSI				"WiFi Signal Strength [%d %%]"						<wifi>			(GF_Sonoff_RF2)																				{channel="mqtt:topic:mosquitto:sonoffrf2:rssi"}
Switch					PortaPrincipalDir				"Porta Entrada Direita [MAP(portas.map):%s]"
Switch					PortaPrincipalEsq				"Porta Entrada Esquerda [MAP(portas.map):%s]"
Switch					JanelaEscritorio				"Janela Escritório [MAP(portas.map):%s]"
Switch					JanelaQuartoExterior			"Janela Quarto [MAP(portas.map):%s]"
Switch					JanelaCozinha					"Janela Cozinha [MAP(portas.map):%s]"
Switch					JanelaGatos						"Janela Gatos [MAP(portas.map):%s]"
Switch					PortaFrigorifico				"Porta Frigorifico [MAP(portas.map):%s]"							(gMovimento)
Switch					MovimentoSala					"Movimento Sala [MAP(movimento.map):%s]"							(gMovimento)
Switch					MovimentoPatamarEntrada			"Movimento Patamar Entrada [MAP(movimento.map):%s]"					(gMovimento)
Group					gTelefonesBT
Group					gTelefonesWLAN
Switch					Presenca
Switch					ONEPLUS2_BT						"Telemóvel BT Pedro"												(gTelefonesBT)																				{exec="<[/scripts/bt.sh 2:60000:REGEX((.*?))]"}
Switch					ONEPLUS1_BT						"Telemóvel BT Sandra"												(gTelefonesBT)																				{exec="<[/scripts/bt.sh 1:60000:REGEX((.*?))]"}
Switch					ONEPLUS2_WLAN					"Telemóvel WLAN Pedro"												(gTelefonesWLAN)																			{exec="<[/scripts/ping.sh 192.168.1.68:60000:REGEX((.*?))]"}
Switch					ONEPLUS1_WLAN					"Telemóvel WLAN Sandra"												(gTelefonesWLAN)																			{exec="<[/scripts/ping.sh 192.168.1.101:60000:REGEX((.*?))]"}
Switch					ONEPLUS1						"Telemóvel Sandra"
Switch					ONEPLUS2						"Telemóvel Pedro"


//Charts
Number					Periodo_Dia						"Periodo Dia"
String					VoiceCommand
3 Likes

Hello guys,

I have set up a channel for my door bell (config below):

Channels:
  Type string : DoorBell   "DoorBell"  [stateTopic="FirstFloor/DoorBell/Output"]

However, after the code are loaded, i got this error on logs:

mqtt:topic:FirstFloorMQTTBroker:FirstFloorSalonThing’ changed from OFFLINE (COMMUNICATION_ERROR): java.lang.Exception: No MQTT client to OFFLINE (BRIDGE_OFFLINE)

Any help how to setup channel of type string or number.

I have two bulbs (say B1 and B2). Is it possible to change color of both bulbs in 1 go. The following sets color of B1 bulb

Color   RGB_B1       "HSB Color"             <none>          (gBulbs)         { channel="mqtt:topic:MosquittoMqttBroker:RGB-Bulb-01:hsbcolor" }

How can i send the picked color to the second bulb, (say with channel RGB-Bulb-02) ?

One way would be using a rule the is triggered on the change of RGB_B1.
Setting the commandtopic of bulb1 to the same as bulb1 could do the trick as well, however that way you can’t set the colour individually.

I dont want to set the bulb color individually. How can i set two command topics for RGB_B1?

Sorry, I had a typo in my post. It should have read:
Setting the commandtopic of bulb2 to the same as bulb1 could do the trick as well, however that way you can’t set the colour individually.

That way bulb1 keeps its single command, bulb2 would react on the same command.

Are you suggesting to change that in mqtt.things or the item file?

The commandtopic can only be set for the things!

These are my two bulbs. I tried to play with the command topic, but did not get the expected result. What do you suggest doing here?

Thing topic sonoff1510 "Sonoff 1510" @ "Some Room" {
Channels:
    Type string   : reachable  "Reachable"            [ stateTopic="tele/sonoff-1510/LWT" ]
    Type switch   : power      "Power"                [ stateTopic="stat/sonoff-1510/POWER", commandTopic="cmnd/sonoff-1510/POWER" ]
    Type colorHSB : hsbcolor "HSB Color" [stateTopic="tele/sonoff-1510/STATE",commandTopic="cmnd/sonoff-1510/HSBColor",transformationPattern="JSONPATH:$.HSBColor" ]
    Type number   : rssi       "WiFi Signal Strength" [ stateTopic="tele/sonoff-1510/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]

}

Thing topic sonoff4183 "Sonoff 4183" @ "Some Room" {
Channels:
    Type string   : reachable  "Reachable"            [ stateTopic="tele/sonoff-4183/LWT" ]
    Type switch   : power      "Power"                [ stateTopic="stat/sonoff-4183/POWER", commandTopic="cmnd/sonoff-4183/POWER" ]
    Type colorHSB : hsbcolor "HSB Color" [stateTopic="tele/sonoff-4183/STATE",commandTopic="cmnd/sonoff-4183/HSBColor",transformationPattern="JSONPATH:$.HSBColor" ]
    Type number   : rssi       "WiFi Signal Strength" [ stateTopic="tele/sonoff-4183/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]

}

Hi All,
I am slowly moving from MQTT 1.x over to MQTT2
For the Sonoff switches I use some complex item definitions to get an automatic update based on various MQTT topics.
Here is my MQTT 1.x item definition:

Switch Sonoff_1_Switch
	{mqtt="	>[broker:sonoff_1/cmnd/sonoff/power:command:*:default],
			>[broker:sonoff_1/cmnd/sonoff/status:command:*:8],
			>[broker:sonoff_1/cmnd/sonoff/status:command:*:2],
			<[broker:sonoff_1/tele/sonoff/STATE:state:JSONPATH($.POWER)],
			<[broker:sonoff_1/stat/sonoff/RESULT:state:JSONPATH($.POWER)],
			<[broker:sonoff_1/stat/sonoff/POWER:state:default]",
			autoupdate="false"}

How can I do that in the MQTT 2 thing file definition??
Additionally, I also have a more complex definition for the Number values:

Number Sonoff_1_V	"S1_V [%.0f V]"
	{ mqtt="	<[broker:sonoff_1/tele/sonoff/SENSOR:state:JSONPATH($.ENERGY.Voltage)],
				<[broker:sonoff_1/stat/sonoff/STATUS8:state:JSONPATH($.StatusSNS.ENERGY.Voltage)]" }

How can I do this in MQTT 2??

Any help is greatly appreciated.

We can’t see how far you’ve got switching over to MQTT2, but the general gist is:

  1. Create a Thing Channel for each of the topics you want to subscribe to.
  2. Link your single Item to each of those Channels, separating them with commas. Yes, you can link multiple Channels to a single Item!

I tried to write a little about it as I do the same, for very similar reasons - see Status on startup in the following post:

In general for MQTT, you make a channel for each topic you are listening to (stateTopic). Items may be linked to more than one channel.

Transformations like JSONPATH haven’t really changed (transformationPattern). These are individually configured per channel.

if you want the same command publishing to two different topics, again you would use separate channels and link to same Item (commandTopic).
In this case you could conveniently use some of the multiple channels you created for the listening.

Publishing the fixed “8” and “2” to the same topic is a bit weird, but the same general outline applies. You can I think use either transformationPatterOut or formatBeforePublish to set up fixed payloads.

What you can’t do is guarantee the order, 8-2 or 2-8.
If you need to do that you should use a completely different approach by rule and publish Action.

I suspect you don’t really need to be doing this weird publishing to a Sonoff at all.

1 Like

Thanks @rossko57 and @hafniumzinc for your help!
The hint form both of you to link multiple channels to a single item did the trick.

For a single Sonoff POW device I have several items defined to get the switch state, voltage, power, current, energy, online state and firmware. To do this here is the definition for one channel in the .things file:

    // ******************************************************************************
    // Sonoff_1
    // ******************************************************************************
    Thing topic sonoff_1 "Sonoff_1" @ "Entertainment" {
    Channels:
        Type switch : querry     "Querry all parameters"
        [
        	commandTopic="sonoff_1/cmnd/sonoff/status",
        	formatBeforePublish="0"
        ]
        Type switch : get_vpi     "Get Volt, Curr, Pwr"
        [
        	commandTopic="sonoff_1/cmnd/sonoff/status",
        	formatBeforePublish="8"
        ]
        Type switch : reset_e     "Reset energy accum"
        [
        	commandTopic="sonoff_1/cmnd/sonoff/EnergyReset1",
        	formatBeforePublish="0"
        ]
        Type switch : reset_et     "Reset energy accum"
        [
        	commandTopic="sonoff_1/cmnd/sonoff/EnergyReset3",
        	formatBeforePublish="0"
        ]
        Type string : lwt "Reachable"
        [
        	stateTopic="sonoff_1/tele/sonoff/LWT"
        ]
        Type string : fwr "Firmware"
        [
        	stateTopic="sonoff_1/stat/sonoff/STATUS2",
        	transformationPattern="JSONPATH:$.StatusFWR.Version"
        ]
        Type switch : sw_cmd1     "Switch Cmd"
        [
        	commandTopic="sonoff_1/cmnd/sonoff/power"
        ]
        Type switch : sw_fb1     "Switch Feedback"
        [
        	stateTopic="sonoff_1/tele/sonoff/STATE",
        	transformationPattern="JSONPATH:$.POWER"
        ]
        Type switch : sw_fb2     "Switch Feedback"
        [
        	stateTopic="sonoff_1/stat/sonoff/POWER",
        	on="ON", off="OFF"
        ]
        Type switch : sw_fb3     "Switch Feedback"
        [
        	stateTopic="sonoff_1/stat/sonoff/RESULT",
        	transformationPattern="JSONPATH:$.POWER"
        ]
        Type number : pwr1 "Power load"
        [
        	stateTopic="sonoff_1/stat/sonoff/STATUS8",
        	transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Power"
        ]
        Type number : pwr2 "Power load"
        [
        	stateTopic="sonoff_1/tele/sonoff/SENSOR",
        	transformationPattern="JSONPATH:$.ENERGY.Power"
        ]
        Type number : volt1   "Line voltage"
        [
        	stateTopic="sonoff_1/stat/sonoff/STATUS8",
        	transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Voltage"
        ]
        Type number : volt2  "Line voltage"
        [
        	stateTopic="sonoff_1/tele/sonoff/SENSOR",
        	transformationPattern="JSONPATH:$.ENERGY.Voltage"
        ]
        Type number : curr1   "Line current"
        [
        	stateTopic="sonoff_1/stat/sonoff/STATUS8",
        	transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Current"
        ]
        Type number : curr2   "Line current"
        [
        	stateTopic="sonoff_1/tele/sonoff/SENSOR",
        	transformationPattern="JSONPATH:$.ENERGY.Current"
        ]
        Type number : totaltoday     "Total energy today"
        [
        	stateTopic="sonoff_1/stat/sonoff/STATUS8",
        	transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Today"
        ]
        Type number : totalyest "Total energy yesterday"
        [
        	stateTopic="sonoff_1/stat/sonoff/STATUS8",
        	transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Yesterday"
        ]
        Type number : total "Total energy"
        [
        	stateTopic="sonoff_1/stat/sonoff/STATUS8",
        	transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Total"
        ]
        Type number : rssi      "WiFi Signal Strength"
        [
        	stateTopic="sonoff_1/tele/sonoff/STATE",
        	transformationPattern="JSONPATH:$.Wifi.RSSI"
        ]
    }

I have a total of 9 of these devices, so Sonoff_1…Sonoff_9 (I only show Sonoff_1 here)
I prefer using .things definitions rather than the GUI, since I am a “textual” guy and I think it is easier for me to define multiple things by doing cut and paste and then a replace…

To get the items defined I did the following definition in the .items file:

Switch Sonoff_1_Switch
	{
		channel="mqtt:topic:mosquitto:sonoff_1:sw_cmd1",
		channel="mqtt:topic:mosquitto:sonoff_1:sw_fb1",
		channel="mqtt:topic:mosquitto:sonoff_1:sw_fb2",
		channel="mqtt:topic:mosquitto:sonoff_1:sw_fb3"
	}
// ***********************************************************************************************************
// following definitions retrieves the info from the Status8 command
// and periodic TELE feedback and stores the results in the corresponding items
Number Sonoff_1_V	"S1_V [%.0f V]"
	{
		channel="mqtt:topic:mosquitto:sonoff_1:volt1",
		channel="mqtt:topic:mosquitto:sonoff_1:volt2"
	}
Number Sonoff_1_P	"S1_P [%.0f W]"
	{
		channel="mqtt:topic:mosquitto:sonoff_1:pwr1",
		channel="mqtt:topic:mosquitto:sonoff_1:pwr2"
	}
Number Sonoff_1_I	"S1_I [%.3f A]"	(gHistory, gSonoff_Chart_I)
	{
		channel="mqtt:topic:mosquitto:sonoff_1:curr1",
		channel="mqtt:topic:mosquitto:sonoff_1:curr2"
	}
Number Sonoff_1_E	"S1_E [%.3f kWh]"
	{
		channel="mqtt:topic:mosquitto:sonoff_1:totaltoday"
	}
Number Sonoff_1_Ey	"S1_Ey [%.3f kWh]"
	{
		channel="mqtt:topic:mosquitto:sonoff_1:totalyest"
	}
Number Sonoff_1_Et	"S1_Et [%.1f kWh]"
	{
		channel="mqtt:topic:mosquitto:sonoff_1:total"
	}
// ***********************************************************************************************************
// following definition sends a Status8 command to force sending of voltage/current/power/energy back
// this can be place on the sitemap/HABpanel to do a manual update of the info
Switch Sonoff_1_Get_VPI		(gSonoff_Get_VPI)
	{ 	channel="mqtt:topic:mosquitto:sonoff_1:get_vpi"			}
// ***********************************************************************************************************
// following definition resets the energy accumulator for today and total
Switch Sonoff_1_Reset_E
	{ 	channel="mqtt:topic:mosquitto:sonoff_1:reset_e"					}
Switch Sonoff_1_Reset_Et
	{ 	channel="mqtt:topic:mosquitto:sonoff_1:reset_et"				}
// ***********************************************************************************************************
// following definition shows online/offline state
String  Sonoff_1_LWT	(gSonoff_LWT)
	{ 	channel="mqtt:topic:mosquitto:sonoff_1:lwt"					}
// ***********************************************************************************************************
// following definition extracts the firmware version
String Sonoff_1_FW
	{ 	channel="mqtt:topic:mosquitto:sonoff_1:fwr"		}
// ***********************************************************************************************************
// switch to trigger status update off all info
Switch Sonoff_Status_Querry "Query all Sonoffs"
	{
		channel="mqtt:topic:mosquitto:sonoff_1:querry",
		channel="mqtt:topic:mosquitto:sonoff_2:querry",
		channel="mqtt:topic:mosquitto:sonoff_3:querry",
		channel="mqtt:topic:mosquitto:sonoff_4:querry",
		channel="mqtt:topic:mosquitto:sonoff_5:querry",
		channel="mqtt:topic:mosquitto:sonoff_6:querry",
		channel="mqtt:topic:mosquitto:sonoff_7:querry",
		channel="mqtt:topic:mosquitto:sonoff_8:querry",
		channel="mqtt:topic:mosquitto:sonoff_9:querry"
	}

You’ll notice the multiple channels assigned to the switch. This is to get an update for a switch based on different MQTT topics (tele, and 2 different stat)
I also have a rule, that triggers based on a switch change and does an automatic query off all parameters (voltage, current, power, …) after a 2s delay, so that I do not have to wait for the tele message that comes only every 5 minutes.
Here is the rule for that:

import java.util.concurrent.locks.ReentrantLock
import org.eclipse.smarthome.model.script.ScriptServiceUtil

val RFN	 										= "SONOFF"
var ReentrantLock 	Sonoff_PowUpdatelock 		= new ReentrantLock()
var Timer 			Sonoff_Delay_Timer 			= null

// ********************************************************
// Sonoff POW data update upon state change
// ********************************************************
rule "Sonoff POW data update"
when
	Member of gSonoff_Switch changed
then
    if(triggeringItem.state == NULL) return;

	//logInfo(RFN, "#*#*#*#*#*#*#*#*#*#* SONO: POW update received")
	var gotLock = new Boolean(Sonoff_PowUpdatelock.tryLock)

	//logInfo(RFN, "#*#*#*#*#*#*#*#*#*#* SONO: POW update entry")

	try
	{
		if(gotLock){
			//logInfo(RFN, "#*#*#*#*#*#*#*#*#*#* SONO: POW update locked")
			if(Sonoff_Delay_Timer !== null && !Sonoff_Delay_Timer.hasTerminated) {
				Sonoff_Delay_Timer.cancel
				Sonoff_Delay_Timer = null
			}
			Sonoff_Delay_Timer = createTimer(now.plusSeconds(2), [|
				gSonoff_Get_VPI?.members.forEach[GenericItem sw|
					sw.sendCommand(ON)
					Thread::sleep(100)
					sw.sendCommand(OFF)
					Thread::sleep(100)
				]
				Sonoff_Delay_Timer = null
			])
		}
	}
	finally
	{
		if(gotLock){
			Sonoff_PowUpdatelock.unlock
			//logInfo(RFN, "#*#*#*#*#*#*#*#*#*#* SONO: POW update unlocked")
		}
	}
	//logInfo(RFN, "#*#*#*#*#*#*#*#*#*#* SONO: POW update exit")
end

For that to work, you have to define some groups in the items file:

Group:Switch	gSonoff_Switch		"Group Sonoff Switches"
Group:Switch	gSonoff_Get_VPI		"Group to update Voltage and Current"

This might be a little over complicated, but it seems to work nicely in my setup (and sitemap)
@rossko57, you were right, the 8 and 2 commands in the switch item definition were not necessary, those were holdovers from an earlier time to get the voltage, current,power,… in one shot, but did not work, since the update would give the old information (i.e. when I switch off, voltage would still be 120V rather than 0V). I solved this by the delayed rule shown above…

Again, thanks for you help! I managed to migrate my stuff now from MQTT1 to MQTT2!!

3 Likes

Hello!
I’m using bridge RF with Tasmota FW to replace RF remote and it works. Now i want bulid sitemap with switch:

Switch item=pilotled mappings=[red=“RED”, green=“GREEN”, blue=“BLUE”]

Here are RF code:
RED = RfSync 12360; RfLow 410; RfHigh 1170; RfCode #DA3B09
GREEN = RfSync 12380; RfLow 410; RfHigh 1150; RfCode #DA3B0A
BLUE = RfSync 12360; RfLow 410; RfHigh 1170; RfCode #DA3B0B

Could someone help me with that. I don’t know how bulid things/items with only one RF Code and use it in sitemap. :frowning:

can you please explain on the tasomatized switch what topic you use in the MQTT configuration field?
for instance in the example of the sonoff-s20 what do you enter in the topic and full topic fields?

For Topic, I tend to use a specific name for the device. For example swLivingRoomLight for my living room light switch.

For Full Topic leave this as per the default %prefix%/%topic% otherwise a whole bunch of tutorials won’t work for you.

With the above mentioned configuration, to turn my switch on I would send

ON

to

cmnd/swLivingRoomLight/POWER

In the above the %prefix% is cmnd so Tasmota knows you’re sending a command. Some others you might come across are stat and tele which are topics that Tasmota usually publishes state information to.

I would recommend reading this page thoroughly to get a good understanding of it all!

https://tasmota.github.io/docs/MQTT/