Hi.
I have 6 temperature sensors on a 1-wire bus hanging from a Sonoff TH10. TASMOTA reports them as follows:
22:37:55 MQT: th10_02/tele/SENSOR = {"Time":"2019-03-15T22:37:55", "DS18B20-1":{"Id":"01159038DEFF","Temperature":53.6}, "DS18B20-2":{"Id":"011590B1DEFF","Temperature":53.6}, "DS18B20-3":{"Id":"011590B342FF","Temperature":46.4}, "DS18B20-4":{"Id":"011590E289FF","Temperature":39.9}, "DS18B20-5":{"Id":"0415A231A5FF","Temperature":49.8}," DS18B20-6":{"Id":"0415A28B86FF","Temperature":51.5},"TempUnit":"C"}
All good, except that 1,2,3,4,5,6 is not the order they’re in on the chain. I suspected this might happen, so I took a note of the serial number on each one before I installed them.
At the moment, each sensor is declared simlar to:
- platform: mqtt
name: **"TankTemp1"**
state_topic: "th10_02/tele/SENSOR"
unit_of_measurement: "°C"
value_template: "{{ value_json[**'DS18B20-6'**].Temperature }}"
payload_available: "Online"
payload_not_available: "Offline"
It can be seen that TASMOTA has declared them in numerical order by serial number, so what I wish to call TankTemp1, TASMOTA calls DS18B20-6.
Can anyone please help me formulate a value_template which will allow me, rather than looking up the temperature of “DS18B20-6” to instead lookup the temperature associated with the transducer whose “Id” is “01159038DEFF”?
I’m sure once I see an example, I’ll get the idea pretty quickly. Many thanks.