Skip to content

Commit 20b17b7

Browse files
committed
Update to version 0.1.4
### Added - Added support of CUBETOUCH 1s, thanks @damiano75 - Added new product_ids for Fingerbot. - Added new product_ids for Fingerbot Plus. - First attempt to support Smart Lock device. ### Fixed - Fixed possible disconnect of BLE device.
1 parent 9c3f484 commit 20b17b7

File tree

11 files changed

+227
-130
lines changed

11 files changed

+227
-130
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,17 @@ and this project adheres to [Semantic Versioning].
3030
### Changed
3131

3232
- Changed a way to obtain device credentials from Tuya IOT cloud, possible fix to (#2)
33+
34+
## [0.1.4] - 2023-04-30
35+
36+
### Added
37+
38+
- Added support of CUBETOUCH 1s, thanks @damiano75
39+
- Added new product_ids for Fingerbot.
40+
- Added new product_ids for Fingerbot Plus.
41+
- First attempt to support Smart Lock device.
42+
43+
### Fixed
44+
45+
- Fixed possible disconnect of BLE device.
46+

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ The integration works locally, but connection to Tuya BLE device requires device
2121
## Supported devices list
2222

2323
* Fingerbots (category_id 'szjqr')
24-
+ Fingerbot (product_id 'yrnk7mnn'), original device, first in category, powered by CR2 battery.
24+
+ Fingerbot (product_ids 'ltak7e1p', 'yrnk7mnn'), original device, first in category, powered by CR2 battery.
2525
+ Adaprox Fingerbot (product_id 'y6kttvd6'), built-in battery with USB type C charging.
2626
+ Fingerbot Plus (product_ids 'blliqpsj', 'yiihr7zh'), almost same as original, has sensor button for manual control.
27+
+ CubeTouch 1s (product_id '3yqdo5yt'), built-in battery with USB type C charging.
2728
+ CubeTouch II (product_id 'xhf790if'), built-in battery with USB type C charging.
2829

2930
All features available in Home Assistant, except programming (series of actions) - it's not documented and looks useless because it could be implemented by Home Assistant scripts or automations.
@@ -33,3 +34,6 @@ The integration works locally, but connection to Tuya BLE device requires device
3334

3435
* CO2 sensors (category_id 'co2bj')
3536
+ CO2 Detector (product_id '59s19z5m').
37+
38+
* Smart Locks (category_id 'ms')
39+
+ Smart Lock (product_id 'ludzroix'), first attempt to support for now.

custom_components/tuya_ble/button.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def is_fingerbot_in_push_mode(
4040
self: TuyaBLEButton,
4141
product: TuyaBLEProductInfo
4242
) -> bool:
43-
result: bool = False
43+
result: bool = True
4444
if product.fingerbot:
4545
datapoint = self._device.datapoints[product.fingerbot.mode]
4646
if datapoint:
@@ -78,7 +78,7 @@ class TuyaBLECategoryButtonMapping:
7878
],
7979
),
8080
**dict.fromkeys(
81-
["y6kttvd6", "yrnk7mnn"], # Fingerbot
81+
["ltak7e1p", "y6kttvd6", "yrnk7mnn"], # Fingerbot
8282
[
8383
TuyaBLEFingerbotModeMapping(dp_id=2),
8484
],

custom_components/tuya_ble/config_flow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,16 @@ async def async_step_login(
171171
self, user_input: dict[str, Any] | None = None
172172
) -> FlowResult:
173173
"""Handle the Tuya IOT platform login step."""
174-
data: dict[str, Any] | None = None
175174
errors: dict[str, str] = {}
176175
placeholders: dict[str, Any] = {}
177176
credentials: TuyaBLEDeviceCredentials | None = None
178177
address: str | None = self.config_entry.data.get(CONF_ADDRESS)
179178

180179
if user_input is not None:
181-
entry: TuyaBLEData = self.hass.data[DOMAIN][
182-
self.config_entry.entry_id
183-
]
180+
entry: TuyaBLEData | None = None
181+
domain_data = self.hass.data.get(DOMAIN)
182+
if domain_data:
183+
entry = domain_data.get(self.config_entry.entry_id)
184184
if entry:
185185
login_data = await _try_login(
186186
entry.manager,

custom_components/tuya_ble/devices.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ class TuyaBLECategoryInfo:
161161
),
162162
},
163163
),
164+
"ms": TuyaBLECategoryInfo(
165+
products={
166+
"ludzroix": # device product_id
167+
TuyaBLEProductInfo(
168+
name="Smart Lock",
169+
),
170+
},
171+
),
164172
"szjqr": TuyaBLECategoryInfo(
165173
products={
166174
"3yqdo5yt": # device product_id
@@ -202,7 +210,7 @@ class TuyaBLECategoryInfo:
202210
)
203211
),
204212
**dict.fromkeys(
205-
["y6kttvd6", "yrnk7mnn"], # device product_ids
213+
["ltak7e1p", "y6kttvd6", "yrnk7mnn"], # device product_ids
206214
TuyaBLEProductInfo(
207215
name="Fingerbot",
208216
fingerbot=TuyaBLEFingerbotInfo(

custom_components/tuya_ble/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"documentation": "https://www.home-assistant.io/integrations/tuya_ble",
1414
"requirements": ["tuya-iot-py-sdk==0.6.6", "pycountry"],
1515
"iot_class": "local_push",
16-
"version": "0.1.2"
16+
"version": "0.1.4"
1717
}

custom_components/tuya_ble/number.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def is_fingerbot_in_push_mode(
7979
self: TuyaBLENumber,
8080
product: TuyaBLEProductInfo
8181
) -> bool:
82-
result: bool = False
82+
result: bool = True
8383
if product.fingerbot:
8484
datapoint = self._device.datapoints[product.fingerbot.mode]
8585
if datapoint:
@@ -143,6 +143,24 @@ class TuyaBLECategoryNumberMapping:
143143
],
144144
},
145145
),
146+
"ms": TuyaBLECategoryNumberMapping(
147+
products={
148+
"ludzroix": # Smart Lock
149+
[
150+
TuyaBLENumberMapping(
151+
dp_id=8,
152+
description=NumberEntityDescription(
153+
key="residual_electricity",
154+
native_max_value=100,
155+
native_min_value=-1,
156+
native_unit_of_measurement=PERCENTAGE,
157+
native_step=1,
158+
entity_category=EntityCategory.CONFIG,
159+
),
160+
),
161+
]
162+
}
163+
),
146164
"szjqr": TuyaBLECategoryNumberMapping(
147165
products={
148166
**dict.fromkeys(
@@ -178,7 +196,7 @@ class TuyaBLECategoryNumberMapping:
178196
],
179197
),
180198
**dict.fromkeys(
181-
["y6kttvd6", "yrnk7mnn"], # Fingerbot
199+
["ltak7e1p", "y6kttvd6", "yrnk7mnn"], # Fingerbot
182200
[
183201
TuyaBLENumberMapping(
184202
dp_id=9,

custom_components/tuya_ble/select.py

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,25 @@ class TuyaBLECategorySelectMapping:
7474
],
7575
},
7676
),
77-
"wsdcg": TuyaBLECategorySelectMapping(
77+
"ms": TuyaBLECategorySelectMapping(
7878
products={
79-
"ojzlzzsw": # Soil moisture sensor
79+
"ludzroix": # Smart Lock
8080
[
8181
TuyaBLESelectMapping(
82-
dp_id=9,
83-
description=TemperatureUnitDescription(
82+
dp_id=31,
83+
description=SelectEntityDescription(
84+
key="beep_volume",
8485
options=[
85-
UnitOfTemperature.CELSIUS,
86-
UnitOfTemperature.FAHRENHEIT,
86+
"mute",
87+
"low",
88+
"normal",
89+
"high",
8790
],
88-
entity_registry_enabled_default=False,
89-
)
91+
entity_category=EntityCategory.CONFIG,
92+
),
9093
),
91-
],
92-
},
94+
]
95+
}
9396
),
9497
"szjqr": TuyaBLECategorySelectMapping(
9598
products={
@@ -106,13 +109,30 @@ class TuyaBLECategorySelectMapping:
106109
],
107110
),
108111
**dict.fromkeys(
109-
["y6kttvd6", "yrnk7mnn"], # Fingerbot
112+
["ltak7e1p", "y6kttvd6", "yrnk7mnn"], # Fingerbot
110113
[
111114
TuyaBLEFingerbotModeMapping(dp_id=8),
112115
],
113116
),
114117
},
115118
),
119+
"wsdcg": TuyaBLECategorySelectMapping(
120+
products={
121+
"ojzlzzsw": # Soil moisture sensor
122+
[
123+
TuyaBLESelectMapping(
124+
dp_id=9,
125+
description=TemperatureUnitDescription(
126+
options=[
127+
UnitOfTemperature.CELSIUS,
128+
UnitOfTemperature.FAHRENHEIT,
129+
],
130+
entity_registry_enabled_default=False,
131+
)
132+
),
133+
],
134+
},
135+
),
116136
}
117137

