MQTT Auto discovery - multiple temerature sensors

Tags: #<Tag:0x00007fc4023ad8d8>

I am running version core-2021.3.4 on a Linux machine and is pretty new to this. I have a couple of homebuilt ESP8266 sensors to monitor humidity and temperature that are configured for mqtt discovery that work fine. I would like to monitor some temperatures using a couple of DS18B20 connected to one ESP8266 and my problem is to get the (currently) three temperatures to be picked up properly by Home Assistant.
I get no warnings but only one temperature show up (value is zero). The debug info from Home Assistant is as follows:

Topic: homeassistant/sensor/98b/MULTI_DS18B20_98b_T/config
device_class: temperature
name: Temperature_35593
state_topic: multi_t/sensor/98b/state
unit_of_measurement: °C
unique_id: T_98b
value_template: >-
  {{ value_json.temperature1 },{ value_json.temperature2 },{
  value_json.temperature3 }}
  identifiers: T_98b
  manufacturer: DIY
  model: DS18B20
  name: ESP8266 Multi Temperature Sensor
  sw_version: 1.0.0
platform: mqtt

Subscribed topics:
  * Received 18:03:10
  * QoS: 0
  * Payload:
temperature1: '23.06' temperature2: '23.00' temperature3: '23.00'
(and so on)

I have used a mix of decimal and hex representation of the last part of the MAC-address to make each ESP8266 name unique and also some other creative naming.

It is probably a simple thing to correct but most things google find are the non-discovery mqtt integrations.

Any help would be appreciated!


I think you need to create 3 discovery messages, one for each temperature sensor.

That worked obviously… I was just hoping for it to be less chatty. Oh well, I just have to live with that :slight_smile: