Speed up 1-wire reads with simualtenous conversion!
Posted: Monday 11 January 2016 18:31
I have 25 1-wire temperature sensors, and I will add another 20. I'm using Domoticz native OWFS-support.
Domoticz is reading from the unchached directory (hardware/1Wire/1WireByOWFS.cpp), so every sensor takes about 750 ms to read.
With a hardcoded 1-wire polling interval of 30 seconds (hardware/1Wire.cpp) it will not finish in time when I add more sensors!
OWFS can issue a command to ALL temperature and voltage sensors o do a conversion simulatenously, and then the data is available directly after the conversion.
I changed the path in 1WireByOWFS.cpp to not read from the "uncached", and wrote "1" to the simulatenous temperature manually in a ssh-session just before Domoticz started to read. Here is the difference:
WITHOUT simulatenous conversion:
WITH simulateous conversion:
A reduction from 17,97 to 2,03 seconds! (0,72 to 0,08 seconds/sensor).
Now, I can't figure out exactly how Domoticz gather the data, but I would like Domoticz to write 1 to mnt/1wire/uncached/simulatenous/temperature just before it starts to read temperature ensors, and 1 to /mnt/1wire/uncached/simultaneous/voltage just before it starts to read 1-wire devices with analog input.
Since OWFS has a default cache time of 15 seconds, I guess it would work perfect just to write 1 to both temperature and voltage just before the periodic 1-wire data readout every 30 seconds.
Anyone know where the code to write the two ones to the right file should be placed?
Domoticz is reading from the unchached directory (hardware/1Wire/1WireByOWFS.cpp), so every sensor takes about 750 ms to read.
With a hardcoded 1-wire polling interval of 30 seconds (hardware/1Wire.cpp) it will not finish in time when I add more sensors!
OWFS can issue a command to ALL temperature and voltage sensors o do a conversion simulatenously, and then the data is available directly after the conversion.
Code: Select all
pi@pi2 /mnt/1wire/uncached/simultaneous $ echo 1 > temperature
pi@pi2 /mnt/1wire/uncached/simultaneous $ echo 1 > voltage
WITHOUT simulatenous conversion:
Code: Select all
2016-01-11 18:23:08.350 (OWFS) Temp (Frys)
2016-01-11 18:23:09.101 (OWFS) Temp (Kyl)
2016-01-11 18:23:09.855 (OWFS) Temp (Köksbänk)
2016-01-11 18:23:10.582 (OWFS) Temp (OWFS-test)
2016-01-11 18:23:11.338 (OWFS) Temp (GV-retur: Dusch)
2016-01-11 18:23:12.085 (OWFS) Temp (GV-retur: Kök)
2016-01-11 18:23:12.835 (OWFS) Temp (GV: Tillopp VVX)
2016-01-11 18:23:13.586 (OWFS) Temp (GV: Retur VVX)
2016-01-11 18:23:14.334 (OWFS) Temp (GV-retur: Vard3)
2016-01-11 18:23:15.086 (OWFS) Temp (GV-retur: Hall)
2016-01-11 18:23:15.845 (OWFS) Temp (GV-tillopp: Kök)
2016-01-11 18:23:16.597 (OWFS) Temp (GV-tillopp: Dusch)
2016-01-11 18:23:17.347 (OWFS) Temp (GV-retur: Klv)
2016-01-11 18:23:18.095 (OWFS) Temp (GV-tillopp: Klv)
2016-01-11 18:23:18.841 (OWFS) Temp (GV: Tillopp fördelare)
2016-01-11 18:23:19.592 (OWFS) Temp (V: Retur: Garage)
2016-01-11 18:23:20.342 (OWFS) Temp (GV-retur: Vard4)
2016-01-11 18:23:21.090 (OWFS) Temp (Tillopp: Garage)
2016-01-11 18:23:21.838 (OWFS) Temp (GV-tillopp: Kontor)
2016-01-11 18:23:22.585 (OWFS) Temp (Gv-retur: Kontor)
2016-01-11 18:23:23.332 (OWFS) Temp (GV-tillopp: Vard4)
2016-01-11 18:23:24.080 (OWFS) Temp (GV: Bypass)
2016-01-11 18:23:24.826 (OWFS) Temp (GV-tillopp: Vard3)
2016-01-11 18:23:25.573 (OWFS) Temp (GV: Retur fördelare)
2016-01-11 18:23:26.321 (OWFS) Temp (GV-tillopp: Hall)
Code: Select all
2016-01-11 18:24:46.083 (OWFS) Temp (Frys)
2016-01-11 18:24:46.178 (OWFS) Temp (Kyl)
2016-01-11 18:24:46.267 (OWFS) Temp (Köksbänk)
2016-01-11 18:24:46.342 (OWFS) Temp (OWFS-test)
2016-01-11 18:24:46.431 (OWFS) Temp (GV-retur: Dusch)
2016-01-11 18:24:46.520 (OWFS) Temp (GV-retur: Kök)
2016-01-11 18:24:46.608 (OWFS) Temp (GV: Tillopp VVX)
2016-01-11 18:24:46.696 (OWFS) Temp (GV: Retur VVX)
2016-01-11 18:24:46.783 (OWFS) Temp (GV-retur: Vard3)
2016-01-11 18:24:46.873 (OWFS) Temp (GV-retur: Hall)
2016-01-11 18:24:46.964 (OWFS) Temp (GV-tillopp: Kök)
2016-01-11 18:24:47.061 (OWFS) Temp (GV-tillopp: Dusch)
2016-01-11 18:24:47.160 (OWFS) Temp (GV-retur: Klv)
2016-01-11 18:24:47.248 (OWFS) Temp (GV-tillopp: Klv)
2016-01-11 18:24:47.335 (OWFS) Temp (GV: Tillopp fördelare)
2016-01-11 18:24:47.421 (OWFS) Temp (V: Retur: Garage)
2016-01-11 18:24:47.508 (OWFS) Temp (GV-retur: Vard4)
2016-01-11 18:24:47.595 (OWFS) Temp (Tillopp: Garage)
2016-01-11 18:24:47.684 (OWFS) Temp (GV-tillopp: Kontor)
2016-01-11 18:24:47.770 (OWFS) Temp (Gv-retur: Kontor)
2016-01-11 18:24:47.857 (OWFS) Temp (GV-tillopp: Vard4)
2016-01-11 18:24:47.943 (OWFS) Temp (GV: Bypass)
2016-01-11 18:24:48.031 (OWFS) Temp (GV-tillopp: Vard3)
2016-01-11 18:24:48.119 (OWFS) Temp (GV: Retur fördelare)
2016-01-11 18:24:48.206 (OWFS) Temp (GV-tillopp: Hall)
Now, I can't figure out exactly how Domoticz gather the data, but I would like Domoticz to write 1 to mnt/1wire/uncached/simulatenous/temperature just before it starts to read temperature ensors, and 1 to /mnt/1wire/uncached/simultaneous/voltage just before it starts to read 1-wire devices with analog input.
Since OWFS has a default cache time of 15 seconds, I guess it would work perfect just to write 1 to both temperature and voltage just before the periodic 1-wire data readout every 30 seconds.
Anyone know where the code to write the two ones to the right file should be placed?