Closed Zach443 closed 5 years ago
but when using the CLI there is a 10-20 second delay
Are you experiencing this delay when using the Python API, too? Or is it really just the CLI?
Are you using sudo
when running the CLI tool? If so, can you do a sudo su
and verify that it's not sudo
which causes that delay.
If that's not the case, please set W1THERMSENSOR_NO_KERNEL_MODULE=1
. Without this setting it'll always load the w1-gpio
and w1-therm
kernel modules when running the CLI.
I think I am seeing the delay too, but I had put it down to my setup. (No sudo as don't need it). I first noticed it a month or so ago iirc.
Just Pi Zero (I use an Google AIY Raspbian image, all up to date). It take much longer than it used to. I wonder if a kernel update has altered something. I'll test with a fresh image later.
On Sun, 26 Aug 2018, 16:19 Timo Furrer, notifications@github.com wrote:
but when using the CLI there is a 10-20 second delay
Are you experiencing this delay when using the Python API, too? Or is it really just the CLI?
Are you using sudo when running the CLI tool? If so, can you do a sudo su and verify that it's not sudo which causes that delay.
If that's not the case, please set W1THERMSENSOR_NO_KERNEL_MODULE=1. Without this setting it'll always load the w1-gpio and w1-therm kernel modules when running the CLI.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timofurrer/w1thermsensor/issues/48#issuecomment-416046177, or mute the thread https://github.com/notifications/unsubscribe-auth/ALALtxZ3pOrAp1H8gAOq6VQbKzxxuVGoks5uUrxmgaJpZM4WMkEb .
hmmm, that's strange :thinking:
Can you verify if the delay is coming from the modprobe
?
Could you also do something like this:
from time import time
from w1thermsensor import W1ThermSensor
sensor = W1ThermSensor()
print(time())
sensor.raw_sensor_value
print(time())
If you are seeing the delay with this, too the problem might be when open / reading the file.
For me, the delay is strictly with the CLI. Printing the reading to the console every second programmatically works just fine. The huge delay is only when using any operation with the CLI, whether that be a temp reading, listing available sensors, or anything else. I'm not totally sure by what you meant in your first response to do.
Alright, please try:
W1THERMSENSOR_NO_KERNEL_MODULE=1 w1thermsensor get 1
do you see the delay here, too?
for me about 14 seconds (to read two sensors) with that, similar for the normal method will all
RaspberryPi has all the gubbins loaded up at boot time (normally). That is to say, no modprobe should be happening on my Pi.
On Mon, 27 Aug 2018 at 09:50, Timo Furrer notifications@github.com wrote:
Alright, please try:
W1THERMSENSOR_NO_KERNEL_MODULE=1 w1thermsensor ls
do you see the delay here, too?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/timofurrer/w1thermsensor/issues/48#issuecomment-416159730, or mute the thread https://github.com/notifications/unsubscribe-auth/ALALtxboXuyUMwVfbUCanCzB3PFva3DWks5uU7LDgaJpZM4WMkEb .
@timofurrer Same delay with that command.
Could you please do:
sudo time ls -l /sys/bus/w1/devices
You'll see a directory for each sensor connected to your Pi. Once you spotted the right (maybe even the only) one, can you run the following: (whereas <THE_SENSOR_DIRECTORY>
is the directory of your sensor)
sudo time cat /sys/bus/w1/devices/<THE_SENSOR_DIRECTORY>/w1_slave
Please post the output here, including the time infos.
@Zach443 could you give it a try already?
sudo: time: command not found For me
So no sudo as not needed.
Reading is fine, its the program it seems
pi@AIYTankPi:~ $ time w1thermsensor all Got temperatures of 2 sensors: Sensor 1 (031561e6d7ff) measured temperature: 21.0 celsius Sensor 2 (031561dd98ff) measured temperature: 25.0 celsius
real 0m18.656s user 0m12.725s sys 0m0.271s
pi@AIYTankPi:~ $ time ls -l /sys/bus/w1/devices total 0 lrwxrwxrwx 1 root root 0 Oct 24 12:18 28-031561dd98ff -> ../../../devices/w1_bus_master1/28-031561dd98ff lrwxrwxrwx 1 root root 0 Oct 24 12:18 28-031561e6d7ff -> ../../../devices/w1_bus_master1/28-031561e6d7ff lrwxrwxrwx 1 root root 0 Oct 24 12:17 w1_bus_master1 -> ../../../devices/w1_bus_master1
real 0m0.052s user 0m0.012s sys 0m0.019s
pi@AIYTankPi:~ $ time cat /sys/bus/w1/devices/28-031561dd98ff cat: /sys/bus/w1/devices/28-031561dd98ff: Is a directory
real 0m0.022s user 0m0.002s sys 0m0.013s
pi@AIYTankPi:~ $ time cat /sys/bus/w1/devices/28-031561e6d7ff cat: /sys/bus/w1/devices/28-031561e6d7ff: Is a directory
real 0m0.039s user 0m0.012s sys 0m0.000s pi@AIYTankPi:~ $
Just noticed I'm using 1.0.3 it seems ( python3-w1thermsensor/stable,now 1.0.3 all [installed] ) which is the one in apt , so cannot use anything newer as that the default installed version.
Could you update apt so we can use 1.0.5 and see if that fixes it?
Can you cat the file in the directory you've used?
In /sys/bus/w1/devices/28-031561e6d7ff
there should be a sensor file.
Do you mean
pi@AIYTankPi:~ $ cat /sys/bus/w1/devices/28-031561e6d7ff
cat: /sys/bus/w1/devices/28-031561e6d7ff: Is a directory
pi@AIYTankPi:~ $ cd /sys/bus/w1/devices/28-031561e6d7ff
pi@AIYTankPi:/sys/bus/w1/devices/28-031561e6d7ff $ ls
driver hwmon id name power subsystem uevent w1_slave
pi@AIYTankPi:/sys/bus/w1/devices/28-031561e6d7ff $ cat w1_slave
68 01 01 01 1f ff 0c 10 ac : crc=ac YES
68 01 01 01 1f ff 0c 10 ac t=22500
pi@AIYTankPi:/sys/bus/w1/devices/28-031561e6d7ff $ time cat w1_slave
68 01 01 01 1f ff 0c 10 ac : crc=ac YES
68 01 01 01 1f ff 0c 10 ac t=22500
real 0m0.908s
user 0m0.002s
sys 0m0.038s
Time of <1s seems normal to me. As it should be .75s plus a bit
Could you update apt so we can use 1.0.5 and see if that fixes it?
Unfortunately, I don't do this apt syncing. I'll ask for the update though!
Seems pretty good. Can you try do the same from source, so you don't have to wait for apt to be updated with the newest release.
Bump to remind me to check this (or the other chap @Zach443
I'm going to close this, due to inactivity. @Zach443 when you are ready with the feedback - I can re-open. 🎉
I have a Pi 1, so I'm not sure if this is the cause, but when using the CLI there is a 10-20 second delay on every command. Is this normal? The command output is normal, but the delay seems insane.