rrooggiieerr / homeassistant-okokscale

Home Assistant integration for OKOK Scales
Apache License 2.0
10 stars 0 forks source link

okok scale intregation #1

Open frankiha opened 1 year ago

frankiha commented 1 year ago

Hi, i have an okok scale and it is not integrating with Home Assistant. In the okok app it works fine. In Home Assistant only the signal was detected and does not show the value. sorry for my english

Home Assistant 2023.4.6 image image

Debug: [17:44:05][D][ble_adv:066]: New BLE device [17:44:05][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:05][D][ble_adv:069]: Advertised service UUIDs: [17:44:05][D][ble_adv:073]: Advertised service data: [17:44:05][D][ble_adv:078]: Advertised manufacturer data: [17:44:05][D][ble_adv:080]: - 0x11C0: (length 13) [17:44:05][D][ble_adv:081]: HEXM - 24.36.00.00.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:10][D][ble_adv:066]: New BLE device [17:44:10][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:10][D][ble_adv:069]: Advertised service UUIDs: [17:44:11][D][ble_adv:073]: Advertised service data: [17:44:11][D][ble_adv:078]: Advertised manufacturer data: [17:44:11][D][ble_adv:080]: - 0x0EC0: (length 13) [17:44:11][D][ble_adv:081]: HEXM - 24.40.17.70.0A.11.25.10.96.1A.36.81.D1 (13): [17:44:12][D][ble_adv:066]: New BLE device [17:44:12][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:12][D][ble_adv:069]: Advertised service UUIDs: [17:44:12][D][ble_adv:073]: Advertised service data: [17:44:12][D][ble_adv:078]: Advertised manufacturer data: [17:44:12][D][ble_adv:080]: - 0x0EC0: (length 13) [17:44:12][D][ble_adv:081]: HEXM - 24.40.17.70.0A.11.25.10.96.1A.36.81.D1 (13): [17:44:13][D][ble_adv:066]: New BLE device [17:44:13][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:13][D][ble_adv:069]: Advertised service UUIDs: [17:44:13][D][ble_adv:073]: Advertised service data: [17:44:13][D][ble_adv:078]: Advertised manufacturer data: [17:44:13][D][ble_adv:080]: - 0x0EC0: (length 13) [17:44:13][D][ble_adv:081]: HEXM - 24.40.17.70.0A.11.25.10.96.1A.36.81.D1 (13): [17:44:14][D][ble_adv:066]: New BLE device [17:44:14][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:14][D][ble_adv:069]: Advertised service UUIDs: [17:44:14][D][ble_adv:073]: Advertised service data: [17:44:14][D][ble_adv:078]: Advertised manufacturer data: [17:44:14][D][ble_adv:080]: - 0x0EC0: (length 13) [17:44:14][D][ble_adv:081]: HEXM - 24.40.17.70.0A.11.25.10.96.1A.36.81.D1 (13): [17:44:15][D][ble_adv:066]: New BLE device [17:44:15][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:15][D][ble_adv:069]: Advertised service UUIDs: [17:44:15][D][ble_adv:073]: Advertised service data: [17:44:15][D][ble_adv:078]: Advertised manufacturer data: [17:44:15][D][ble_adv:080]: - 0x0EC0: (length 13) [17:44:15][D][ble_adv:081]: HEXM - 24.40.17.70.0A.11.25.10.96.1A.36.81.D1 (13): [17:44:17][D][ble_adv:066]: New BLE device [17:44:17][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:17][D][ble_adv:069]: Advertised service UUIDs: [17:44:17][D][ble_adv:073]: Advertised service data: [17:44:17][D][ble_adv:078]: Advertised manufacturer data: [17:44:17][D][ble_adv:080]: - 0x20C0: (length 13) [17:44:17][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:20][D][ble_adv:066]: New BLE device [17:44:20][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:20][D][ble_adv:069]: Advertised service UUIDs: [17:44:20][D][ble_adv:073]: Advertised service data: [17:44:20][D][ble_adv:078]: Advertised manufacturer data: [17:44:20][D][ble_adv:080]: - 0x50C0: (length 13) [17:44:20][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:21][D][ble_adv:066]: New BLE device [17:44:21][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:21][D][ble_adv:069]: Advertised service UUIDs: [17:44:21][D][ble_adv:073]: Advertised service data: [17:44:21][D][ble_adv:078]: Advertised manufacturer data: [17:44:21][D][ble_adv:080]: - 0x5AC0: (length 13) [17:44:21][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:21][D][ble_adv:066]: New BLE device [17:44:21][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:21][D][ble_adv:069]: Advertised service UUIDs: [17:44:21][D][ble_adv:073]: Advertised service data: [17:44:21][D][ble_adv:078]: Advertised manufacturer data: [17:44:21][D][ble_adv:080]: - 0x5FC0: (length 13) [17:44:21][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:23][D][ble_adv:066]: New BLE device [17:44:23][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:23][D][ble_adv:069]: Advertised service UUIDs: [17:44:23][D][ble_adv:073]: Advertised service data: [17:44:23][D][ble_adv:078]: Advertised manufacturer data: [17:44:23][D][ble_adv:080]: - 0x72C0: (length 13) [17:44:23][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:23][D][sensor:127]: 'Temp Xiaomi WiFi Signal': Sending state -50.00000 dBm with 0 decimals of accuracy [17:44:25][D][ble_adv:066]: New BLE device [17:44:25][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:25][D][ble_adv:069]: Advertised service UUIDs: [17:44:25][D][ble_adv:073]: Advertised service data: [17:44:25][D][ble_adv:078]: Advertised manufacturer data: [17:44:25][D][ble_adv:080]: - 0x94C0: (length 13) [17:44:25][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:27][D][ble_adv:066]: New BLE device [17:44:27][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:27][D][ble_adv:069]: Advertised service UUIDs: [17:44:27][D][ble_adv:073]: Advertised service data: [17:44:27][D][ble_adv:078]: Advertised manufacturer data: [17:44:27][D][ble_adv:080]: - 0xB6C0: (length 13) [17:44:27][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:27][D][ble_adv:066]: New BLE device [17:44:27][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:27][D][ble_adv:069]: Advertised service UUIDs: [17:44:27][D][ble_adv:073]: Advertised service data: [17:44:27][D][ble_adv:078]: Advertised manufacturer data: [17:44:27][D][ble_adv:080]: - 0xBBC0: (length 13) [17:44:27][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:29][D][ble_adv:066]: New BLE device [17:44:29][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:29][D][ble_adv:069]: Advertised service UUIDs: [17:44:29][D][ble_adv:073]: Advertised service data: [17:44:29][D][ble_adv:078]: Advertised manufacturer data: [17:44:29][D][ble_adv:080]: - 0xD8C0: (length 13) [17:44:29][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13): [17:44:30][D][ble_adv:066]: New BLE device [17:44:30][D][ble_adv:067]: address: 10:96:1A:36:81:D1

