GithubHelp home page GithubHelp logo

Comments (73)

dmickeyus avatar dmickeyus commented on July 24, 2024 3

Hi, I modified the code to make basic functions with lock, unlock and lock status for GIMDOW A1. My coding is quite dirty but it is working for me anyway. Hope it could provide some support for the development. BTW, many thanks everyone in supporting this project so that I could control my device without cloud.

tuya_ble.tar.gz

from ha_tuya_ble.

ReNeGaDe124 avatar ReNeGaDe124 commented on July 24, 2024 2

@chris24walsh I got the correct device id and now it is working perfectly. Thank you for the help!

from ha_tuya_ble.

mikekornikh avatar mikekornikh commented on July 24, 2024 1

from ha_tuya_ble.

chris24walsh avatar chris24walsh commented on July 24, 2024 1

@chris24walsh I got the correct device id and now it is working perfectly. Thank you for the help!

Bingo, great to hear! Have you also tried and encountered issues with the above BLE integration? It is still the aim to get local working smoothly for me of course, but I have almost never had issues after more than a year of using the cloud integration (only self-inflicted issues when the Tuya BLE gateway was disconnected accidentally or placed too far away). @dmickeyus I will try again sometime by removing the Tuya app as you mentioned, only I still use it for 1 or 2 devices still that don't have good local solutions e.g. Tuya wifi vacuum.

P.S. @dmickeyus you definitely should fork this repo and open a PR to include your additions for the Gimdow lock, if not I will do it, lol!! But seriously, please do so we can all contribute patches etc.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024 1

After walking through the explanations above and implementing the local json file - has anyone encountered the following: It recognizes the device but all sensors are grayed out and unavailable. image

From the logs it seems like the device isn't recognized Getting this stacktrace - Traceback (most recent call last): File "/config/custom_components/tuya_local_ble/tuya_ble/tuya_ble.py", line 139, in set_value await self._owner._update_from_user(self._id) File "/config/custom_components/tuya_local_ble/tuya_ble/tuya_ble.py", line 205, in _update_from_user await self._owner._send_datapoints([dp_id]) File "/config/custom_components/tuya_local_ble/tuya_ble/tuya_ble.py", line 1309, in _send_datapoints raise TuyaBLEDeviceError(0) custom_components.tuya_local_ble.tuya_ble.exceptions.TuyaBLEDeviceError: BLE deice returned error code

I'm also getting many Timeouts for the Mac address not found - not sure if related since I remember getting these timeouts very often a while back when this used to work

I faced similar case a year ago. It was because of the BLE connection. I was using rpi4 internal bluetooth device, the connection intermittently broken. Later I also tried USB Bluetooth adapter, but not really improved.

I am currently using esp32 ble_proxy to handle and quite stable with HA. I suggest you could also try stop your android app access the Lock via mobile coz the device wont allow multiple connections locally.

Good luck.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024 1

I guess the code should work but I didn't test as I don't have multiple devices in hands. Maybe without extra bruckets like this:

{
"XX:XX:XX:XX:XX:XX": {
"address": "XX:XX:XX:XX:XX:XX",
"uuid": "your_uuid_key",
"local_key": "your_secret_key'",
"device_id": "Your_device_id",
"category": "jtmspro",
"product_id": "rlyxv7pe",
"device_name": "A1 PRO MAX",
"product_model": "AT1",
"product_name": "Smart lock"
},
"XX:XX:XX:XX:XX:XX": {
"address": "XX:XX:XX:XX:XX:XX",
"uuid": "your_uuid_key",
"local_key": "your_secret_key'",
"device_id": "Your_device_id",
"category": "jtmspro",
"product_id": "rlyxv7pe",
"device_name": "A1 PRO MAX",
"product_model": "AT1",
"product_name": "Smart lock"
}
}

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024 1

@anonine9899
Congratulations, I am alright, take care of your family.

from ha_tuya_ble.

mikekornikh avatar mikekornikh commented on July 24, 2024

Hi, I modified the code to make basic functions with lock, unlock and lock status for GIMDOW A1. My coding is quite dirty but it is working for me anyway. Hope it could provide some support for the development. BTW, many thanks everyone in supporting this project so that I could control my device without cloud.

tuya_ble.tar.gz

You're amazing! Thank you so much! This was the last thing missing from my home assistant setup. Sorry for the noob question, but how do I install the tuya_ble.tar.gz file into my HA?

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

You may try to extract the tar file and paste the tuya_ble folder to custom_components. For windows, 7zip could help you to do so. Then restart HA should be good to go.

As it is not stable yet, to use this smart lock, bring the physical key when leaving the property ;)

from ha_tuya_ble.

mikekornikh avatar mikekornikh commented on July 24, 2024

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

