onewire platform supports sensors which that using the One wire (1-wire) bus for communication.
Every 1-wire device has a (globally) unique ID that identifies the device on the bus. The first two digits identify a device family and the last 14 digits are a globally unique number given to it during manufacturing.
Different families have different functionality and can measure different quantities.
Each 1-wire component data sheet describes the different properties the component provides. The owfs software adds some extra tools to make it easier for DIY implementers to use the component.
|12||DS2406||2 sensed (sensed.A/B) 4|
|29||DS2408||8 sensed (sensed.0-7) 4|
|12||DS2406||Temperature and pressure when using TAI-8570 1|
|26||DS2438||Temperature, Voltage, Current (pressure when using B1-R1-A, illuminance when using S2-R1-A, humidity when using compatible Honeywell or Humirel sensor) 2|
|7E||EDS00xx||Temperature/Humidity/Barometric pressure/Light 6|
|EF||HobbyBoard||Temperature, Humidity, Moisture, Wetness 3|
|05||DS2405||1 PIO 4|
|12||DS2406||2 latches (latch.A/B) and 2 PIOs (PIO.A/B) 4|
|29||DS2408||8 latches (latch.0-7) and 8 PIOs (PIO.0/7) 4|
The TAI-8570 Pressure Sensor is based on a 1-wire composite device by AAG Electronica. It contains, above 1-wire components, also a barometer, hygrometer and illuminance sensors. This onewire platform can read and present values from that device, but the sensors will default to disabled 4.
For hobbyists, it is quite common to use DS2438 Smart Battery Monitor as a multipurpose measurement node that can place temperature, humidity and luminosity on the 1-wire bus by just adding some standard components to the DS2438. For different component types, there are ready-made algorithms implemented in owfs. Those are exposed by the owfs software and can be read by this platform. The B1-R1-A/pressure is exposed as a barometric pressure sensor. S2-R1-A/illuminance is presented as an illuminance sensor. For a more detailed description of these properties, refer to the owfs documentation. For this component, the more basic quantities (temperature, VAD, VDD and IAD) are exported as separate sensors. Please note that some of the sensors will default to disabled 4.
Hobbyboards is a company that has been selling DIY boards of different kinds. The company has been away from the market for some time, so no reference to the boards can be made. This platform has an implementation for some of those.
Some sensors are disabled by default to avoid overloading the bus. These can be activated by opening the integrations page in your configuration, listing your 1-Wire integration devices and updating the entity.
Bridge devices have no sensors. The
mainbranches are searched for additional 1-wire devices during discovery.
Multisensors manufactured by Embedded Data Systems. Currently only EDS0066 (temperature/barometric pressure) and EDS0068 (temperature/humidity/barometric pressure/light) are supported.
The 1-Wire bus can be connected directly to the IO pins of Raspberry Pi or by using a dedicated interface adapter, for example DS9490R or adapters based on DS2482-100 that can be directly attached to the IO pins on the Raspberry Pi.
It is also possible for this platform to interface with a remote 1-wire host over a network connection using owfs and owserver.
In order to setup 1-Wire support on Raspberry Pi, you’ll need to edit
/boot/config.txt. This file can not be edited through ssh. You have to put your SD card to a PC, and edit the file directly.
/boot/config.txt on the Home Assistant Operating System, use this documentation to enable SSH and edit
If you use an external pull-up resistor and the default GPIO 4 for the data line, add the following line:
If you don’t want to use an external resistor, you can use a built-in one using the following line:
It is also possible to use a different GPIO pin like this to change it to pin 15:
Furthermore, it is also possible to have multiple GPIOs as one-wire data channel by adding multiple lines like this:
You can read about further parameters in this documentation: Raspberry Pi Tutorial Series: 1-Wire DS18B20 Sensor.
When using the GPIO pins on Raspberry Pi directly as a 1-wire bus, the description above uses two kernel modules.
1w_gpio, that implements the 1-wire protocol, and
1w_therm, that understands the DS18B20 (family 28) components inner structure and reports temperature.
There is no support for other device types (families) and hence this onewire platform only supports temperature measurements from family 28 devices.
If you set up ssh, you can check the connected one-wire devices in the following folder: /sys/bus/w1/devices
The device IDs begin with
owserver on Linux hosts is part of the owfs 1-Wire file system. When a 1-wire interface adapter is used, you can access sensors on a remote or local Linux host that is running
owserver by default runs on port 4304. Use the
host option to specify the host or IP of the remote server, and the optional
port option to change the port from the default.
Adding 1-Wire to your Home Assistant instance can be done via the user interface, by using this My button:
If the above My button doesn’t work, you can also perform the following steps manually:
onewire is added to Home Assistant, it will generate an ID for the sensor. You can specify a friendly name for the sensor with the name configuration option.
# Named sensor configuration.yaml entry sensor: - platform: onewire names: GENERATED_ID: FRIENDLY_NAME
Upon startup of the platform, the 1-wire bus is searched for available 1-wire devices. On Bridge devices, the
main branches are recursively searched. For each device that this platform handles (see list of supported devices above), the platform adds one sensor for each physical quantity it measures. The name of the sensor is the device ID with the physical quantity it measures appended. Unsupported sensors are noted with a warning message in the log.
Each sensor will present its value in the state variable and for presentation purposes, rounded to one decimal for analog values and as integers for counts.
Each sensor also exposes some additional attributes.
device_file: /28.FF5C68521604/temperature << Device path in owfs file system (or on Rpi system directory) raw_value: 31.9375 << The raw measurement numbers as red from device. Not rounded. unit_of_measurement: °C friendly_name: 28.FF5C68521604 Temperature
This platform works with devices with multiple sensors, which will cause a discontinuity in recorded values. Existing devices will receive a new ID and therefore show up as new devices. If you wish to maintain continuity, it can be resolved in the database by renaming the old devices to the new names.
Connect to your database using the instructions from Database section. Check the names of sensors:
SELECT entity_id, COUNT(*) as count FROM states GROUP BY entity_id ORDER BY count DESC LIMIT 10;
Alter the names of sensors using the following examples:
UPDATE states SET entity_id='sensor.<sensor_name>_temperature' WHERE entity_id LIKE 'sensor.<sensor_name>%' AND attributes LIKE '%\u00b0C%'; UPDATE states SET entity_id='sensor.<sensor_name>_pressure' WHERE entity_id LIKE 'sensor.<sensor_name>%' AND attributes LIKE '%mb%'; UPDATE states SET entity_id='sensor.<sensor_name>_humidity' WHERE entity_id LIKE 'sensor.<sensor_name>%' AND attributes LIKE '%%%' ESCAPE '';
Remember to replace
<sensor_name> with the actual name of the sensor, as seen in the