I want to be able to track the status of a variable of a tasmota device. How can I do this? By default I see power, switch status etc of my sonoff switch but not e.g. the variables. Subscribing to stat/<mySonoffDevice>/RESULT
in the MQTT integration test interface works well. But how can I permanently use e.g. the value of var1
in my dashboard?
Show your configuration for the sensor. Format it for the forum correctly.
Show the data received.
Then we can help you.
Do I need an explicit sensor for it? (I did not set up one yet.)
OK I set up one:
mqtt:
sensor:
- state_topic: "stat/SP13/RESULT"
name: "Sparpumpe"
It works but overwhelms me with tons of json payload. How do I filter for certain keys (e.g. var1)?
How else were you thinking of doing it?
Since the device delivers various data without my intervention I thought all is there by default.
Does var1
exist as an entity or an attribute of an entity?
The sonoff Tasmota device delivers power, SSID etc. without further config. It’s not clear to me which device data I seen by home assistant by default.
Look in Developer Tools → States. Find the entities supplied by this device. Does var1
exist as an entity or as an attribute of one of the entities (right hand column).
If not, you will have to create an mqtt sensor.
Yes, states keeps spitting alle the json strings from the device MQTT messegaes like {"Mem1":"0.2","Mem2":"20","Mem3":"15","Mem4":"","Mem5":"98765","Mem6":"","Mem7":"","Mem8":"","Mem9":"","Mem10":"","Mem11":"","Mem12":"","Mem13":"","Mem14":"","Mem15":"","Mem16":""}
but if I try
{{ state_attr('sensor.sparpumpe', 'Mem1') }}
in template I get None
.
Is Mem1
actually an attribute of sensor.sparpumpe
?
Check Developer Tools → States. And look in the right hand column next to that sensor.
If it is not listed as an attribute you have to make your own sensor.
Just because what you want is in the message sent to the topic does not mean that Home Assistant has actually assigned it as an entity or an attribute.
sensor.sparpumpe sends a alternating stream of json strings like the one above or this: {"Var1":"20.200","Var2":"20.0","Var3":"-0.010","Var4":"","Var5":"","Var6":"","Var7":"","Var8":"","Var9":"","Var10":"","Var11":"","Var12":"","Var13":"","Var14":"","Var15":"","Var16":""}
. One of the keys is “Var1”.
Stumbled by mistake - blame google…
Solved this yesterday, feel free to ping if help is needed.
See here.