Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get Bluetooth Fingerbot to work #92

Open
tunerooster opened this issue Dec 21, 2023 · 31 comments
Open

Can't get Bluetooth Fingerbot to work #92

tunerooster opened this issue Dec 21, 2023 · 31 comments

Comments

@tunerooster
Copy link

tunerooster commented Dec 21, 2023

Home Assistant Version: 2023.1.7 (manually installed)

I am running a Beelink Gemini (Intel based, NUC like server) with Home Assistant. It works great and has been for years now. I just bought a Fingerbot 2 (Bluetooth version), installed it with the Tuya App. It works fine using the Tuya App.

I use the HomeAssistant/Tuya integration with 20 devices (mostly wifi) with no problem. I installed the "tuya_ble" integration using HACS and is shows up in ~homeassistant/.homeassistant/custom_components/tuya_ble with the manifest.json showing "version": "0.1.8".

"lsusb" shows:

Bus 001 Device 008: ID 8087:0a2a Intel Corp. Bluetooth wireless interface

"bluetoothctl devices" shows:

Device DC:23:4D:AD:15:7C AD

which is the correct MAC address of the Fingerbot.

I succesfully installed bluetooth-adapters with: pip install bluetooth-adapters. But when I restart Home Assistant, I get the following:

2023-12-21 02:45:07.990 INFO (SyncWorker_1) [homeassistant.loader] Loaded tuya_ble from custom_components.tuya_ble

In Home Assistant the Device shows up as:

Fingerbot (riecov42)
by Tuya

But the entity "switch.fingerbot_2_switch_1" is "Unavailable", and I can't get it to beecome available.

Any help is greatly appreciated... Thanks!

@tunerooster
Copy link
Author

tunerooster commented Dec 22, 2023

P.S. Here are the "Diagnostics" from The HA:
tuya-5f77b5a58cab844a0b85e54a8eb83191-Fingerbot 2-832d7027e042bcf4b0d2d344d81536ce.json.txt

Note the "unavailable".

@tunerooster
Copy link
Author

If anyone has this working, please help!

@Snuupy
Copy link

Snuupy commented Jan 11, 2024

I'm running into the same issue, I also added the device identifier (riecov42) into devices.py and that didn't fix it either.

@Snuupy
Copy link

Snuupy commented Jan 11, 2024

I went to the tuya iot platform, opened inspector, found:

{
  "result": [
    {
      "dpName": "Switch",
      "dpId": 1
    },
    {
      "dpName": "Mode",
      "dpId": 101
    },
    {
      "dpName": "Down Movement",
      "dpId": 102
    },
    {
      "dpName": "Sustain Time",
      "dpId": 103
    },
    {
      "dpName": "Reverse",
      "dpId": 104
    },
    {
      "dpName": "battery_percentage",
      "dpId": 105
    },
    {
      "dpName": "Up Movement",
      "dpId": 106
    },
    {
      "dpName": "Touch Control",
      "dpId": 107
    },
    {
      "dpName": "Click",
      "dpId": 108
    },
    {
      "dpName": "custom_prog",
      "dpId": 109
    },
    {
      "dpName": "factory_data",
      "dpId": 110
    },
    {
      "dpName": "total_movement",
      "dpId": 111
    },
    {
      "dpName": "custom_timer",
      "dpId": 112
    },
    {
      "dpName": "custom_week_prog_1",
      "dpId": 113
    },
    {
      "dpName": "custom_week_prog_2",
      "dpId": 114
    },
    {
      "dpName": "custom_week_prog_3",
      "dpId": 115
    },
    {
      "dpName": "custom_week_prog_4",
      "dpId": 116
    },
    {
      "dpName": "Calibrate",
      "dpId": 117
    },
    {
      "dpName": "Resistance",
      "dpId": 118
    },
    {
      "dpName": "Resistance",
      "dpId": 119
    },
    {
      "dpName": "Adaptive Movement",
      "dpId": 121
    },
    {
      "dpName": "上升增益补偿",
      "dpId": 122
    }
  ],
  "t": 1704960168919,
  "success": true,
  "status": "ok"
}

