Configure Channel for mqtt messages from tasmota

I am using several tasmota devices. With my newest device to get info from Stromzähler, the JSONPATH is not working correctly.

This is the Item configuration:

Here the channels (text not working properly, therefore image). Last channel ist the newest:

Here the message from tasmota console:
17:19:03.667 MQT: tele/tasmota_6910FA/SENSOR = {"Time":"2021-07-03T17:19:03","MT175":{"Total_in":965.0}

This is what I get:

What I want is 965, the Total_in Energy

Do you have the JSONPath Transformation Service installed?

I would recommend performing the transform at the Channel itself, not as a Profile on the Link between your Channel and Item. See section 6 for examples.

Yes, JSONPATH is installed and working for the other tasmota devices. When I do it in the channel, I have to set several channels for each Info (Time, Energy, CurrentEnergy, EnergyOut). If I do it as I did it for the other items, I have 1 channel and several Item.s

Sure, but it is the more unusual method - most people have one Channel and one Item.

Your Tasmota JSON string only contains the single item anyway, unless you didn’t show us to full string?

Thanks! I tried it with the method shown now, but still not working.

Are you editing your Channels using the UI, or modifying the YAML?

I’ve just created a test Thing, Channel and Item with the following parameters:

Channel

YAML
UID: mqtt:topic:MosquittoMqttBroker:testThing
label: testThing
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:MosquittoMqttBroker
channels:
  - id: powerIn
    channelTypeUID: mqtt:number
    label: Power In
    description: ""
    configuration:
      stateTopic: tele/tasmota_6910FA/SENSOR
      transformationPattern: JSONPATH:$.MT175.Total_in

Item

Link

MQTT

I then sent (note that this has an extra curly brace at the end compared to your snippet)

{"Time":"2021-07-03T17:19:03","MT175":{"Total_in":965.0}}

to

tele/tasmota_6910FA/SENSOR

using MQTT Explorer

And as you can see the Item is updating correctly.

One note: make sure you wait long enough for Tasmota to actually transmit the SENSOR data on the TELE topic - it’s only once every 5 minutes by default.

I then sent (note that this has an extra curly brace at the end compared to your snippet)

I think this is the problem. Tasmota is missing one curly brace at the end.

22:17:50.828 MQT: tele/tasmota_6910FA/SENSOR = {“Time”:“2021-07-03T22:17:50”,“MT175”:{“Total_in”:965.0}

And then openhab is not able to interprete it. So I think I have to work on this and see how to fix it.

I’ve never seen Tasmota mangle a JSON string before, very strange! Do you have a link to your device?

I am going to send the link to the source with instructions how to configure tasmota tomorrow, I do not have it at hand.

But I had to configure it via script:

And here you see tasmota really mangles the JSON. I do not have a link, it is a esp8266 device to read data from MT175 energy meter.

This is where I got the info:

Sorry, its German

What version of Tasmota are you running? Run

STATUS 2

in the Tasmota console and you should get some useful output.

Did you do the SetOption19 1 command in the Tasmota console?

This is an issue with Tasmota, rather than openHAB, so you might find faster help either from the author of the guide you followed (looks like one other person in the comments (#20) saw the same missing parenthesis), or from the Tasmota Discord group.

1 Like

This gives me
12:03:58.980 MQT: stat/tasmota_6910FA/STATUS2 = {“StatusFWR”:{“Version”:“9.3.1(tasmota)”,“BuildDateTime”:“2021-04-12T08:21:26”,“Boot”:31,“Core”:“2_7_4_9”,“SDK”:“2.2.2-dev(38a443e)”,“CpuFrequency”:80,“Hardware”:“ESP8266EX”,“CR”:“365/699”}}

I do not remember the SetOption19 1
Should I do that?

Well, the guide you’re following says to do that in Step 10 to enable Auto Discovery, though remember that the guide was written for use with Home Assistant, not openHAB. Auto Discovery from Tasmota should work in openHAB.

This adds the state and status, but not the sensor information:

UID: mqtt:homeassistant_6910FA:a4e0d49a09:6910FA
label: Tasmota (Switch, Sensor)
thingTypeUID: mqtt:homeassistant_6910FA
configuration:
  topics:
    - switch/6910FA_RL_1
    - sensor/6910FA_status
  basetopic: homeassistant
bridgeUID: mqtt:broker:a4e0d49a09
14:04:15.852 MQT: tele/tasmota_6910FA/HASS_STATE = {"Version":"9.3.1(tasmota)","BuildDateTime":"2021-04-12T08:21:26","Module or Template":"Sonoff Basic","RestartReason":"External System","Uptime":"0T20:14:05","Hostname":"tasmota_6910FA-4346","IPAddress":"192.168.103.48","RSSI":"56","Signal (dBm)":"-72","WiFi LinkCount":3,"WiFi Downtime":"0T00:00:30","MqttCount":12,"LoadAvg":19}
14:04:20.825 MQT: tele/tasmota_6910FA/STATE = {"Time":"2021-07-04T14:04:20","Uptime":"0T20:14:10","UptimeSec":72850,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":12,"POWER":"ON","Wifi":{"AP":1,"SSId":"FritzBox7412","BSSId":"2A:65:11:EF:0B:3F","Channel":11,"RSSI":54,"Signal":-73,"LinkCount":3,"Downtime":"0T00:00:30"}}
14:04:20.833 MQT: tele/tasmota_6910FA/SENSOR = {"Time":"2021-07-04T14:04:20","MT175":{"Total_in":968.0,"Total_out":17}
14:04:30.840 MQT: tele/tasmota_6910FA/HASS_STATE = {"Version":"9.3.1(tasmota)","BuildDateTime":"2021-04-12T08:21:26","Module or Template":"Sonoff Basic","RestartReason":"External System","Uptime":"0T20:14:20","Hostname":"tasmota_6910FA-4346","IPAddress":"192.168.103.48","RSSI":"52","Signal (dBm)":"-74","WiFi LinkCount":3,"WiFi Downtime":"0T00:00:30","MqttCount":12,"LoadAvg":19}
14:04:35.815 MQT: tele/tasmota_6910FA/STATE = {"Time":"2021-07-04T14:04:35","Uptime":"0T20:14:25","UptimeSec":72865,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":12,"POWER":"ON","Wifi":{"AP":1,"SSId":"FritzBox7412","BSSId":"2A:65:11:EF:0B:3F","Channel":11,"RSSI":54,"Signal":-73,"LinkCount":3,"Downtime":"0T00:00:30"}}
14:04:35.823 MQT: tele/tasmota_6910FA/SENSOR = {"Time":"2021-07-04T14:04:35","MT175":{"Total_in":968.0,"Total_out":17}
14:04:45.848 MQT: tele/tasmota_6910FA/HASS_STATE = {"Version":"9.3.1(tasmota)","BuildDateTime":"2021-04-12T08:21:26","Module or Template":"Sonoff Basic","RestartReason":"External System","Uptime":"0T20:14:35","Hostname":"tasmota_6910FA-4346","IPAddress":"192.168.103.48","RSSI":"52","Signal (dBm)":"-74","WiFi LinkCount":3,"WiFi Downtime":"0T00:00:30","MqttCount":12,"LoadAvg":19}
14:04:50.807 MQT: tele/tasmota_6910FA/STATE = {"Time":"2021-07-04T14:04:50","Uptime":"0T20:14:40","UptimeSec":72880,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":12,"POWER":"ON","Wifi":{"AP":1,"SSId":"FritzBox7412","BSSId":"2A:65:11:EF:0B:3F","Channel":11,"RSSI":54,"Signal":-73,"LinkCount":3,"Downtime":"0T00:00:30"}}
14:04:50.814 MQT: tele/tasmota_6910FA/SENSOR = {"Time":"2021-07-04T14:04:50","MT175":{"Total_in":968.0,"Total_out":17}

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.