118138

custom_components/tuya_ble/sensor.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,25 @@ class TuyaBLECategorySensorMapping:
140140
]
141141
}
142142
),
143+
"ms": TuyaBLECategorySensorMapping(
144+
products={
145+
"ludzroix": # Smart Lock
146+
[
147+
TuyaBLESensorMapping(
148+
dp_id=21,
149+
description=SensorEntityDescription(
150+
key="alarm_lock",
151+
device_class=SensorDeviceClass.ENUM,
152+
options=[
153+
"wrong_finger",
154+
"wrong_password",
155+
"low_battery",
156+
],
157+
),
158+
),
159+
]
160+
}
161+
),
143162
"szjqr": TuyaBLECategorySensorMapping(
144163
products={
145164
**dict.fromkeys(
@@ -173,7 +192,7 @@ class TuyaBLECategorySensorMapping:
173192
],
174193
),
175194
**dict.fromkeys(
176-
["y6kttvd6", "yrnk7mnn"], # Fingerbot
195+
["ltak7e1p", "y6kttvd6", "yrnk7mnn"], # Fingerbot
177196
[
178197
TuyaBLEBatteryMapping(dp_id=12),
179198
],

custom_components/tuya_ble/switch.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def is_fingerbot_in_switch_mode(
4242
self: TuyaBLESwitch,
4343
product: TuyaBLEProductInfo
4444
) -> bool:
45-
result: bool = False
45+
result: bool = True
4646
if product.fingerbot:
4747
datapoint = self._device.datapoints[product.fingerbot.mode]
4848
if datapoint:
@@ -110,32 +110,28 @@ class TuyaBLECategorySwitchMapping:
110110
],
111111
},
112112
),
113-
"szjqr": TuyaBLECategorySwitchMapping(
113+
"ms": TuyaBLECategorySwitchMapping(
114114
products={
115-
"3yqdo5yt": # CubeTouch 1s
115+
"ludzroix": # Smart Lock
116116
[
117-
TuyaBLEFingerbotSwitchMapping(dp_id=1),
118-
TuyaBLEReversePositionsMapping(dp_id=4),
119-
TuyaBLESwitchMapping(
120-
dp_id=9,
121-
description=SwitchEntityDescription(
122-
key="power_saving",
123-
entity_category=EntityCategory.CONFIG,
124-
),
125-
),
126-
TuyaBLESwitchMapping(
127-
dp_id=10,
128-
description=SwitchEntityDescription(
129-
key="tap_enable",
130-
entity_category=EntityCategory.CONFIG,
131-
),
117+
TuyaBLESwitchMapping(
118+
dp_id=47,
119+
description=SwitchEntityDescription(
120+
key="lock_motor_state",
132121
),
133-
],
134-
"xhf790if": # CubeTouch II
135-
[
136-
TuyaBLEFingerbotSwitchMapping(dp_id=1),
137-
TuyaBLEReversePositionsMapping(dp_id=4),
138-
],
122+
),
123+
]
124+
}
125+
),
126+
"szjqr": TuyaBLECategorySwitchMapping(
127+
products={
128+
**dict.fromkeys(
129+
["3yqdo5yt", "xhf790if"], # CubeTouch 1s and II
130+
[
131+
TuyaBLEFingerbotSwitchMapping(dp_id=1),
132+
TuyaBLEReversePositionsMapping(dp_id=4),
133+
],
134+
),
139135
**dict.fromkeys(
140136
["blliqpsj", "yiihr7zh"], # Fingerbot Plus
141137
[
@@ -152,7 +148,7 @@ class TuyaBLECategorySwitchMapping:
152148
],
153149
),
154150
**dict.fromkeys(
155-
["y6kttvd6", "yrnk7mnn"], # Fingerbot
151+
["ltak7e1p", "y6kttvd6", "yrnk7mnn"], # Fingerbot
156152
[
157153
TuyaBLEFingerbotSwitchMapping(dp_id=2),
158154
TuyaBLEReversePositionsMapping(dp_id=11),

0 commit comments

Comments
 (0)