DanTheMan827 / homebridge-ds18b20

25 stars 10 forks source link

temperature listed as 0 when negative #1

Closed wormiedk closed 8 years ago

wormiedk commented 8 years ago

hi there. The temperature reported is 0 whenever the temperature is below 0

DanTheMan827 commented 8 years ago

Are you referring to below 0°C or 0°F?

DanTheMan827 commented 8 years ago

And could you test it using the npm package ds18b20?

wormiedk commented 8 years ago

Below 0°C As far as i know da18b20 always report in 0°C

Cheers

Den 18. jan. 2016 kl. 03.15 skrev DanTheMan827 notifications@github.com:

Are you referring to below 0°C or 0°F?

— Reply to this email directly or view it on GitHub.

wormiedk commented 8 years ago

The ds18b20 nodes package reports correctly Current temperature is -5.5

more /sys/bus/w1/devices/28-0000069621e9/w1_slave a8 ff 4b 46 7f ff 08 10 e5 : crc=e5 YES a8 ff 4b 46 7f ff 08 10 e5 t=-5500

On 18 Jan 2016, at 03:21, DanTheMan827 notifications@github.com wrote:

And could you test it using the nodejs package ds18b20 https://www.npmjs.com/package/ds18b20?

— Reply to this email directly or view it on GitHub https://github.com/DanTheMan827/homebridge-ds18b20/issues/1#issuecomment-172409148.

Brightdawn commented 8 years ago

after hours of debuggin i found the problem... the problem is, that in the HAP framwork, temperature sensors are defined with a range of 0-100 degrees so. its not the sensors.. its not the ds18b20 library and its not the ds18b20 homebridge module.. they are all reporting negative numbers in the right way...

there are 2 possible fixes for this:

  1. correct the 0-100 range in the HAP Framework by editing /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/gen/HomeKitTypes.js Go the Block: "Characteristic.CurrentTemperature" .. there you find maxValue: 100, minValue: 0, minStep: 0.1,

just change minvalue to -50 or something

  1. the developer of this ds18b20 module can override the setting by setting characteristic.props.minValue = -50 I tried to do this, but I don't know where in the source i have to place this...

so .. i did Number 1 as a workaround and it works without any problem

see here: https://github.com/KhaosT/HAP-NodeJS/issues/147

DanTheMan827 commented 8 years ago

Thanks for the info, I've fixed the issue and published the patch to npm