GENWiki

Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


opensource:kmtronic_ds18b20

KMTronic DS18B20 Temperature Sensors

XML

The KMTronic DS18B20 provides an XML formatted status for its sensors (up to 4) by using /status.xml. That is, if your DS18B20 is at 10.1.2.3, then http://10.1.2.3/status.xml will render the status of the sensors in the following format:

<?xml version="1.0" encoding="UTF-8"?>
<response>
	<sensor>
		<id>28AAB2221E13028D</id>
		<name>GROUND</name>
		<temp>3.31</temp>
	</sensor>
	<sensor>
		<id>28AA8D0D1E13028C</id>
		<name>CABLEFT</name>
		<temp>11.18</temp>
	</sensor>	
	<sensor>
		<id>28158C4592140229</id>
		<name>CABRIGHT</name>
		<temp>4.00</temp>
	</sensor>
	<sensor>
		<id>287DDB4592110270</id>
		<name>WATER</name>
		<temp>3.68</temp>
	</sensor>	
	<version>
		<model>KMtronic DS1820 Temperature Monitor</model>
		<ver>2.0</ver>
	</version>
</response>

REST

Homeassistant's RESTfull integration handles this just fine with something like:

rest:
  - resource: http://10.1.0.34/status.xml
    scan_interval: 300
    verify_ssl: false
    timeout: 30
    sensor:
      - name: Ground
        unit_of_measurement: "°C"
        state_class: measurement
        device_class: temperature
        value_template: "{{ value_json.response.sensor[0].temp }}"
      - name: CabLeft
        unit_of_measurement: "°C"
        state_class: measurement
        device_class: temperature
        value_template: "{{ value_json.response.sensor[1].temp }}"
      - name: CabRight
        unit_of_measurement: "°C"
        state_class: measurement
        device_class: temperature
        value_template: "{{ value_json.response.sensor[2].temp }}"
      - name: Water
        unit_of_measurement: "°C"
        state_class: measurement
        device_class: temperature
        value_template: "{{ value_json.response.sensor[3].temp }}"
 

Because of the structure of the XML file, we cannot get the elements via a name, but we can simply index them by the order they appear, which remains constant.

× iphelper toolbox

you see this when javscript or css is not working correct

Untested
IP Address:
First usable:
Subnet:
Last usable:
CIDR:
Amount of usable:
Network address:
Reverse address:
Broadcast address:

/home/genwiki/public_html/data/pages/opensource/kmtronic_ds18b20.txt · Last modified: by genadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki
GEN - UK Oursourcing and Support