I'll try to give it a go but I don't know if it will work. Hopefully someone can chime in to let me know if I'm on the right track or not.

following #103, trying now, crossing my fingers this works

edit: take a look at 0c0d291

edit2: OK, I got it working (at least the press, not the other settings for some reason). follow the link above, add the ID (riecov42) in the following files: button.py, devices.py, number.py, select.py, sensor.py, switch.py, text.py

I had to move the fingerbot next to my rpi4 to get it detected, even just several steps away it did not detect the device -_-
image

edit3: after waiting a few more mins the other options like down position worked too

@tunerooster
Copy link
Author

tunerooster commented Jan 13, 2024 via email

@Snuupy
Copy link

Snuupy commented Jan 13, 2024

I just told you I got it working and how to get it working.

@tunerooster
Copy link
Author

tunerooster commented Jan 14, 2024 via email

@Snuupy
Copy link

Snuupy commented Jan 14, 2024

Oh, I misunderstood. Could you provide a bit mor detail? Much appreciated!

On Sat, Jan 13, 2024, 12:21 PM Snuupy @.> wrote: I just told you I got it working and how to get it working. — Reply to this email directly, view it on GitHub <#92 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFMVIS3W777Y3QGRRANG7TYOLNCVAVCNFSM6AAAAABA6EHSQSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJQG42DKNRTG4 . You are receiving this because you authored the thread.Message ID: @.>

edit: take a look at 0c0d291

edit2: OK, I got it working (at least the press, not the other settings for some reason). follow the link above, add the ID (riecov42) in the following files: button.py, devices.py, number.py, select.py, sensor.py, switch.py, text.py

I had to move the fingerbot next to my rpi4 to get it detected, even just several steps away it did not detect the device -_- image

edit3: after waiting a few more mins the other options like down position worked too

Did you read this in my previous comment? What about the instructions in edit2 would you like more detail about?

@tunerooster
Copy link
Author

tunerooster commented Jan 14, 2024 via email

@tunerooster
Copy link
Author

tunerooster commented Jan 14, 2024 via email

@Snuupy
Copy link

Snuupy commented Jan 14, 2024

Please don't reply by email, your email client is formatting the message terribly. Use the github website please.

. The commits at 0c0d291 do not seem to include "riecov42". Where in these files do I add "riecov42"?

add the ID (riecov42) in the following files: button.py, devices.py, number.py, select.py, sensor.py, switch.py, text.py

Is that commit something I need to apply to my existing tuya_ble?

No, to the fork: https://github.com/Snuffy2/ha_tuya_ble - add this into HACS, remove existing ha_tuya_ble addon.

I.e., do I need to update the tuya_ble custom component? I currently show version 0.1.8 (from manifest.json).

Yes, with the forked repo.

Or are you saying I need to manually edit each of these: button.py, devices.py, number.py, select.py, sensor.py, switch.py, text.py? I.e., add "riecov42" to dict.fromkeys in each file?

Yes, you need to obtain the fork, then make the edits to the files listed aboe to add your new ID (riecov42)

@tunerooster
Copy link
Author

Please don't reply by email, your email client is formatting the message terribly. Use the github website please.

Got it! I had no idea... :)

No, to the fork: https://github.com/Snuffy2/ha_tuya_ble - add this into HACS, remove existing ha_tuya_ble addon.

I don't have an existing ha_tuya_ble addon. I will delete my existing tuya_ble addon and add ha_tuya_ble addon through HACS.

Or are you saying I need to manually edit each of these: button.py, devices.py, number.py, select.py, sensor.py, switch.py, text.py? I.e., add "riecov42" to dict.fromkeys in each file?

Yes, you need to obtain the fork, then make the edits to the files listed aboe to add your new ID (riecov42)

I will add "riecov42" to the dict.fromkeys structure in each file in the ha_tuya_ble addon (which I assume will appear in ~/.homeassistant/custom_components/ha_tuya_ble).

And that's it? I should just restart HA and it should work?

