SequentMicrosystems / megabas-rpi

Command Line, Python lib, Node-Red and CODESYS driver for Building Automation Card
https://www.sequentmicrosystems.com
MIT License
8 stars 1 forks source link

Reading DS18B20s from python is not working properly #15

Open DonHugo opened 1 year ago

DonHugo commented 1 year ago

i am using a raspberry pi ZW 2

"HW version": "4.1", 
"SW version": " Fw 2.3", 
"power supply voltage": 25.499, 
"raspberry power supply voltage": 5.164, 
"board cpu temperature": 32}'

Using termina commands works fine!

$ megabas 3 owbscan
OK
$ megabas 3 owbcntrd
1
$ megabas 3 owbidrd 1
0xb101191ab96cfa28
$ megabas 3 owbtrd 1
23.06 C

python code used.

import megabas as m 
print("========== OneWire ==========")
print(m.owbScan(3))
print(m.owbGetSensorNo(3))
print(m.owbGetTemp(3, 1))
print(m.owbGetRomCode(3, 1))
print("========== OneWire ==========")

Result from code

========== OneWire ==========
None
0
0.0
[40, 250, 108, 185, 26, 25, 1, 177]
========== OneWire ==========

Iam not the best developer so i might have missunderstod something!?

alexburcea2877 commented 1 year ago

Hi,

We will check the library but until then do not use the scan function unless you add a new sensor on the bus. Sometime the scan fails so is better to add your sensor and then power the board (one scan is performed at powerup) and just read them but no scan command must be issued.

Alex.

DonHugo commented 11 months ago

works much better when i'm not scanning every single time. another question, is there a way to get the same information as megabus -list thru python lib?

alexburcea2877 commented 11 months ago

Unfortunately no scanning function has been implemented in python. Anyway you can run the "megabas -list" command with python and parse his output if you need.