vgropp / tempsense-exporter

prometheus-exporter and cli utility to read temperature from DS18B20 USB HID device
BSD 2-Clause "Simplified" License
1 stars 2 forks source link

Help needed #47

Closed Finomosec closed 5 months ago

Finomosec commented 5 months ago

Hello,

I was trying to use this project. I was very happy to find it. It is exactly what i need.

However at first the CLI tool did not recognize the device at all. I was able to fix this thanks to your comment:

It was initially inspired by https://github.com/kybernetyk/tempsense

The link contained information about how to configure the udev/rules to access the USB device. Maybe you can add this to your project as well?

After that worked, the CLI tool recognized the USB device and my 2 DS18B20 sensors. However... it shows temperature 0 all the time. Which is not true (just to be sure :-)).

I added some debug outputs and confirmed, that the data read in https://github.com/vgropp/tempsense-exporter/blob/528af6e84f4dc4bae2a2de003ca52431dac10260/cmd/hid/hid.go#L13-L21 actually did not contain the temperature value. I even made the 2 ignored fields visible. But nothing usefull here.

Then i was thinking: The DS18B20 sensors need to me queried, like a signal must be sent to tell them to report the temperature. Maybe this is somehow done automatically in this setup, but then again maybe not. And since i got no data, i thought maybe more like not.

So i looked at the original code from https://www.led-genial.de/mediafiles//Sonstiges/TempSensorTester.zip and found the relevant code fragments and with this forked your project (https://github.com/Finomosec/tempsense-exporter) and tried to replicate sending the correct signals to the sensors. But all i got in the end was: error reading device 1: hidapi: unknown failure

Can you help me solve this problem?

Why is the temperature reading 0?

Greetings Frederic

Finomosec commented 5 months ago

Update: I Tested the device now with the Windows program. And it also reads 0. So it is probably not a problem with your project/software, but with the device or firmware or the sensors themselves. I will investigate further.

Finomosec commented 5 months ago

grafik

Finomosec commented 5 months ago

I contacted the producer support. I'm curious what they will say...

Finomosec commented 5 months ago

Ok, hi again. Support did not yet reply.

But I tested the setup with other sensors. And surprise! It works!

So the sensors which came with the tester were bad.

It got even stranger, when i connected one that was working and one which didn't work. In this setup, the bad one always copied the temperature of the good one. Maybe it's just a glitch in the windows tester software, but still very strange...

I will get back to testing your exporter now and i think it will work now. I have a good feeling :-)

Finomosec commented 5 months ago

It works!

May 31 22:26:31: device 1/1, sensor 1/1 (29902645d4e848aa; extern): 19.1°