ayufan / esphome-components

A repository of custom esphome components
97 stars 25 forks source link

iNode BLE support #13

Open wizu opened 4 years ago

wizu commented 4 years ago

inode_ble don't work with latest dev of esphome. There is not anmore get_manufacturer_data() function. It looks like ble_tracker changed alot: https://github.com/esphome/esphome/blob/dev/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp

Esphome 1.15 should be available any day from now.

wizu commented 4 years ago

@ayufan nie działa jednak także na aktualnej wersji 1.14.5 Będziesz miał chwilę czasu, żeby to poprawić?

ayufan commented 4 years ago

I will take a look.

ayufan commented 4 years ago

Fixed by https://github.com/ayufan/esphome-components/commit/7b3dbe7884d278917be6471796539af5e04ef86f

wizu commented 4 years ago

@ayufan it's compiling now, thank you. But it don't work on my device. I own version +20dBm and it looks like it sends data a little diffrent. In the logs I can see: iNode Manfacturer Data: UUID: 82:A4. Data: 00.00.7A.DC.02.00.C4.09.00.00.00 (11) Looking at your code it should have UUID 82a0 but in my case it is 82a4 I've changed it in code and it works, but the data doens't look good. [17:22:58][D][sensor:092]: 'Energy Meter Power': Sending state 0.00000 W with 2 decimals of accuracy [17:22:58][D][sensor:092]: 'Energy Meter Total Energy': Sending state 125.00933 kW/h with 2 decimals of accuracy [17:22:58][D][sensor:092]: 'Energy Meter Battery Level': Sending state -10.00000 % with 0 decimals of accuracy

I've set counter to 2500 pulses and counter state to 75 kw/h then I've let it read a few pulses. Can you make any sense out of that manufacturer data? I've tried to decode it, but I cannot find even a counter constant. What do you think, is my device broken or should I look for the info at manufacturer?

After some time it showed 82:A0 device: [17:46:37][D][inode_ble:026]: iNode Manfacturer Data: UUID: 82:A0. Data: 00.00.7A.DC.02.00.C4.09.D0.00.00 (11) [17:46:37][D][sensor:092]: 'Energy Meter Power': Sending state 0.00000 W with 2 decimals of accuracy [17:46:37][D][sensor:092]: 'Energy Meter Total Energy': Sending state 125.00933 kW/h with 2 decimals of accuracy [17:46:37][D][sensor:092]: 'Energy Meter Battery Level': Sending state 100.00000 % with 0 decimals of accuracy

But still it's not correct - in browser counter have value: 75,0056 https://support.inode.pl/apps/new/iNodeSetup_new/

ayufan commented 4 years ago

@wizu I don't know. I also have one development +20dBm LR version.

I will redirect them to this thread :)

nemoo2580 commented 4 years ago

@ayufan iNode Energy Meter has an aditional special meaning for bit 1 and 2 and it can change on one device. More info in Polish here. I implemented iNode integration to OpenMQTTGateway and I used UUID: 8290, 8292, 8294, 8296 (according to iNode Manufacturer Specific Data document. I have iNode Energy Meter CR2032 version, probably +20dBm version has primary UUID 82a0, but it is not documented. You can for example add mask like here (UUID & 0xFFF9) == 0x82a0 to support uuid 82a0, 82a2, 82a4, 82a6 (bit 1 and bit 2 can be 00, 01, 10, 11). You can also add support for iNode Energy Meter CR2032 version with UUIDs: 8290, 8292, 8294, 8296.

@wizu Did your iNode have a low battery when you post this issue? Your UUID 82a4 has bit 2 set which means 'low battery voltage'.

wizu commented 4 years ago

@nemoo2580 no, not really. I belive it was about 70% at the time.

ayufan commented 3 years ago

@nemoo2580 I believe it is still relevant. Maybe it is finally a time to upstream inode_ble.