sputnikdev / eclipse-smarthome-bluetooth-binding

Eclipse SmartHome Bluetooth Binding
46 stars 10 forks source link

Add support for Thermoco #68

Open vkolotov opened 5 years ago

vkolotov commented 5 years ago

Coin size smart thermometer and recorder (http://outdoor-apps.com/store.html).

vkolotov commented 5 years ago

Hi Garrett,

I believe it would be fairy easy to add support for this device. There are some example on the internet:

http://codegist.net/snippet/python/thermocopy_jlintott_python

I will need some help from you. Could you please enable this property:

image

Then add thermoco device from OH inbox. First, do not enable "connection control" for your "thing". Wait 5-10 mins, refresh your browser page and notice if you see any new channels for the thing. I suspect that there will be at least 1 channel for temperature, please take a screenshot. Then monitor the channels and write down their values (binary data) and temperature readings where the device is (just rough samples, e.g. 22 degrees etc). I will need some samples to match binary data with real temperature.

If you can't see your device in OH inbox, then this probably means that your mobile phone (or whatever you use to get data from thermco device) is connected to the device. Remember that Bluetooth device can have only single connection at a time.

Then, if you do not see any new channels, then enable "Connection control" and wait until it establishes connection, i.e. "Connection" channel gets enabled. Then refresh your browser and notice new channels, and then try to get some binary data and real temperature as I mentioned above.

vkolotov commented 5 years ago

Please note that you need to enable "simple" linking mode: image

gwhitford commented 5 years ago

I have made the changes to the binding configratiom and have added sensor and attached the image of the seetings thermoco

Let me know if you need any further info.

vkolotov commented 5 years ago

Great thanks, what was the temperature around that time when you took screenshot? 28 C or 80 F?

vkolotov commented 5 years ago

Also, what app can show you (what metrics/readings)? Can you set any settings?

vkolotov commented 5 years ago

Please also click on this button and take a screenshot: image

vkolotov commented 5 years ago

Found a doc here: http://outdoor-apps.com/doc/ThermocoForDevelopper.pdf

It seems to me the temperature at the time when you took that screenshot was about 18 C, is this right?

vkolotov commented 5 years ago

According to the doc, the device advertises data without establishing connection to it. So please do not enable "Connection control", make sure it is online (put it closer to the adapter) and not connected to your phone. A new channel should appear in some time with this UUID: 0000FFD0-0000-1000-8000-00805F9B34FB. That one is used to read temperature as per this:

2.2.1 UUID FFD0
2.2.2 Advertise data
Broadcasting temperature data. Data will be “WKdd” where “dd” is the temperature data.
Sample code snippets:
unsigned char *word16ptr = (unsigned char *)[usrData bytes];
if (word16ptr[0] == 'W' && word16ptr[1] == 'K') { isValidDevice = YES;
if(!(word16ptr[2] == 0x80 && word16ptr[3] == 00)) {
long word16int = word16ptr[2]; word16int <<= 8;
word16int += word16ptr[3]; long tempint;
float temperature; tempint = word16int >> 4; if (tempint < 0x800) {
temperature = 0.0625*tempint; }
else {
tempint = 0x800 - tempint&0x7ff; temperature = -0.0625*tempint;
} }
}

It would be quite easy to add support for this, I just need to make sure you see that new channel.

vkolotov commented 5 years ago

One thing that won't work is negative temperature. The calculation method is a bit dodgy. Positive temp should work fine, once actual temp goes below 0, it will show some junk.

gwhitford commented 5 years ago

Yep, it was around 18 degrees. How should I add the new channel? or should it be auto created?

vkolotov commented 5 years ago

Hey @gwhitford , have you done what I mentioned earlier?

So please do not enable "Connection control", make sure it is online (put it closer to the adapter) and not connected to your phone. A new channel should appear in some time with this UUID: 0000FFD0-0000-1000-8000-00805F9B34FB.

Do you see that channel?

gwhitford commented 5 years ago

Nope that channel hasn't appeared. I removed readded it still no joy

gwhitford commented 5 years ago

After a day, it still hasn't added the new channel. Can the channel be add manually?

vkolotov commented 5 years ago

Nope, it is not possible to add channel manually.

Is your "thing" online?