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

Request for Gimdow A1 Max smart lock #46

Open
mikekornikh opened this issue Jul 18, 2023 · 87 comments
Open

Request for Gimdow A1 Max smart lock #46

mikekornikh opened this issue Jul 18, 2023 · 87 comments

Comments

@mikekornikh
Copy link

Hi! I want to start by thanking you for the amazing work. I was also born in Ukraine, so I personally feel the terror you're going through. I'm hoping you can help integrate the Gimdow A1 Max smart lock here. I love this lock, and it's my really my only option for my rental apartment because it goes right over the included door lock. Here's a link to the product page https://www.gimdow.com/GIMDOW-A1.html

Product: A1 PRO MAX
Device Information
Product Name
M515EGWT V2
Product Category
cl

Any help would be greatly appreciated!

@dmickeyus
Copy link

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

@mikekornikh
Copy link
Author

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?

@dmickeyus
Copy link

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 ;)

@mikekornikh
Copy link
Author

mikekornikh commented Jul 22, 2023 via email

@dmickeyus
Copy link

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
.

@mikekornikh
Copy link
Author

mikekornikh commented Jul 22, 2023 via email

@mikekornikh
Copy link
Author

mikekornikh commented Jul 23, 2023 via email

@leonardoleb
Copy link

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.

@dmickeyus
Copy link

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

@chris24walsh
Copy link

@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!

@liouma
Copy link

liouma commented Nov 7, 2023

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...

@dmickeyus
Copy link

@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.

@dmickeyus
Copy link

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.

@chris24walsh
Copy link

@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.

@mikekornikh
Copy link
Author

mikekornikh commented Nov 8, 2023 via email

@dmickeyus
Copy link

@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.

@ReNeGaDe124
Copy link

@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

@chris24walsh
Copy link

@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")

@ReNeGaDe124
Copy link

@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?

@chris24walsh
Copy link

chris24walsh commented Nov 16, 2023

@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.

@ReNeGaDe124
Copy link

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

@chris24walsh
Copy link

@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.

@chris24walsh
Copy link

@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.

@ReNeGaDe124
Copy link

@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. 😊

@chris24walsh
Copy link

chris24walsh commented Nov 21, 2023

@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.

@suba83
Copy link

suba83 commented Nov 25, 2023

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

@liouma
Copy link

liouma commented Apr 4, 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 !

@dmickeyus
Copy link

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

@liouma
Copy link

liouma commented Apr 6, 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.

@dmickeyus
Copy link

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.

@liouma
Copy link

liouma commented May 27, 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.

@efranulic
Copy link

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

@brunoblazer
Copy link

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

@dmickeyus
Copy link

dmickeyus commented May 27, 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.

@comandor1967
Copy link

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

@brunoblazer
Copy link

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

@dmickeyus
Copy link

dmickeyus commented May 27, 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.

@comandor1967
Copy link

comandor1967 commented May 27, 2024 via email

@brunoblazer
Copy link

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"
}
}
]

@dmickeyus
Copy link

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"
}
}

@comandor1967
Copy link

comandor1967 commented May 28, 2024 via email

@brunoblazer
Copy link

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.

@dmickeyus
Copy link

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.

@anonine9899
Copy link

anonine9899 commented Jun 12, 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

@dmickeyus
Copy link

dmickeyus commented Jun 13, 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.

@dmickeyus
Copy link

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

@JacobDK8200
Copy link

There is a "A1 Pro Max Bluetooth Smart Door Lock Tuya" on aliexpress. Anyone knows if that works with this integration?

Dont wanna buy one and a esp32 proxy, just to find out it does not work :-)

Thanks.

@liouma
Copy link

liouma commented Aug 7, 2024

There is a "A1 Pro Max Bluetooth Smart Door Lock Tuya" on aliexpress. Anyone knows if that works with this integration?

This is the one I use and it's working fine

@JacobDK8200
Copy link

@liouma Thanks!

Can I use the bluetooth keyfob after integration with HA? Or is it like the keypad and it needs cloud integration?

@liouma
Copy link

liouma commented Aug 7, 2024

Can I use the bluetooth keyfob

I don't know, I will let other persons answer your question

@mikekornikh
Copy link
Author

@liouma Thanks!

Can I use the bluetooth keyfob after integration with HA? Or is it like the keypad and it needs cloud integration?

I suggest not even buying the keyfob. When I first got the A1 pro max, before this integration worked for it, I ordered 2 keyfobs on Aliexpress. I thought I could use them day-to-day or make an esp device that triggered it so home Assistant works. In order to use it, you have to go through the Tuya app and pair them. After doing that, they worked, but really bad. There was always a long delay waiting for the lock to respond to the button press. Same happened on both keyfobs I tried. I ended up returning them. I'm thinking now it was probably because the lock has trouble dealing with multiple clients and when it was connected to the Tuya hub, it had a hard time listening to the fob.