If you choose not to give up, you may consider to try this one instead. It should be able to keep the connection more stable. But the coding is really bad, I don't know where to put the keepalive code properly. I hope someone could help me to solve this so that it may be able to merge into main branch in the future.
tuya_ble.zip
.

from ha_tuya_ble.

mikekornikh avatar mikekornikh commented on July 24, 2024

from ha_tuya_ble.

mikekornikh avatar mikekornikh commented on July 24, 2024

from ha_tuya_ble.

leonardoleb avatar leonardoleb commented on July 24, 2024

Hi, I modified the code to make basic functions with lock, unlock and lock status for GIMDOW A1. My coding is quite dirty but it is working for me anyway. Hope it could provide some support for the development. BTW, many thanks everyone in supporting this project so that I could control my device without cloud.

tuya_ble.tar.gz

Great work, dmickeyus!

It would be beneficial if you could post this code to a GitHub repository. In the future, we could merge this code to support a larger number of smart locks using the same add-on.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

ok, I'm willing to contribute, I will do it when I'm free.

from ha_tuya_ble.

chris24walsh avatar chris24walsh commented on July 24, 2024

@dmickeyus Using your code seems to add the correct buttons and sensors to the A1 Pro Max device under the Tuya BLE integration, but they stay in the 'unavailable' state. The logs show various errors such as 'Device unexpectedly disconnected', 'Sending device info request failed' and 'device not found, not in range, or poor RSSI'. I get this for all devices (2 A1 locks as well as some other bluetooth Tuya devices, including a Gimdow P1 Keypad), even for the lock that is just 3 metres from my HA server bluetooth dongle.
I think the devices only get added because of a lookup to Tuya Cloud, and they are not found by local discovery, is that right? I wonder if then if my bluetooth adapter is even supported by this integration - I don't have a Raspberry Pi, I'm using the Homeassistant Blue (Odroid N2+) with a TP-Link bluetooth dongle.
Incidentally, it would be great to be able to integrate the P1 Keypad through this integration, so that it can be used for other purposes (e.g. alarm panel). Have you looked at that device? If I can provide some data I will try!

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

If you choose not to give up, you may consider to try this one instead. It should be able to keep the connection more stable. But the coding is really bad, I don't know where to put the keepalive code properly. I hope someone could help me to solve this so that it may be able to merge into main branch in the future. tuya_ble.zip .

Hello @dmickeyus
Thanks a lot for this file, I just received my A1 lock and I'm going to test your file.

Since your last post, did you create a git repo or a new version of your code ?
I see that there is a ha_tuya_ble integration available here but A1 is not supported: https://github.com/PlusPlus-ua/ha_tuya_ble
I guess it is not related to your work...

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

@dmickeyus Using your code seems to add the correct buttons and sensors to the A1 Pro Max device under the Tuya BLE integration, but they stay in the 'unavailable' state. The logs show various errors such as 'Device unexpectedly disconnected', 'Sending device info request failed' and 'device not found, not in range, or poor RSSI'. I get this for all devices (2 A1 locks as well as some other bluetooth Tuya devices, including a Gimdow P1 Keypad), even for the lock that is just 3 metres from my HA server bluetooth dongle. I think the devices only get added because of a lookup to Tuya Cloud, and they are not found by local discovery, is that right? I wonder if then if my bluetooth adapter is even supported by this integration - I don't have a Raspberry Pi, I'm using the Homeassistant Blue (Odroid N2+) with a TP-Link bluetooth dongle. Incidentally, it would be great to be able to integrate the P1 Keypad through this integration, so that it can be used for other purposes (e.g. alarm panel). Have you looked at that device? If I can provide some data I will try!

@chris24walsh
Sorry for my late reply, From my understanding, using their accessories eg Keypad needs synchronization with Tuya Cloud to perform the flows. Some people like me would prefer local control and not to use Cloud service in order to save their system resources ;-). Luckily, ha_tuya_ble could control Tuya devices locally. So that we can use it to control the Gimdow smartlock.

https://developer.tuya.com/en/docs/iot/title?id=K9nmje3twsy7n

Refer to their sdk, I could not find a way to control the accessories locally. Sorry.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

hi @liouma
I am still using that old code, I didn't clone a new branch for it yet. Anyway, feel free to try it, it has been running in my HA for months and it does the job for me at least.

from ha_tuya_ble.

chris24walsh avatar chris24walsh commented on July 24, 2024

@dmickeyus thanks for your reply. I meant about trying to listen to the keypad/read it's endpoints, not integrate it with the lock. However, I looked up the listed endpoints on Tuya IoT developer console and there doesn't appear to be much documented there at all.

