You still haven’t said what attribute you want… and it looks like you are referencing the sensor you are creating in a value_template that is creating the sensor! - how does sensor.soil_01_Temperature even exist when the same value_template is creating it? This is an impossible loop.
What should i do?
how do i remedy this?
Thanks
well what is the state topic and what do you want to extract from it and what conditions are there?
Here i captured a message from the gateway (happens to be Soil_04):
{"rssi":-87,"snr":9.25,"pferror":15493,"packetSize":60,"message":"{\"name\":\"Soil_04\",\"tempc\":11.64284,\"hum\":82.26128,\"adc\":691}"}
So i basically want to parse the sensor name to send sensor Soil_04 data to home assistant as Soil_4 temp, hum and adc
All the messages come in the same so the name is the distinguishing factor.
What i was doing was suggested by another user to filter using the name, and it seemed to work.
Does that make sense?
Thank you!
doesn’t each sensor use a different topic?
no, because they communicate using lora, and the gateway passes the message on to home assistant as shown in the previous posting.
Another user suggested I uncomment my “topic” in the arduino code, but that gets embedded in the message as well, so a filter again would be used to extract it (i think).
Thanks for your help!
No it isn’t. It’s a filter for the incoming MQTT messages which share the same topic for multiple devices: read from the start. Whilst I agree that using state_attr
doesn’t make sense, the structure of the template is fine.
Works thus: if the incoming JSON has a name
of Soil_01
, take the tempc
as the new state; otherwise return the existing state (a “do-nothing” step).
I really don’t understand where the addition problem is coming from, though.