MQTT with Tasmota (Update state on hardwarebutton and get IP)

Hello everyone,

currently I try to get my SWA2 Wifi-Plug (running latest Tasmota) to response its IP Address. Also I try to update the state (on / off) to OH2… Everything else works (like changing the state) but those two problems I’m not able to solve :frowning:

xy.items:

    Switch      mqtt_switch_1       "Schalter 1 [%s]"   {mqtt=">[mosquitto:steckdosen/sonoff_001/cmnd/Power1:command:*:default],<[mosquitto:steckdosen/sonoff_001/stat/Power1:state:default]"}
    String      mqtt_switch_1_state	"Test [%s]" 	{mqtt="<[mosquitto:steckdosen/sonoff_001/stat/IPAddress1:state:JSONPATH($.DS18x20.DS1.Temperature)]"}

xy.sitemap:

    sitemap xy label="MQTT" {
        
        Frame label="MQTT-Schalter" {
            Switch item=mqtt_switch_1 icon="light"
            Text item=mqtt_switch_1_state
        }

    }

Can you help me solving this problem?

Greetings
Kel

I have not looked up the topics now and assume that you have looked them up yourself in the wiki correctly.

I think the IP topic will not update itself on a specific Intervall.
You have to trigger it within a rule with a cmnd topic.
We had the same problem for tasmota firmware versions in the sonoff topic.

About the state:
Where is it missing currently?
In a special UI or even in the logs?

Got it working :smiley:

Here is what I’ve done, may it help someone:

Switch      mqtt_switch_1       "Steckdose 1"   { mqtt=">[mosquitto:cmnd/steckdosen/sonoff_001/POWER:command:*:default], <[mosquitto:stat/steckdosen/sonoff_001/POWER:state:default]" }
String      mqtt_switch_1_ap    "Wlan: [%s]"    { mqtt="<[mosquitto:tele/steckdosen/sonoff_001/STATE:state:JSONPATH($.Wifi.SSId)]" }
String      mqtt_switch_1_si    "Stärke: [%s]"  { mqtt="<[mosquitto:tele/steckdosen/sonoff_001/STATE:state:JSONPATH($.Wifi.RSSI)]" }

Too bad I could not combine both strings to a single line like: “Wlanname (100%)”

You could combine the two into one String item within a rule that’s triggered when either of those two items are updated, and that new item can be shown in your sitemap or HabPanel etc.

Hi,

thank you very much for your reply. That sounds very interesting :smiley:
Can you help me archive that?

I tried to combine the mqtt values, but it changes it to the first and than to the second value returned by mqtt:

mqtt="<[mosquitto:tele/steckdosen/sonoff_001/STATE:state:JSONPATH($.Wifi.SSId)], <[mosquitto:tele/steckdosen/sonoff_001/STATE:state:JSONPATH($.Wifi.RSSI)]"

Greetings
Kel

You want to create a completely new “proxy” item, which has no binding configuration.
Then you add a string combining your existing (working) VB items within a rule and then send that string to that proxy item.

1 Like

Hi binderth,

good idea, that works very well. For everyone else: this helped me: How to "add" multiple items into one sitemap string

Greetings

2 Likes