Regarding your code, I was able to get the locks integrated to HA eventually, it just took setting up an ESPHome Bluetooth proxy closer (presumably too much local 2.4GHz interference), removing the existing HA devices and waiting until they repaired (usually after restarting HA or reloading the integration). In the end, though, I found this integration less reliable than another cloud integration someone wrote for the Gimdow locks which actually works pretty flawlessly, just that it is not a local solution. The main reason I stopped using the local bluetooth integration is that I found it was crashing my HA instance :( Have you experienced this, or anyone else here? Would still love to rely on a local solution for the locks, ideally, but can't unless can fix these issues. Happy to provide testing/feedback.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

@dmickeyus thanks for your reply. I meant about trying to listen to the keypad/read it's endpoints, not integrate it with the lock. However, I looked up the listed endpoints on Tuya IoT developer console and there doesn't appear to be much documented there at all.

Regarding your code, I was able to get the locks integrated to HA eventually, it just took setting up an ESPHome Bluetooth proxy closer (presumably too much local 2.4GHz interference), removing the existing HA devices and waiting until they repaired (usually after restarting HA or reloading the integration). In the end, though, I found this integration less reliable than another cloud integration someone wrote for the Gimdow locks which actually works pretty flawlessly, just that it is not a local solution. The main reason I stopped using the local bluetooth integration is that I found it was crashing my HA instance :( Have you experienced this, or anyone else here? Would still love to rely on a local solution for the locks, ideally, but can't unless can fix these issues. Happy to provide testing/feedback.

hi @chris24walsh

I also faced crashing to HA when the hardware not paired properly, with the error similar to this #27 . Once paring is failed, HA have to be restarted to retry paring from ground or otherwise the HA will be crashed. I didn't figure out the reason for it but it works after several retries from repairing :-(. Two months later, it seems run even smoother after I migrated the HA from pi4 to x86 VM and also remove the cloud app from my mobile.

I guess you are using the smart lock with accessories, right? In this case, I believe the device has to run in cloud environment unless someone could find a way to integrate those accessories locally.

from ha_tuya_ble.

ReNeGaDe124 avatar ReNeGaDe124 commented on July 24, 2024

@dmickeyus thanks for your reply. I meant about trying to listen to the keypad/read it's endpoints, not integrate it with the lock. However, I looked up the listed endpoints on Tuya IoT developer console and there doesn't appear to be much documented there at all.

Regarding your code, I was able to get the locks integrated to HA eventually, it just took setting up an ESPHome Bluetooth proxy closer (presumably too much local 2.4GHz interference), removing the existing HA devices and waiting until they repaired (usually after restarting HA or reloading the integration). In the end, though, I found this integration less reliable than another cloud integration someone wrote for the Gimdow locks which actually works pretty flawlessly, just that it is not a local solution. The main reason I stopped using the local bluetooth integration is that I found it was crashing my HA instance :( Have you experienced this, or anyone else here? Would still love to rely on a local solution for the locks, ideally, but can't unless can fix these issues. Happy to provide testing/feedback.

Hello, can you please tell me how you got that cloud integration working? Did you have something to modify to make it work?

I put the files in custom_components, I added the lines in configuration.yaml (for the client id and api key is used client id and client secret, is that correct?) but after HA restart I get the following error in logs:

Logger: homeassistant.components.lock
Source: helpers/entity_platform.py:573
Integration: Lock (documentation, issues)
First occurred: 19:26:18 (1 occurrences)
Last logged: 19:26:18

gimdow: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 959, in async_device_update
await hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/gimdow/lock.py", line 125, in update
self._lock.update()
File "/config/custom_components/gimdow/gimdow.py", line 49, in update
if query_list.get("logs"):
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

Thank you! Regards

from ha_tuya_ble.

chris24walsh avatar chris24walsh commented on July 24, 2024

@ReNeGaDe124 Sounds like you have done essentially what I did; but did you define the "device_id" correctly in your configuration.yaml entry?
The error message looks like the lookup to the Tuya API endpoint doesn't find anything under:
query_result = self._openapi.get( f"/v1.0/devices/{self._device_id}/logs?end_time={end_time}&start_time={start_time}&type=7")

from ha_tuya_ble.

ReNeGaDe124 avatar ReNeGaDe124 commented on July 24, 2024

@ReNeGaDe124 Sounds like you have done essentially what I did; but did you define the "device_id" correctly in your configuration.yaml entry? The error message looks like the lookup to the Tuya API endpoint doesn't find anything under: query_result = self._openapi.get( f"/v1.0/devices/{self._device_id}/logs?end_time={end_time}&start_time={start_time}&type=7")

Do I have to get the device id from Iot Tuya? I thought I had to give it a name. I put the device id as gimdow_lock. What did you put?

from ha_tuya_ble.

chris24walsh avatar chris24walsh commented on July 24, 2024

@dmickeyus thanks for the tips, however I found that even when both my locks were paired and working fine, eventually one would stop responding. In addition (perhaps because of continuous pairing attempts from HA) HA would crash very frequently, almost like a memory leak. I had to remove the integration to fix this :( I'll try and get it working again sometime soon when I can afford the downtime from the cloud integration, which works perfectly so I depend quite heavily on it :) Agree with @mikekornikh though about these Gimdow locks, they are really amazing. I have one for years already, well before the Switchbot one came out, and they work very well with the batteries lasting a long time for the effort they put in.

from ha_tuya_ble.

chris24walsh avatar chris24walsh commented on July 24, 2024

@chris24walsh I got the correct device id and now it is working perfectly. Thank you for the help!

Bingo, great to hear! Have you also tried and encountered issues with the above BLE integration? It is still the aim to get local working smoothly for me of course, but I have almost never had issues after more than a year of using the cloud integration (only self-inflicted issues when the Tuya BLE gateway was disconnected accidentally or placed too far away). @dmickeyus I will try again sometime by removing the Tuya app as you mentioned, only I still use it for 1 or 2 devices still that don't have good local solutions e.g. Tuya wifi vacuum.

from ha_tuya_ble.

ReNeGaDe124 avatar ReNeGaDe124 commented on July 24, 2024

@chris24walsh I got the correct device id and now it is working perfectly. Thank you for the help!

Bingo, great to hear! Have you also tried and encountered issues with the above BLE integration? It is still the aim to get local working smoothly for me of course, but I have almost never had issues after more than a year of using the cloud integration (only self-inflicted issues when the Tuya BLE gateway was disconnected accidentally or placed too far away). @dmickeyus I will try again sometime by removing the Tuya app as you mentioned, only I still use it for 1 or 2 devices still that don't have good local solutions e.g. Tuya wifi vacuum.

I didn’t try the bluetooth integration because I want to use it with accessories (keypad and button).

Also I am afraid to unpair it from Smart Life because I have read on their Facebook page that I won’t be able to pair it again, only with Gimdow app and I don’t think that can be integrated in Home Assistant. There are some people who posted that they can’t pair their lock anymore. 😢

https://m.facebook.com/story.php?story_fbid=pfbid02BUMWj7ZZgsiufTo1raSZVdKjmnJfetcVVQeZKjdQApwg172Q7VP7CwAj6N4jEPzRl&id=102194888771247&mibextid=WC7FNe

Until now I was using the Google SDK to use the lock in Home Assistant (send voice command to unlock + PIN) but for the past couple of days it has stopped working. I think maybe because they are removing support. So I started looking for an alternative and I’m glad I found the integration you mentioned. 😊

from ha_tuya_ble.

chris24walsh avatar chris24walsh commented on July 24, 2024

@ReNeGaDe124 I was able to re-pair my locks to Tuya Smart (essentially the same as Smart Life) app after removing them, during some testing. But I have encountered that I am now unable to pair the keypad I have, or the keyfob button, back with the locks - not sure if that was particularly what you were referring to. It used to work, and I can't say when exactly it stopped working, because I practically didn't use them anyway. It sucks now though, because I actually would like to use them again, particularly the keypad. It's a nice piece of hardware, and would be a great alarm panel if I could get the events in HA, so if I could at least pair it with my lock I could infer to disarm whenever the lock is unlocked.

I also was using the Alexa integration to lock/unlock from HA, so glad to now have an integration that works directly with cloud api, since the Alexa way was soo slow and buggy. Reliable use of the direct BLE integration would be 11/10 though, especially if there was some way to read events of the keypad/keyfob.

from ha_tuya_ble.

suba83 avatar suba83 commented on July 24, 2024

Hello everyone! Who can describe how to integrate custom_components created by @dmickeyus (step by step)? I created a folder with custom_components, placed files there. After the reboot, a new Tuya integration appeared. In the first dialog box, I entered the Access ID and Take It Access Secret, Account, Password from Take It Platform. As a result, I got a lock with buttons, but they are not all active.
There are errors in the logs:
This error originated from a custom integration.

Logger: custom_components.Gimdow.tuya_ble.tuya_ble
Source: custom_components/Gimdow/tuya_ble/tuya_ble.py:863
Integration: Gimdow
First occurred: 22:08:59 (7 occurrences)
Last logged: 22:15:36

DC:23:4E:D1:E5:2A: timeout receiving response, RSSI: -21
DC:23:4E:D1:E5:2A: timeout receiving response, RSSI: -30
DC:23:4E:D1:E5:2A: timeout receiving response, RSSI: -22

This error originated from a custom integration.

Logger: custom_components.Gimdow.tuya_ble.tuya_ble
Source: custom_components/Gimdow/tuya_ble/tuya_ble.py:627
Integration: Gimdow
First occurred: 22:08:59 (7 occurrences)
Last logged: 22:15:36

DC:23:4E:D1:E5:2A: Sending device info request failed

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/Gimdow/tuya_ble/tuya_ble.py:1309
Integration: Gimdow
First occurred: 22:08:59 (8 occurrences)
Last logged: 22:15:59

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/Gimdow/tuya_ble/tuya_ble.py", line 139, in set_value
await self._owner._update_from_user(self._id)
File "/config/custom_components/Gimdow/tuya_ble/tuya_ble.py", line 205, in _update_from_user
await self._owner._send_datapoints([dp_id])
File "/config/custom_components/Gimdow/tuya_ble/tuya_ble.py", line 1309, in _send_datapoints
raise TuyaBLEDeviceError(0)
custom_components.Gimdow.tuya_ble.exceptions.TuyaBLEDeviceError: BLE deice returned error code 0
This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/Gimdow/tuya_ble/tuya_ble.py:1309
Integration: Gimdow
First occurred: 22:08:59 (8 occurrences)
Last logged: 22:15:59

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/Gimdow/tuya_ble/tuya_ble.py", line 139, in set_value
await self._owner._update_from_user(self._id)
File "/config/custom_components/Gimdow/tuya_ble/tuya_ble.py", line 205, in _update_from_user
await self._owner._send_datapoints([dp_id])
File "/config/custom_components/Gimdow/tuya_ble/tuya_ble.py", line 1309, in _send_datapoints
raise TuyaBLEDeviceError(0)
custom_components.Gimdow.tuya_ble.exceptions.TuyaBLEDeviceError: BLE deice returned error code 0

2023-11-25_22-32-07

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

Hello, as you know there was many evolutions in tuya and problems were reported with tuya_ble.
New versions of the code were written by different persons to patch it.

@dmickeyus : can your please share your updated code ?
Thank you again so much !

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

Hello, I am ok to share my currently functional version but I cannot guarantee it works to you guys. Since tuya changed its sdk api version, old api won't work in the near future. I am done to rely on the cloud to retrieve the secret keys. I believe I should be the key owner, not the cloud. That means, my code removed the cloud login to retreive the device info. Instead, one needs to get the them manually and put it into the file. This version reads the local file and control everything locally. Once discovered your BLE smart lock that matches your file MAC address and keys, it will add to your inventory automatically. I also replaced using button entities with lock entity to control and update status.

As usual, unpack the file to custom_components and create the secret file /config/tuya_local_ble/devices.json with the following format:
{
"XX:XX:XX:XX:XX:XX": {
"address": "XX:XX:XX:XX:XX:XX",
"uuid": "your_uuid_key",
"local_key": "your_secret_key'",
"device_id": "Your_device_id",
"category": "jtmspro",
"product_id": "rlyxv7pe",
"device_name": "A1 PRO MAX",
"product_model": "AT1",
"product_name": "Smart lock"
}
}

If you are lucky enough, your could find these information from the old home assistant bakcup in /config/.storage/core.config_entries. If not, find them via your tuya account. They are waiting for you.

tuya_local_ble.zip

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

Thanks a lot once again @dmickeyus !!

Do you know the python script tinytuya ?
It can retrieve all the tuya info instead of the tuya dev cloud. I find it really usefull.

I installed your script, restarted, then my gimdow lock was discovered immediately and installed.
At first, the AI PRO MAX lock appeared correctly but with no entity.
Then a second device was discovered and a configure button appeard on the first device.

When I clicked on "configure" on any of those devices I got:

Erreur
Le flux de configuration n'a pas pu être chargé: 500 Internal Server Error Server got itself in trouble

and in my logs:
/config/custom_components/tuya_local_ble/text.py:134: SyntaxWarning: invalid escape sequence '\d' pattern="^((\d{1,2}|100)(\/\d{1,2})?)(;((\d{1,2}|100)(\/\d{1,2})?))+$",

Later 4 entities appeared on the first lock and it started to work fine :)

When I click on "configure" I still get the same error.
But it work fine.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

Hi @liouma ,

I didn't try tinytuya yet but I suggest the lock should bundle with a CD driver with this script included.

Per your question, it seems to be charset and python version issue, could you try add 'r' to declare as rawstring. ie pattern=r"^((\d{1,2}|100)(/\d{1,2})?)(;(........

Or, the lock does not use text.py, I guess delete this file could also eliminate the error.

The patch also featured a jam detection timer, I set to 12 seconds as default. You may test and change the value per your needs. Read the lock.py and you will find it out.

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

About the CD driver I completely agree with you :D

Adding the 'r' fixed the error. Thank you :)

What happens for you when you click on "configure"?
Here, I get the following message:
The configuration stream could not be loaded: 500 Internal Server Error Server got itself in trouble

I don't know if it's really a problem.
Thank you for the info regarding the jam detection timer. I'll test different values if necessary.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

The config button was used on original code for changing cloud account info. It is no use now. Thanks for checking this out. I should remove it next time, maybe.

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

Thanks a lot It's working really fine!!!

I guess you are too busy for that, but that would be great if someone could publish and maintain a new tuya_local_ble integration based on your work, don't you think so??

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

I agreed, I will be happy if someone could properly branch it out and help to keep maintaining it. I believe more ppl will find this useful if the setup steps are documented.

from ha_tuya_ble.

mikekornikh avatar mikekornikh commented on July 24, 2024

from ha_tuya_ble.

TomekKazim avatar TomekKazim commented on July 24, 2024

Hello
Can you describe in more detail how to install the lock? Everything seems clear, but nothing is detected in my case.
After these changes, there are so many errors in Tuya and it works slowly that I would move it from the cloud to Home Assistant, but the lock is the most important and it does not work in other add-ons. I have it set to truenas and it is an esp32.
proxy.
Need to disconnect your lock from the cloud? to detect

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

You need to remove your previous tuya_ble integration.
Then you unzip the folder into folder config/custom_components/tuya_local_ble
Create a file /config/tuya_local_ble/devices.json with the info posted previously in this thread. Replace all the info with your account info. You can use tinytuya to get it. Replace XX:XX... with the mac address.
Restart HA. A new device will be discovered, configure it. At first there won't be any entity, but be patient and it will appear.

from ha_tuya_ble.

efranulic avatar efranulic commented on July 24, 2024

Hello liouma, I have all parameters for devices.json except address... Can you explain in more detail the way to obtain the MAC address please?

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

The MAC address should be the easiest to obtain :)
This is the hardware address of your bluetooth car, so any device like your phone connected to the smart lock should have it. But it doesn't mean it's displayed. Check on your tuya app if it appear in a field like about your device. Or try to pair your phone and see if you can get it.

I used tiny tuya to get it with all other tuya params. If you have a machine with python installed you can find a tutorial online to get evertything about your tuya device incl MAC, otherwise it's a bit overkill...

@ALL: How did yoiu all got your bluetooth mac addr ??

from ha_tuya_ble.

efranulic avatar efranulic commented on July 24, 2024

from ha_tuya_ble.

smirnowegor avatar smirnowegor commented on July 24, 2024

Need to disconnect your lock from the cloud? to detect

Hi to all!
Still fighting with the lock... it don't show up as a new device.
Some maybe foolish questions:
Should it be disconnected from Tuya app?
Should there be any writing int configuration file?
Where should be created /config/tuya_local_ble/devices.json?

from ha_tuya_ble.

TomekKazim avatar TomekKazim commented on July 24, 2024

Check the paths to the folder and devices.json carefully because they should be different. You don't have to remove it from Tuya, but when you add it again, the local key changes

from ha_tuya_ble.

idanmid15 avatar idanmid15 commented on July 24, 2024

After walking through the explanations above and implementing the local json file - has anyone encountered the following:
It recognizes the device but all sensors are grayed out and unavailable.
image

From the logs it seems like the device isn't recognized
Getting this stacktrace -
Traceback (most recent call last):
File "/config/custom_components/tuya_local_ble/tuya_ble/tuya_ble.py", line 139, in set_value
await self._owner._update_from_user(self._id)
File "/config/custom_components/tuya_local_ble/tuya_ble/tuya_ble.py", line 205, in _update_from_user
await self._owner._send_datapoints([dp_id])
File "/config/custom_components/tuya_local_ble/tuya_ble/tuya_ble.py", line 1309, in _send_datapoints
raise TuyaBLEDeviceError(0)
custom_components.tuya_local_ble.tuya_ble.exceptions.TuyaBLEDeviceError: BLE deice returned error code

I'm also getting many Timeouts for the Mac address not found - not sure if related since I remember getting these timeouts very often a while back when this used to work

from ha_tuya_ble.

TomekKazim avatar TomekKazim commented on July 24, 2024

Today I have the same problem and I had it 2 weeks ago. Recently I removed the lock from Tuya and added it again, changed the key in devices.json and it worked.
edit:
After a few restarts and clicking ESP - it worked. maybe it has something to do with HA because it takes a long time to start and works slowly

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

For anyone interested, I upgraded HA 202405 and found the plugin sometimes not loaded normally. The integration page showed it is loaded but the status shown Not available. I made some updates and hope it could do some help.

tuya_local_ble.zip

from ha_tuya_ble.

comandor1967 avatar comandor1967 commented on July 24, 2024

I have done all the above operations, nothing works. You can publish a ready-made integration so as not to waste time.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

@comandor1967 , u're right, this plug is literally not working. Dont waste time on it.

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

I have done all the above operations, nothing works. You can publish a ready-made integration so as not to waste time.

@comandor1967 : dmickeyus is kind enough to share his code with us but already explained that he does not have time to do more. Why don't you publish a new github with his code ?

from ha_tuya_ble.

smirnowegor avatar smirnowegor commented on July 24, 2024

It seems that i got connection to the lock, but only Signal is appeared

Снимок экрана 2024-05-10 132124

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

Unfortunately, your image shown your device is uueg45qu which is not A1 PRO MAX, the code wont support it. I dont have this device but I believe it is similar but need a bit works.

from ha_tuya_ble.

TomekKazim avatar TomekKazim commented on July 24, 2024

thank you, it works

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

I made some updates and hope it could do some help.

tuya_local_ble.zip

@dmickeyus
Thanks for this new upload. Unfortunately my device is not recognized after upgrading the tuya_local_ble folded.
I removed the device and after it is not discovered.
I tried removing the folder, restart, add it again and restart, no sucess.
At each step I checked that devices.json is correct.
Any chance that something is missing in your zip file ? or maybe something changed since previous version ?
Thanks

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

I made some updates and hope it could do some help.
tuya_local_ble.zip

@dmickeyus Thanks for this new upload. Unfortunately my device is not recognized after upgrading the tuya_local_ble folded. I removed the device and after it is not discovered. I tried removing the folder, restart, add it again and restart, no sucess. At each step I checked that devices.json is correct. Any chance that something is missing in your zip file ? or maybe something changed since previous version ? Thanks

Anything bad shown in log? Assume it was working previously, the json would be fine. Overwrite the folder and restart HA should works. BTW, what BLE you are using? If no discovery, most likely the connection between BLE and the lock, try restart the bluetooth.

from ha_tuya_ble.

domibroz avatar domibroz commented on July 24, 2024

Hi.
When I try to add Tuya Local BLE integration I'm getting not_implemented error.
What could be a reason?
image

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

It should be automatically discovered from BLE when the json config file is matched with the device. Manual add button is not used.

from ha_tuya_ble.

brunoblazer avatar brunoblazer commented on July 24, 2024

hello,
Seeing if anyone can help me because I've been back from this for almost a week and I haven't achieved anything.
I'll tell you what I did and see if I'm missing anything.
I pasted the new tuya_local_ble folder into the correct custom_components and created the devices.json file
the file I created was like this
{
"MAC DO FINGERBOOT": {
"address": "MAC DO FINGERBOOT",
"uuid": "UUID DO FINGERBOOT",
"local_key": "LOCAL KEY DO FINGERBOOT",
"device_id": "DEVICE ID FINGERBOOT",
"category": "szjqr",
"product_id": "xhf790if",
"device_name": "CUBETOUCH II",
"product_model": "CBTB3002",
"product_name": "CUBETOUCH II"
}
}

When restarting, nothing is detected
I didn't do anything other than restart the HA, if I'm adding equipment
image

when clicking on add it gives the error:
not_implemented

Do I need to do anything? insert your data somewhere like configuration or something?

from ha_tuya_ble.

liouma avatar liouma commented on July 24, 2024

@brunoblazer : I have the same problem and did not solve it. @dmickeyus asked me to check my logs but I didnt have time.
Can you check in your logs what happens?

@dmickeyus : did not have time to analyse my logs as you asked that's why I did not answer yet, sorry.
But as you guessed: yes, it was working previously, I triple checked the json. I use BLE proxy on esp32, restarted without success.

from ha_tuya_ble.

efranulic avatar efranulic commented on July 24, 2024

hello, Seeing if anyone can help me because I've been back from this for almost a week and I haven't achieved anything. I'll tell you what I did and see if I'm missing anything. I pasted the new tuya_local_ble folder into the correct custom_components and created the devices.py file the file I created was like this { "MAC DO FINGERBOOT": { "address": "MAC DO FINGERBOOT", "uuid": "UUID DO FINGERBOOT", "local_key": "LOCAL KEY DO FINGERBOOT", "device_id": "DEVICE ID FINGERBOOT", "category": "szjqr", "product_id": "xhf790if", "device_name": "CUBETOUCH II", "product_model": "CBTB3002", "product_name": "CUBETOUCH II" } }

When restarting, nothing is detected I didn't do anything other than restart the HA, if I'm adding equipment image

when clicking on add it gives the error: not_implemented

Do I need to do anything? insert your data somewhere like configuration or something?

Hello @brunoblazer, the devices file extension shoud be .json, not .py

from ha_tuya_ble.

brunoblazer avatar brunoblazer commented on July 24, 2024

hello, Seeing if anyone can help me because I've been back from this for almost a week and I haven't achieved anything. I'll tell you what I did and see if I'm missing anything. I pasted the new tuya_local_ble folder into the correct custom_components and created the devices.py file the file I created was like this { "MAC DO FINGERBOOT": { "address": "MAC DO FINGERBOOT", "uuid": "UUID DO FINGERBOOT", "local_key": "LOCAL KEY DO FINGERBOOT", "device_id": "DEVICE ID FINGERBOOT", "category": "szjqr", "product_id": "xhf790if", "device_name": "CUBETOUCH II", "product_model": "CBTB3002", "product_name": "CUBETOUCH II" } }

When restarting, nothing is detected I didn't do anything other than restart the HA, if I'm adding equipment image

when clicking on add it gives the error: not_implemented

Do I need to do anything? insert your data somewhere like configuration or something?

Hello @brunoblazer, the devices file extension shoud be .json, not .py

Hi , And it's in that format, I wrote badly in the post. Screenshot_20240527_162229_Home Assistant.jpg

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

@efranulic, unfortunately, the code is focused for A1 MAX smart lock only. For other tuya devices, I think it needs someone to find the datapoints for those devices to make it works.

@brunoblazer, it seems the devices.json placed in incorrect folder, it should not be inside the /config/custom_components/tuya_local_ble, instead, try to make a folder in /config/tuya_local_ble and put devices.json into.

from ha_tuya_ble.

comandor1967 avatar comandor1967 commented on July 24, 2024

only signal......... AT1 (rlyxv7pe)
Tuya

from ha_tuya_ble.

brunoblazer avatar brunoblazer commented on July 24, 2024

@dmickeyus 1000 thanks, it was as simple as that, copy/paste xD

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

@comandor1967, rlyxv7pe should work and category should be jtmspro. did you install also tuya in home assistant? it could be a reason to get conflict.

from ha_tuya_ble.

comandor1967 avatar comandor1967 commented on July 24, 2024

from ha_tuya_ble.

brunoblazer avatar brunoblazer commented on July 24, 2024

I'm very sleepy but to add more than one piece of equipment, shouldn't the code be like this?

[
{
"XX:XX:XX:XX:XX:XX": {
"address": "XX:XX:XX:XX:XX:XX",
"uuid": "your_uuid_key",
"local_key": "your_secret_key'",
"device_id": "Your_device_id",
"category": "jtmspro",
"product_id": "rlyxv7pe",
"device_name": "A1 PRO MAX",
"product_model": "AT1",
"product_name": "Smart lock"
}
},
{
"XX:XX:XX:XX:XX:XX": {
"address": "XX:XX:XX:XX:XX:XX",
"uuid": "your_uuid_key",
"local_key": "your_secret_key'",
"device_id": "Your_device_id",
"category": "jtmspro",
"product_id": "rlyxv7pe",
"device_name": "A1 PRO MAX",
"product_model": "AT1",
"product_name": "Smart lock"
}
}
]

from ha_tuya_ble.

comandor1967 avatar comandor1967 commented on July 24, 2024

from ha_tuya_ble.

brunoblazer avatar brunoblazer commented on July 24, 2024

Hello everybody,
This has worked impeccably like my fingerbots, it was what I needed and thank you for the development.
Now a person always thinks more :) does this apply to other equipment? For example, they detect my lamps but even if I put their data in the file, I can't install them, the same situation for a temperature and humidity reader is also true.

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

