Nov-02-2020, 08:59 PM
I am trying to run a DS18B20 temp sensor to trigger a relay. My code works in Thonny on a Rasp Pi4b. I am using sudo crontab -e and adding:
@reboot python /home/pi/DS18B20SensorRelay.py
The path shown is correct. While the program runs in Thonny, it won't run at sudo reboot. In the terminal I get the following message:
Running at boot
Traceback (most recent call last):
from w1thermsensor import W1ThermSensort
Import Error: No module named w1thermsensor.
I loaded the module again in it seemed to load correctly. The program still runs in Thonny. Not sure what is going on.
PS I loaded a simple LED blink program and it ran at boot, so the problem has to be with the w1thermister module.
My code starts like this:
import RPi.GPIO as GPIO
from w1thermsensor import W1ThermSensor
import time
the rest is the code to turn on the rely at a certain temp.
Appreciate any help. Like does the w1thermsensor module have to be in a certain directory. I just let it load and let Pi decide.
@reboot python /home/pi/DS18B20SensorRelay.py
The path shown is correct. While the program runs in Thonny, it won't run at sudo reboot. In the terminal I get the following message:
Running at boot
Traceback (most recent call last):
from w1thermsensor import W1ThermSensort
Import Error: No module named w1thermsensor.
I loaded the module again in it seemed to load correctly. The program still runs in Thonny. Not sure what is going on.
PS I loaded a simple LED blink program and it ran at boot, so the problem has to be with the w1thermister module.
My code starts like this:
import RPi.GPIO as GPIO
from w1thermsensor import W1ThermSensor
import time
the rest is the code to turn on the rely at a certain temp.
Appreciate any help. Like does the w1thermsensor module have to be in a certain directory. I just let it load and let Pi decide.