sputnikdev / eclipse-smarthome-bluetooth-binding

Eclipse SmartHome Bluetooth Binding
46 stars 10 forks source link

Add support for Oregon RAR213HG weather station #27

Open vkolotov opened 6 years ago

vkolotov commented 6 years ago

@druciak:

Hi, I installed the binding from the marketplace on my OH machine (Debian) and it successfuly discovered the adapter and my BLE “weather station” Oregon RAR213HG. However weather station thing is always OFFLINE and it does have only generic channels, no channels for temperature neither humidity. Also when I tried to change some settings in adapter thing I received 500 with such logs:

2018-01-23 20:03:20.954 [WARN ] [.core.thing.binding.BaseThingHandler] - Error while applying configuration changes: 'IllegalArgumentException: Provider for thing bluetooth:ble:ED8914A1503A cannot be determined because it is not known to the registry' - reverting configuration changes on thing 'bluetooth:ble:ED8914A1503A'. 2018-01-23 20:03:20.972 [ERROR] [ome.io.rest.core.thing.ThingResource] - Exception during HTTP PUT request for update config at 'things/bluetooth:ble:ED8914A1503A/config' for thing 'bluetooth:ble:ED8914A1503A': Provider for thing bluetooth:ble:ED8914A1503A cannot be determined because it is not known to the registry First I would like to have this weather station online (if it does matter) and add to it some channels (temperature, humidity). I assume the binding needs to know GATT specification of the device. I am happy to help creating required files, just tell me what to do.

vkolotov commented 6 years ago

Hi @druciak, I’m happy to help you. Could you please share OH logs so I can understand what’s happening there. Also could you please let me know:

vkolotov commented 6 years ago

@druciak:

Regarding my previous post, I was changing the station thing and got the error, but when I tried one more time I succeeded. Moreover when I changed adapter for this thing to preferred one, it shows as ONLINE. :slight_smile:

Unfortunately when I linked some generic channels (Model, HW revision, Manufacturer, Battery level, RSSI) I only got valid data for RSSI.

Here are the details about my setup:

I am running Sept. snapshot of 2.2, but I am going to update to some 2.3 snapshot soon on Debian Stretch with generic bluetooth transport using Bluez 5.43-2+deb9u1

vkolotov commented 6 years ago

@druciak:

BTW: currently I am using a Python script to get data from Bluez and push it using MQTT to OH. I cannot find the source, but interesting info you can find also here.

vkolotov commented 6 years ago

From what I can see, we could try to add support for your device through custom GATT spec files.

vkolotov commented 6 years ago

Hi @druciak, looks like it is definitely possible to add support for your device. Could you please try to add GATT files form this commit? https://github.com/sputnikdev/bluetooth-gatt-parser/commit/175b10eb1e497f896ef2663bbb4ba0872f0cc2ad

Create a folder on your file system that is accessible by “openhab” user, something like that: /home/pi/.bluetooth_smart That folder should contain two subfolders:

These two folders should contain your xml files from the commit above, e.g. “characteristic” folder contains XML file for characteristics and “service” contains XML files for your services. Make sure that file permissions are set correctly so that “openhab” user can read them.

Specify gatt extension folder here: image

Let me know how it goes.

Update: You will have to remove the thing and add back again.

vkolotov commented 6 years ago

Update #2: The following channels will be available (if it is working properly):

Indoor temperature:

Base temp Base max temp Base min temp Outdoor temperature:

Sensor 1 temp Sensor 1 max temp Sensor 1 min temp That’s what I could decode from the python script on the article you mentioned earlier. However, from what I can see, there are some other channels that could be potentially added. Unfortunately I do not nave that device, so it is not possible for me to work further. However, if you have some experience in software engineering, you could try to add more by looking what characteristics the device has and what they represent. Most likely humidity readings and extra outdoor sensors could be added.

druciak commented 6 years ago

Hi Vlad, attached logs from the 1.1 version of the binding. I set log level to debug, then install the bindings and then added things. bt.zip

druciak commented 5 years ago

Hey @vkolotov I've just given another try for this binding, but it still does not work with the RAR station properly. How can we make a progress on this?

vkolotov commented 5 years ago

Hey @druciak, there was no any work done in regards this device. However... I believe we should try something. Some features have been implemented since we tried to add support for this device. I'm hoping that your device advertise something without establishing connection to it.

Could you please do an experiment?

  1. Remove the thing for your device from OH.
  2. Set Gatt parsing strategy to "All as binary": image
  3. Add your device again, BUT do not enable "ConnectionControl".
  4. Leave it for a while (10 mins or so), refresh browser page.
  5. See if some new channels are added into the thing. These might be some channels that are advertised by your device.
druciak commented 5 years ago

Here you go: idt Seems something is advertised, what next? :)

vkolotov commented 5 years ago

Oh very good, I'll have a look in the evening. It is a good sign, most likely we don't have to be connected to the device to get some data from it.

vkolotov commented 5 years ago

Add all of these channels please. And see what data they get. Please post IDs and values here. I'll try to recognise what's that. Also pls let me knwo whats temperature and humidity around your device so I'll try to match it with the readings.

vkolotov commented 5 years ago

If you can get several samples for each channel, that would be good.

druciak commented 5 years ago

What profile should I use when linking? Default?

druciak commented 5 years ago

Might be a coincidence, but something has appeared when I change to "connected": idt1 Will add more items tomorrow.

druciak commented 5 years ago

idt2 This is what I catch till now.

vkolotov commented 5 years ago

What profile should I use when linking? Default?

when I change to "connected":

Not sure I understand this, what is "profile"?

druciak commented 5 years ago

An option when linking channel to item.

druciak commented 5 years ago

None of these values have changed since yesterday. also no new channels have been added. Seems strange, since the ones with value are imo static data (device description), while temperature and humidity is not there.

vkolotov commented 5 years ago

Right. Looks like you accidentally enabled "ConnectionControl". Anyway, looks like it does not advertise anything as you say that the channels do not change. However, I can clearly see that the channels that were created have some meaningful data. Can you please now enable "ConnectinoControl" (make sure "Connected" channel getting changed to "enabled") and observe if the channels get some updates?

druciak commented 5 years ago

I did it already - no changes at all.