The foundation of the current development should be ready for most tuya ble devices. However, in order to support other devices, the device spec or reverse engineering is required to add sensors and controls. This is manufacturer independant.

from ha_tuya_ble.

anonine9899 avatar anonine9899 commented on July 24, 2024

@dmickeyus
First of all, Kudos for all your work!
I finally succeed to see the lock within ha_tuya_BLE but everything is grayed out.
I tried to turn off my phone's Bluetooth and restart HA and took out batteries and back in and disabled Tuya integration.
What am I missing here?

HAOS on RPI4, using local BT, setting on BT is "passive scan - V" (ive tried to remove it and stil nothing.
Nothing else is connected to my RPI via BT.

image

Core 2024.6.1
Supervisor 2024.06.0
Operating System 12.3
Frontend 20240605.0

Thanks!

image

from ha_tuya_ble.

dmickeyus avatar dmickeyus commented on July 24, 2024

@anonine9899
I believe you can make it eventually as the model is matched and bluetooth discovered the device sucessfully. A flash from my head is that you may check the HA system log. You could also check again the devices.json parameters again but at least I could confirm the MAC address and the file path are correct.

I guess you may already know that if you are using ESP32 proxy, there is a limitation that each could maximum connect to 3 BLE devices.

Good luck.

from ha_tuya_ble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.