SonOff Tasmota DS18x20 multiple 1-Wire sensor Home Assistant JSON template

1,043 views
Skip to first unread message

pete c

unread,
Nov 8, 2018, 1:57:30 PM11/8/18
to SonoffUsers
 
Been trying to configure JSON template lines for Home Assistant connecting to Sonoff Tasmota firmware multiple 1-wire sensor device.

One device works but multiple same devices do not work.  Keep trying different descriptors from console message and nothing is working yet.

Console message here for 3 1-wire devices is:

3:45:55 MQT: /1Wire/SENSOR = {"Time":"2018-11-08T13:45:55", "DS18x20":{"DS1":{"Type":"DS18S20", "Address":"10AE56130008007B", "Temperature":71.3}, "DS2":{"Type":"DS18S20", "Address":"10A52F47000800CB", "Temperature":71.9}, "DS3":{"Type":"DS18B20", "Address":"280D7E5B04000049", "Temperature":81.1}}, "TempUnit":"F"}

JSON template that works:

- platform: mqtt
    state_topic: '/1Wire/SENSOR'
    name: 'Hallway'
    unit_of_measurement: '°F'
    value_template: "{{ value_json.DS18x20.DS1.Temperature }}"

JSON template that does not work:

- platform: mqtt
    state_topic: '/1Wire/SENSOR'
    name: 'Basement'
    unit_of_measurement: '°F'
    value_template: "{{ value_json.DS18x20.DS2.Temperature }}"

Any suggestions to make this work?

I have seen many templates but only for temperature and humidity sensors like  DHT22's or different sensors but not same sensors connecting to one SonOff.

Philip Knowles

unread,
Nov 9, 2018, 6:33:03 AM11/9/18
to pete c, SonoffUsers

This is how the JSON works in openHAB

Number CHPump_Temperature "CH Flow Temperature [%.1f C]" (GroundFloor, TEMP) {mqtt="<[mosquitto:tele/sonoff-pump/SENSOR:state:JSONPATH($.DS18B20-1.Temperature)]"}

Number CHPump_TemperatureR "CH Return Temperature [%.1f C]" (GroundFloor) {mqtt="<[mosquitto:tele/sonoff-pump/SENSOR:state:JSONPATH($.DS18B20-2.Temperature)]"}

And this is the console output

12:28:51 MQT: tele/sonoff-pump/SENSOR = {"Time":"2018-11-09T12:28:51","DS18B20-1":{"Id":"0417C15DF4FF","Temperature":20.6},"DS18B20-2":{"Id":"0517C143A6FF","Temperature":19.4},"DS18B20-3":{"Id":"0517C16908FF","Temperature":18.9},"DS18B20-4":{"Id":"0517C172E7FF","Temperature":30.1},"DS18B20-5":{"Id":"0517C17422FF","Temperature":19.1},"TempUnit":"C"}

 

There appear to be differences and not really sure why.

 

Don’t know if it helps any but you can see how openHAB handles it

 

Regards

 

Phil K

Sent from Mail for Windows 10

--
You received this message because you are subscribed to the Google Groups "SonoffUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

pete c

unread,
Nov 9, 2018, 7:40:45 AM11/9/18
to SonoffUsers
Thank you Phil.  Got it tinkering a bit with the sentences.  Posting it here for anyone else using a modded SonOff WiFi Basic and 1-wire DS18S20 sensors.
Adding more DS18S20 sensors plus DHT22 sensors.

Console message here for 3 1-wire devices is:

3:45:55 MQT: /1Wire/SENSOR = {"Time":"2018-11-08T13:45:55", "DS18x20":{"DS1":{"Type":"DS18S20", "Address":"10AE56130008007B", "Temperature":71.3}, "DS2":{"Type":"DS18S20", "Address":"10A52F47000800CB", "Temperature":71.9}, "DS3":{"Type":"DS18B20", "Address":"280D7E5B04000049", "Temperature":81.1}}, "TempUnit":"F"}

JSON template that works:

- platform: mqtt
    state_topic: '/1Wire/SENSOR'
    name: 'Hallway'
    unit_of_measurement: '°F'
    value_template: '{{ value_json ["DS18x20"]["DS1"]["Temperature"] }}'
- platform: mqtt
    state_topic: '/1Wire/SENSOR'
    name: 'Basement'
    unit_of_measurement: '°F'
    value_template: '{{ value_json ["DS18x20"]["DS2"]["Temperature"] }}'
    - platform: mqtt
       state_topic: '/1Wire/SENSOR'
       name: 'SonOff'
       unit_of_measurement: '°F'
       value_template: '{{ value_json ["DS18x20"]["DS3"]["Temperature"] }}'


Reply all
Reply to author
Forward
0 new messages