Many thanks!!!

@tunerooster
Copy link
Author

P.S. Why didn't (or don't) you add riecov42 to the ha_tuya_ble addon so it will already be there when installes via HACS?

@Snuupy
Copy link

Snuupy commented Jan 14, 2024

I will add "riecov42" to the dict.fromkeys structure in each file in the ha_tuya_ble addon (which I assume will appear in ~/.homeassistant/custom_components/ha_tuya_ble).

And that's it? I should just restart HA and it should work?

If you've added it to the 7 files to the fork I listed (yes, it is annoying but needed for it to work), in the appropriate classes, it should work. It does for me.

P.S. Why didn't (or don't) you add riecov42 to the ha_tuya_ble addon so it will already be there when installes via HACS?

There are currently 10 open PRs that have not been merged and the maintainer is AWOL it seems. If I open another PR it will likely not be merged. I can fork the forked repo (or do a PR to the forked repo) but I currently do not have the time.

@tunerooster
Copy link
Author

I understand, re: the PR's... Thanks for explaining.

You say update the "appropriate classes". Is there something other than " dict.fromkeys". Is there a string (like another id) whcich I can search for to be sure I get it updated in all the right places? Thanks again...

@Snuupy
Copy link

Snuupy commented Jan 14, 2024

For example, in button.py: 0c0d291

    "kg": TuyaBLECategoryButtonMapping(
        products={
            **dict.fromkeys(
                [
                    "mknd4lci"
                ],  # Fingerbot Plus
                [
                    TuyaBLEFingerbotModeMapping(dp_id=108),
                ],
            ),
        },
    ),

You see how he added mknd4lci? You just need to add riecov42 like so:

    "kg": TuyaBLECategoryButtonMapping(
        products={
            **dict.fromkeys(
                [
                    "mknd4lci",
                    "riecov42"
                ],  # Fingerbot Plus
                [
                    TuyaBLEFingerbotModeMapping(dp_id=108),
                ],
            ),
        },
    ),

Then repeat for all 7 files. Usually it has "kg" in front so I ctrl-f'd for that.

@tunerooster
Copy link
Author

My HACS does not find ha_tuya_ble. Searching for "tuya_ble" or "ha_tuya_ble", it just lists:

Tuya BLE
Home Assistant support for Tuya BLE devices.  v0.1.8

I will just download and install it manually from: https://github.com/PlusPlus-ua/ha_tuya_ble. Let me know if there is any problem with this approach.

@tunerooster
Copy link
Author

I'm running into problems getting the new tuya_ble to load. I successfully edited the 7 files, but a restart of home assistant now shows the fillowing errors (which appear to be unrelated to the 7 edits):

