Repeated problems using 1wire plus from Python
The 1 Wire Pi Plus and 1 Wire Pi Zero are a 1 Wire interface for the Raspberry Pi
08/09/2016
Posted by:
dhewison
08/09/2016
Posted by:
andrew
I think I have found a solution to the problem you are having. It looks like the owserver is not running which is why your python script is throwing the exNoController error. I tried installing owfs and when I ran the following python script I got the same error as you.
import ow
ow.init('localhost:4304')
sensorlist = ow.Sensor('/').sensorList()
for sensor in sensorlist:
print(sensor.address)
print(sensor.family)
print(sensor.id)
print(sensor.type)
To fix the problem I did the following things.
Edit /etc/owfs.conf using the command:
sudo nano /etc/owfs.conf
Add the following line in the same area as the other server:device lines:
server: device = /dev/i2c-1
This will allow owfs to connect to the 1 Wire Pi Plus.
The whole of the owfs.conf on my Raspberry Pi looked like this:
! server: server = localhost:4304
server: i2c = /dev/i2c-1:ALL
mountpoint = /mnt/1wire
allow_other
http: port = 2121
ftp: port = 2120
server: port = localhost:4304
Next start the owserver with the command:
sudo /opt/owfs/bin/owserver -c /etc/owfs.conf --pid-file /var/run/owfs/owserver.pid
Once owserver is running you should be able to run your python program.
The owserver will need to be started each time the Raspberry Pi boots. The easiest way to do this is to add the above command into /etc/rc.local so it will be run when the Raspberry Pi starts.
12/09/2016
Posted by:
dhewison
18/07/2019
Posted by:
bcraytor
I am having this issue as well, and have followed all the instructions above, I even copied and paste your file to owfs.conf without success, then I don't see anything from 1wiretest.py. What am I doing wrong?
pi@bretraspberrypi:~ $ sudo systemctl enable owserver.service
owserver.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable owserver
pi@bretraspberrypi:~ $ python 1wiretest.py
Traceback (most recent call last):
File "1wiretest.py", line 2, in <module>
ow.init('localhost:4304')
File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 224, in init
raise exNoController
ow.exNoController
pi@bretraspberrypi:~ $
Thanks!
Bret
18/07/2019
Posted by:
andrew
Please can you try going through all of the steps in our OWFS tutorial?
Also, try running the command "sudo i2cdetect -y 1" which should return a list of devices connected to the I2C bus. The 1 Wire Pi should appear on address 0x18. If it does not appear then go through the steps in our I2C tutorial to make sure I2C is enabled on your Raspberry Pi.
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.