Hi,
I have multiple DS18B20 connected to a Wemos D mini running Tasmota.
I see 3 diferend temperature valus in Tasmota.
Console showing:
15:10:40 MQT: tele/tmp/SENSOR = {“Time”:“2018-12-04T15:10:40”,“DS18B20-1”:{“Id”:“020491771E52”,“Temperature”:19.8},“DS18B20-2”:{“Id”:“021091776542”,“Temperature”:19.3},“DS18B20-3”:{“Id”:“021491776797”,“Temperature”:18.9},“TempUnit”:“C”}
But i am not able to get 3 difirerend valus in Home Assistant.
For 1 sensor it works fine.
sensor:
You are trying to read ‘DS18B20’ three times in home-assistant. The JSON output you posted in the first half of the post clearly lists ‘DS18B20-1’, ‘DS18B20-2’ and ‘DS18B20-3’.
My guess is you should change the value_template of each of your sensors accordingly.
platform: mqtt
name: “tmp1”
state_topic: “tele/tmp/SENSOR”
unit_of_measurement: ‘°C’
value_template: “{{ value_json.[‘DS18B20-1’].Temperature }}”
and
value_template: “{{ value_json.[“DS18B20-1”].Temperature }}”
and
value_template: “{{ value_json.[DS18B20-1].Temperature }}”
But it will not work for now.
Invalid config for [sensor.mqtt]: invalid template (TemplateSyntaxError: unexpected char ‘‘’ at 14) for dictionary value @ data[‘value_template’]. Got ‘{{ value_json[‘DS18B20-1’].Temperature }}’. (See ?, line ?). Please check the docs at XXXX://home-assistant.io/components/sensor.mqtt/ Invalid config for [sensor.mqtt]: invalid template (TemplateSyntaxError: unexpected char ‘‘’ at 14) for dictionary value @ data[‘value_template’]. Got ‘{{ value_json[‘DS18B20-2’].Temperature }}’. (See ?, line ?). Please check the docs at XXXX://home-assistant.io/components/sensor.mqtt/ Invalid config for [sensor.mqtt]: invalid template (TemplateSyntaxError: unexpected char ‘‘’ at 14) for dictionary value @ data[‘value_template’]. Got ‘{{ value_json[‘DS18B20-3’].Temperature’. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.mqtt/
Yes, it is very fussy about the quotes - and rightly so! As mentioned, some of the above messages don’t contain ASCII quotes: they’ve been replaced by “open / close quotes”. These need to be proper double quotes. Also, in my example, because I’m quoting the sensor name as the list index, I have to use single quotes because the whole template is inside double quotes.
This all works fine for me, but I would like to index it on “Id” rather than on the “DS18B20-1” name which TASMOTA has assigned it. Does anyone know how I might do that?
- platform: mqtt
state_topic: "sonoff/tele/SENSOR"
name: "Temperature bas du chauffe-eau"
unit_of_measurement: 'deg. C'
value_template: “{{ value_json['DS18B20-1'].Temperature }}”
The value of the sensor is: “16.0” With semicolon !
So The graphe can’t be displayed !
How can I have a floating value and not a text value ?
Thanks for your help.
Thierry
Pretty sure that there is a limitation within Tasmota of only one of any particular sensor type per device?
I tried two ultrasonic sensors on one device using tasmota and only one ever output data. Tried sonoffs and wemos and both the same result.
PS: You can configure three different type sensors though…just not three the same.
Dear @wellsy
I cannot agree to your interpretation: For onewire attached DS18B20 sensors the current Sonoff Tasmota firmware can definitely handle more than one device. I have three DS18B20 attached (working!) on a Sonoff Basic using onwire. I know that you can compile the firmware using an older library which only supports one DS18B20, but this is not default… Surely other sensors can only be used in a single configuration. I also ran into difficulties using two MCP23008.
At the moment i test the ESPHOME firmware, and i am surprised about the functionality and the capabillities…