Given that this integration is for Home Assistant, I'm assuming you have that. There are WAYYYY better options home Assistant gives you. For example...Instead of having to carry around the fob, I just stuck an NFC tag by my door. When I come home, I just tap and it opens instantly. No lag or delay. And that tag is secure because you can only use it with a phone that has HA installed, is logged-in and that account has permission to access this automation. I have a contact sensor on the door, so it auto-locks when I close it. Also, you now have the power of using anything that works with Home Assistant. You can buy any one of those little keychain buttons and get that to work or even make an ESPHome keypad.

@mikekornikh
Copy link
Author

There is a "A1 Pro Max Bluetooth Smart Door Lock Tuya" on aliexpress. Anyone knows if that works with this integration?

Dont wanna buy one and a esp32 proxy, just to find out it does not work :-)

Thanks.

That is the one I bought that I've used with this integration for over a year now

@anonine9899
Copy link

There is a "A1 Pro Max Bluetooth Smart Door Lock Tuya" on aliexpress. Anyone knows if that works with this integration?

Dont wanna buy one and a esp32 proxy, just to find out it does not work :-)

Thanks.

I bought this one, haven't got a fob.
working great, but the batteries are running low real fast.
affiliate link for the lock

@mikekornikh
Copy link
Author

There is a "A1 Pro Max Bluetooth Smart Door Lock Tuya" on aliexpress. Anyone knows if that works with this integration?
Dont wanna buy one and a esp32 proxy, just to find out it does not work :-)
Thanks.

I bought this one, haven't got a fob. working great, but the batteries are running low real fast. affiliate link for the lock

Really? Mine lasted a year with heavy use. Are you using rechargeable batteries?

@anonine9899
Copy link

There is a "A1 Pro Max Bluetooth Smart Door Lock Tuya" on aliexpress. Anyone knows if that works with this integration?
Dont wanna buy one and a esp32 proxy, just to find out it does not work :-)
Thanks.

I bought this one, haven't got a fob. working great, but the batteries are running low real fast. affiliate link for the lock

Really? Mine lasted a year with heavy use. Are you using rechargeable batteries?

yes, ikea HR06 AA 1.2V, ‎2450mAh‏
by real fast I mean once every two-three weeks, at least 4 unlocks-locks a day, each lock-unlock is a 720 rotation.

@mikekornikh
Copy link
Author

There is a "A1 Pro Max Bluetooth Smart Door Lock Tuya" on aliexpress. Anyone knows if that works with this integration?
Dont wanna buy one and a esp32 proxy, just to find out it does not work :-)
Thanks.

I bought this one, haven't got a fob. working great, but the batteries are running low real fast. affiliate link for the lock

Really? Mine lasted a year with heavy use. Are you using rechargeable batteries?

yes, ikea HR06 AA 1.2V, ‎2450mAh‏ by real fast I mean once every two-three weeks, at least 4 unlocks-locks a day, each lock-unlock is a 720 rotation.

That's why. When I tried using rechargeable batteries, it even started off saying the battery level was medium at best with a fresh set. It starts off 1.2V lower than normal, and drops fast from there. Put four fresh disposable alkaline batteries (1.5v) in there and see how long they last.

@liouma
Copy link

liouma commented Aug 9, 2024

I agree with both of you:: we need 1.5v batteries, 1.2v don't last enough. And i don't like using disposable batteries.
The solution I found is using 1.5v li-ion rechargeable in usb batteries from Aliexpress. Its working fine.

@mikekornikh
Copy link
Author

I agree with both of you:: we need 1.5v batteries, 1.2v don't last enough. And i don't like using disposable batteries. The solution I found is using 1.5v li-ion rechargeable in usb batteries from Aliexpress. Its working fine.

Yeah, I wish I also mentioned that an alternative rechargeable battery chemistry would be a solution too, if you really INSIST on rechargeable batteries. My 2¢ is that this is the least ideal situation for using rechargeable batteries. The benefit of alkaline is they are dirt cheap and will last about a year here. Those lithium batteries won't come close to lasting as long and cost orders of magnitudes more. And I want to be clear, I'm a huge fan of rechargeable batteries. I didn't even have any alkalines in my house when I got this lock. Back then, Lithium batteries were like $30 for a 4 pack (so I would need 2 to be able to swap and not have downtime while charging) I bought a 20 pack of alkalines from Amazon for $9 and they will last me literally 5 years with minimum changes. (They're guaranteed to hold their charge for more than 10 years) Lithium batteries make more sense for things like game controllers because they drain the battery quickly. Again, this is just my reasoning/logic and if you have access to cheap lithium batteries and don't mind changing them out every few months, then have at it.

@idoeilon
Copy link

image

Hi guys, just trying to connect my lock through the guys local ble but all entities are unavailable..
What am I doing wrong?

@dmickeyus
Copy link

Your device was detected successfully at least. Check again the json file including its format, values, and path. I believe you will make it eventually.

Good Luck!

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