Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Repeated problems using 1wire plus from Python

4712 Views - Created 08/09/2016

08/09/2016

Posted by:
dhewison

dhewison Avatar

Hi, I've followed the installation instructions for the software for 1wire plus, OWFS, and keep having numerous problems accessing 1wire devices from Python 2.7.9, any help would be greatly appreciated as I'm getting serioulsy fed up with it. Currently I can read the temperature of a DS18B20 using: cat /mnt/1wire/28.53C158070000/temperatureBut, the line in Python: ow.init('localhost:4304')returns: File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 224, in init raise exNoControllerIt has worked on accasion previously and I do not knok what has changed to break it, I've re-installed it to no avail. Regards,David

08/09/2016

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hi David

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

dhewison Avatar

Hi Andrew, Many thanks for the reply that has fixed the problem.David

18/07/2019

Posted by:
bcraytor

bcraytor Avatar

Hello and good day!

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

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hello Bret

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.

Sign in to post your reply

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.