njh / node-owfs

A node.js client library for the owserver protocol in owfs
https://www.npmjs.com/package/owfs
MIT License
10 stars 4 forks source link

Feature request: readRaw() #40

Open oschade opened 4 years ago

oschade commented 4 years ago

Thank you for your great library! I want to read the whole scratchpad from an OneWire sensor, for example:

con.read("/28.0000B218DA00/scratchpad", function(err, result){
  console.log( result )
})

Sadly, your library converts every payload to an utf8-String. Because the scratchpad of the sensor is no valid utf-8 string, some bytes get lost and there is no way to get them back. It would be great if there is a function like "readRaw", which bypassed every string conversion in the code.

Background: I simulate a DS18B20 with an arduino and the library "OneWireHub" and modify some bytes to get a higher resolution. To get this modifed bytes, I need to read the full "scratchpad".