[17:44:30][D][ble_adv:069]: Advertised service UUIDs: [17:44:30][D][ble_adv:073]: Advertised service data: [17:44:30][D][ble_adv:078]: Advertised manufacturer data: [17:44:30][D][ble_adv:080]: - 0xDDC0: (length 13) [17:44:30][D][ble_adv:081]: HEXM - 00.00.17.70.0A.11.24.10.96.1A.36.81.D1 (13):

freijn commented 1 year ago

Hey Frank.

Did you disable the app on your phone? i.e. shut the bluetooth for a moment?
If the scale finds your phone, it talks to the phone instead of the HA.

rrooggiieerr commented 1 year ago

Scales which identify as OKOK Scale actually don't necessarily use the same protocol. This integration only implements the protocol which my specific scale (by the brand Tristar) uses. I have plans to support other OKOK Scale protocols for which I can find documentation, but that's something for the future.

rrooggiieerr commented 1 year ago

Here is a good read on how to reverse engineer the protocol of your scale

https://github.com/oliexdev/openScale/wiki/How-to-reverse-engineer-a-Bluetooth-4.x-scale

frankiha commented 1 year ago

Hey Frank.

Did you disable the app on your phone? i.e. shut the bluetooth for a moment? If the scale finds your phone, it talks to the phone instead of the HA.

I turned off the Bluetooth of the cell phone and did the test, only the Bluetooth signal strength sensor was located.

rrooggiieerr commented 1 year ago

@frankiha I have implemented two other OKOK Scale protocols. Could you try if your scale now works?

frankiha commented 1 year ago

@frankiha I have implemented two other OKOK Scale protocols. Could you try if your scale now works?

I updated OKOK through HACS and after the update there was no data on signal strength. I removed the okok scale integration and tried to add it again, but the scale was not found.

rrooggiieerr commented 1 year ago

I have enabled more debug logging, cold you install the latest version and enable debugging for this integration?

Go to the 'Devices & Services' screen and on the 'OKOKScale' integration click the 3 dot menu and click 'Enable debug logging'

Screenshot 2023-05-06 at 11 09 10

Use the scale a couple of times, disable debug logging, and a debugging file will automagically be downloaded to your machine. Please share the contents of that file

frankiha commented 1 year ago

I have enabled more debug logging, cold you install the latest version and enable debugging for this integration?

Go to the 'Devices & Services' screen and on the 'OKOKScale' integration click the 3 dot menu and click 'Enable debug logging'

Screenshot 2023-05-06 at 11 09 10

Use the scale a couple of times, disable debug logging, and a debugging file will automagically be downloaded to your machine. Please share the contents of that file

Hello rrooggiieerr, I did the integration update and now when I go to add okok scale, I have an error. Thanks for helping me. image image

rrooggiieerr commented 1 year ago

I think you scale needs to be available when you add it to home assistant, make sure the display is on. Maybe use the scale while adding. If the scale is not used it's in a sleep mode and can't be recognised.

Actually HA should be able to recognise the scale when you use it, unless you've ignored or deleted the device before.

Also, are you using the latest HA version?

frankiha commented 1 year ago

I think you scale needs to be available when you add it to home assistant, make sure the display is on. Maybe use the scale while adding. If the scale is not used it's in a sleep mode and can't be recognised.

Actually HA should be able to recognise the scale when you use it, unless you've ignored or deleted the device before.

Also, are you using the latest HA version?

I followed the steps you sent, but the same error occurred, even with the scale in use. image

frankiha commented 1 year ago

Home Assistant log 2023-05-09 21:59:02.080 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration okokscale: No module named 'objc'

rrooggiieerr commented 1 year ago

Ok, I just modified some code. Please try again

frankiha commented 1 year ago

Ok, I just modified some code. Please try again

The first version of okokscale found the scale and showed only the signal strength. In the first update the scale was no longer found. In the last update, there is no error message, but the scale is not found. In the log it shows the mac of the scale when it is activated and at this moment I do the integration, but it does not find the scale. image