2024-01-14 02:44:56.267 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration 'tuya_ble': Unable to import component: cannot import name 'CONF_COUNTRY_CODE' from 'homeassistant
.const' (/mnt/240gb/homeassistant/lib/python3.11/site-packages/homeassistant/const.py)
Traceback (most recent call last):
  File "/mnt/240gb/homeassistant/lib/python3.11/site-packages/homeassistant/setup.py", line 251, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/240gb/homeassistant/lib/python3.11/site-packages/homeassistant/loader.py", line 814, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/tuya_ble/__init__.py", line 17, in <module>
    from .cloud import HASSTuyaBLEDeviceManager
  File "/home/homeassistant/.homeassistant/custom_components/tuya_ble/cloud.py", line 10, in <module>
    from homeassistant.const import (
ImportError: cannot import name 'CONF_COUNTRY_CODE' from 'homeassistant.const' (/mnt/240gb/homeassistant/lib/python3.11/site-packages/homeassistant/const.py)

These errors do not occur with the old tuya_ble.

If it is relevant, I do have this in the homeassistant: section of configuration.yaml.

country: US

Also, I don't seem to have any file named: homeassistant.const

I am running Home Assistand Version: 2023.12.4

Can you offer any advice? Thanks!

@Snuupy
Copy link

Snuupy commented Jan 14, 2024

I will just download and install it manually from: https://github.com/PlusPlus-ua/ha_tuya_ble. Let me know if there is any problem with this approach.

Wrong repo. See my above comment.

No, to the fork: https://github.com/Snuffy2/ha_tuya_ble - add this into HACS, remove existing ha_tuya_ble addon.

Try https://my.home-assistant.io/redirect/hacs_repository/?owner=Snuffy2&repository=ha_tuya_ble&category=integration or add a custom repo into HACS with https://github.com/Snuffy2/ha_tuya_ble url

@tunerooster
Copy link
Author

Thanks... I recognized my mistake earlier and had already reinstalled the correct tuya_ble. Here is the manifest.json for the current tuya_ble I am using:

{
  "domain": "tuya_ble",
  "name": "Tuya BLE",
  "bluetooth": [
    {
      "connectable": true,
      "service_data_uuid": "0000a201-0000-1000-8000-00805f9b34fb"
    }
  ],
  "codeowners": ["@PlusPlus-ua, @Snuffy2"],
  "config_flow": true,
  "dependencies": ["bluetooth_adapters", "tuya"],
  "documentation": "https://www.home-assistant.io/integrations/tuya_ble",
  "requirements": ["tuya-iot-py-sdk==0.6.6", "pycountry==22.3.5"],
  "iot_class": "local_push",
  "version": "0.2.0"
}

The errors shown in: #92 (comment)
are from the v0.2.0 version. Please advise...

@Snuupy
Copy link

Snuupy commented Jan 15, 2024

Home Assistant Version: 2023.1.7 (manually installed)

you need to update to latest home assistant (2024.1.2 or something like that)

@Snuupy
Copy link

Snuupy commented Jan 15, 2024

If it is relevant, I do have this in the homeassistant: section of configuration.yaml.

country: US

I mean, you can try removing it

you can also try a stock HA config and add each part of your config to set what breaks it

@tunerooster
Copy link
Author

Home Assistant Version: 2023.1.7 (manually installed)

you need to update to latest home assistant (2024.1.2 or something like that)

I'll try that... Thanks

@kappuchino
Copy link

kappuchino commented Jan 19, 2024

I added all the edits to this repo: https://github.com/kappuchino/ha_tuya_ble/tree/dev, if you add this url to hacs as a custom rep, the specific bluetooth fingerbot should work.

@tunerooster
Copy link
Author

I added all the edits to this repo: https://github.com/kappuchino/ha_tuya_ble/tree/dev, if you add this url to hacs as a custom rep, the specific bluetooth fingerbot should work.

That's good! I'll try it...

However, I have gotten distracted by another project. I'll get back to this as soon as I can. Thanks!

@Nirolator
Copy link

Nirolator commented Mar 6, 2024

Hey
I am using Adaprox FingerBot Plus 531, HA 2024.2.1, works fine on official intergration on Tuya but as a cloud connection which makes it very slow with a delay time.
So I have searched all forks, comments and topic around here, I think I have made some steps to get the fingerbot working locally but still need your wisdom out here.
I used this fork: https://github.com/airy10/ha_tuya_ble
but used the files with the riecov42 values (button.py, devices.py, number.py, select.py, sensor.py,switch.py and text.py) from this fork https://github.com/kappuchino/ha_tuya_ble.
after installing the folder on custom_components, I did a restart and it found Fingerbot Plus AB5998, I added it but it shows the entites are not working. (it does pull 1 devices and 15 unavailable entities).
Maybe someone can check it out and see what else need to be done? I am stucked :)
thanks

@Nirolator
Copy link

image

@oded106e
Copy link

@Nirolator
Exact my issue, did you solved it?

@tunerooster
Copy link
Author

tunerooster commented Jun 28, 2024 via email

@ssuukk
Copy link

ssuukk commented Jul 31, 2024

One question. Where should the finger bot appear? As any other newly discovered device?

@Snuupy
Copy link

Snuupy commented Nov 6, 2024

fyi https://github.com/airy10/ha_tuya_ble works for me (press, not configure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants