The Linux kernel supports a truckload of sensors via the Linux Industrial I/O Subsystem. It would be nice to make such sensors visibile in Home Assistant. Ideally with support for querying local sensors, as well as querying remote sensors via libiio’s IIO Daemon (IIOD).
This would make it easy to use Raspberry Pi or other SBCs similarly to esphome and compatible micro controllers.
I would gladly work on implementing this myself, but the developer documentation is a bit too limited to get me started properly. On the other hand, looking at existing integrations that do something similar, like esphome or modbus, makes my head explode. Not blaming the docs or those existing integrations, this is merely due to my very limited coding experience.
A few examples of sensors I’m currently using with Linux IIO on Raspberry Pi or Odroid running OpenWrt:
root@owrtdroidc2:~# iio_info
Library version: 0.16 (git tag: v0.16)
Compiled with backends: local
IIO context created with local backend.
Backend version: 0.16 (git tag: v0.16)
Backend description string: Linux owrtdroidc2 4.19.69 #0 SMP Tue Sep 3 12:15:10 2019 aarch64
IIO context has 1 attributes:
local,kernel: 4.19.69
IIO context has 2 devices:
iio:device0: meson-gxbb-saradc
8 channels found:
voltage0: (input)
5 channel-specific attributes found:
attr 0: calibbias value: 11
attr 1: calibscale value: 0.992248
attr 2: mean_raw value: 1015
attr 3: raw value: 1015
attr 4: scale value: 1.757812500
voltage1: (input)
5 channel-specific attributes found:
attr 0: calibbias value: 11
attr 1: calibscale value: 0.992248
attr 2: mean_raw value: 1023
attr 3: raw value: 1023
attr 4: scale value: 1.757812500
voltage2: (input)
5 channel-specific attributes found:
attr 0: calibbias value: 11
attr 1: calibscale value: 0.992248
attr 2: mean_raw value: 149
attr 3: raw value: 135
attr 4: scale value: 1.757812500
voltage3: (input)
5 channel-specific attributes found:
attr 0: calibbias value: 11
attr 1: calibscale value: 0.992248
attr 2: mean_raw value: 21
attr 3: raw value: 19
attr 4: scale value: 1.757812500
voltage4: (input)
5 channel-specific attributes found:
attr 0: calibbias value: 11
attr 1: calibscale value: 0.992248
attr 2: mean_raw value: 1007
attr 3: raw value: 986
attr 4: scale value: 1.757812500
voltage5: (input)
5 channel-specific attributes found:
attr 0: calibbias value: 11
attr 1: calibscale value: 0.992248
attr 2: mean_raw value: 891
attr 3: raw value: 889
attr 4: scale value: 1.757812500
voltage6: (input)
5 channel-specific attributes found:
attr 0: calibbias value: 11
attr 1: calibscale value: 0.992248
attr 2: mean_raw value: 481
attr 3: raw value: 480
attr 4: scale value: 1.757812500
voltage7: (input)
5 channel-specific attributes found:
attr 0: calibbias value: 11
attr 1: calibscale value: 0.992248
attr 2: mean_raw value: 414
attr 3: raw value: 414
attr 4: scale value: 1.757812500
1 device-specific attributes found:
attr 0: current_timestamp_clock value: realtime
iio:device1: ccs811 (buffer capable)
5 channels found:
concentration_co2: (input, index: 0, format: be:U16/16>>0)
2 channel-specific attributes found:
attr 0: raw value: 1825
attr 1: scale value: 0.000100
concentration_voc: (input, index: 1, format: be:U16/16>>0)
2 channel-specific attributes found:
attr 0: raw value: 488
attr 1: scale value: 0.000000100
timestamp: (input, index: 2, format: le:S64/64>>0)
current: (input)
2 channel-specific attributes found:
attr 0: raw value: 5
attr 1: scale value: 0.001000
voltage: (input)
2 channel-specific attributes found:
attr 0: raw value: 434
attr 1: scale value: 1.612903
1 device-specific attributes found:
attr 0: current_timestamp_clock value: realtime
2 buffer-specific attributes found:
attr 0: data_available value: 0
attr 1: watermark value: 1
stijn@taz ~ iio_info -n 192.168.54.127
Library version: 0.15 (git tag: v0.15)
Compiled with backends: local xml ip usb serial
IIO context created with network backend.
Backend version: 0.21 (git tag: v0.21 )
Backend description string: 192.168.54.127 Linux display-rpi0w 5.4.80 #0 Thu Dec 3 17:36:51 2020 armv6l
IIO context has 3 attributes:
local,kernel: 5.4.80
uri: local:
ip,ip-addr: 192.168.54.127
IIO context has 1 devices:
iio:device0: sps30 (buffer capable)
5 channels found:
massconcentration_pm1: (input, index: 0, format: le:u19/32>>0)
2 channel-specific attributes found:
attr 0: input value: 6.390000
attr 1: scale value: 0.010000
massconcentration_pm2p5: (input, index: 1, format: le:u19/32>>0)
2 channel-specific attributes found:
attr 0: input value: 6.690000
attr 1: scale value: 0.010000
massconcentration_pm4: (input, index: 2, format: le:u19/32>>0)
2 channel-specific attributes found:
attr 0: input value: 6.640000
attr 1: scale value: 0.010000
massconcentration_pm10: (input, index: 3, format: le:u19/32>>0)
2 channel-specific attributes found:
attr 0: input value: 6.600000
attr 1: scale value: 0.010000
timestamp: (input, index: 4, format: le:S64/64>>0)
4 device-specific attributes found:
attr 0: cleaning_period value: 604800
attr 1: cleaning_period_available value: [0 1 604800]
attr 2: current_timestamp_clock value: realtime
attr 3: start_cleaning ERROR: Permission denied (-13)
2 buffer-specific attributes found:
attr 0: data_available value: 0
attr 1: watermark value: 1