Skip to content

Commit

Permalink
Merge pull request #5 from daveyijzermans/main
Browse files Browse the repository at this point in the history
Add device ID for Adaprox Fingerbot (y6kttvd6)
  • Loading branch information
PlusPlus-ua authored Apr 26, 2023
2 parents b367c76 + 349f464 commit a99fa97
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 48 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This integration supports Tuya devices connected via BLE.

_Inspired by code of [@redphx](https://github.com/redphx/poc-tuya-ble-fingerbot)
_Inspired by code of [@redphx](https://github.com/redphx/poc-tuya-ble-fingerbot)_

## Installation

Expand All @@ -14,16 +14,17 @@ Place the `custom_components` folder in your configuration directory (or add its

## Usage

After adding to Home Assistan integration should discover all supported Bluetooth devices, or you can add discoverable devices manually.
After adding to Home Assistant integration should discover all supported Bluetooth devices, or you can add discoverable devices manually.

The integration works locally, but connection to Tuya BLE device requires device ID and encryption key from Tuya IOT cloud. It could be obtained using the same credentials as in official Tuya integration. To obtain the credentials, please refer to official Tuya integration [documentation](https://www.home-assistant.io/integrations/tuya/)

## Supported devices list

* Fingerbots (category_id 'szjqr')
+ Fingerbot (product_id 'yrnk7mnn'), original device, first in category, powered by CR2 battery.
+ Adaprox Fingerbot (product_id 'y6kttvd6'), built-in battery with USB type C charging.
+ Fingerbot Plus (product_ids 'blliqpsj', 'yiihr7zh'), almost same as original, has sensor button for manual control.
+ CubeTouch II (product_id 'xhf790if'), bult-in battery with USB type C charging.
+ CubeTouch II (product_id 'xhf790if'), built-in battery with USB type C charging.

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.

Expand Down
10 changes: 6 additions & 4 deletions custom_components/tuya_ble/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ class TuyaBLECategoryButtonMapping:
TuyaBLEFingerbotModeMapping(dp_id=2),
],
),
"yrnk7mnn": # Fingerbot
[
TuyaBLEFingerbotModeMapping(dp_id=2),
],
**dict.fromkeys(
["y6kttvd6", "yrnk7mnn"], # Fingerbot
[
TuyaBLEFingerbotModeMapping(dp_id=2),
],
),
},
),
}
Expand Down
22 changes: 12 additions & 10 deletions custom_components/tuya_ble/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,18 @@ class TuyaBLECategoryInfo:
),
)
),
"yrnk7mnn": # device product_id
TuyaBLEProductInfo(
name="Fingerbot",
fingerbot=TuyaBLEFingerbotInfo(
switch=2,
mode=8,
up_position=15,
down_position=9,
hold_time=10,
reverse_positions=11,
**dict.fromkeys(
["y6kttvd6", "yrnk7mnn"], # device product_ids
TuyaBLEProductInfo(
name="Fingerbot",
fingerbot=TuyaBLEFingerbotInfo(
switch=2,
mode=8,
up_position=15,
down_position=9,
hold_time=10,
reverse_positions=11,
),
),
),
},
Expand Down
38 changes: 20 additions & 18 deletions custom_components/tuya_ble/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,25 +175,27 @@ class TuyaBLECategoryNumberMapping:
),
],
),
"yrnk7mnn": # Fingerbot
[
TuyaBLENumberMapping(
dp_id=9,
description=TuyaBLEDownPositionDescription(),
),
TuyaBLENumberMapping(
dp_id=10,
description=TuyaBLEHoldTimeDescription(
native_step=0.1,
**dict.fromkeys(
["y6kttvd6", "yrnk7mnn"], # Fingerbot
[
TuyaBLENumberMapping(
dp_id=9,
description=TuyaBLEDownPositionDescription(),
),
coefficient=10.0,
is_available=is_fingerbot_in_push_mode,
),
TuyaBLENumberMapping(
dp_id=15,
description=TuyaBLEUpPositionDescription(),
),
],
TuyaBLENumberMapping(
dp_id=10,
description=TuyaBLEHoldTimeDescription(
native_step=0.1,
),
coefficient=10.0,
is_available=is_fingerbot_in_push_mode,
),
TuyaBLENumberMapping(
dp_id=15,
description=TuyaBLEUpPositionDescription(),
),
],
),
},
),
"wsdcg": TuyaBLECategoryNumberMapping(
Expand Down
10 changes: 6 additions & 4 deletions custom_components/tuya_ble/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ class TuyaBLECategorySelectMapping:
TuyaBLEFingerbotModeMapping(dp_id=8),
],
),
"yrnk7mnn": # Fingerbot
[
TuyaBLEFingerbotModeMapping(dp_id=8),
],
**dict.fromkeys(
["y6kttvd6", "yrnk7mnn"], # Fingerbot
[
TuyaBLEFingerbotModeMapping(dp_id=8),
],
),
},
),
}
Expand Down
10 changes: 6 additions & 4 deletions custom_components/tuya_ble/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,12 @@ class TuyaBLECategorySensorMapping:
TuyaBLEBatteryMapping(dp_id=12),
],
),
"yrnk7mnn": # Fingerbot
[
TuyaBLEBatteryMapping(dp_id=12),
],
**dict.fromkeys(
["y6kttvd6", "yrnk7mnn"], # Fingerbot
[
TuyaBLEBatteryMapping(dp_id=12),
],
),
},
),
"wsdcg": TuyaBLECategorySensorMapping(
Expand Down
12 changes: 7 additions & 5 deletions custom_components/tuya_ble/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ class TuyaBLECategorySwitchMapping:
),
],
),
"yrnk7mnn": # Fingerbot
[
TuyaBLEFingerbotSwitchMapping(dp_id=2),
TuyaBLEReversePositionsMapping(dp_id=11),
],
**dict.fromkeys(
["y6kttvd6", "yrnk7mnn"], # Fingerbot
[
TuyaBLEFingerbotSwitchMapping(dp_id=2),
TuyaBLEReversePositionsMapping(dp_id=11),
],
),
},
),
"wsdcg": TuyaBLECategorySwitchMapping(
Expand Down

0 comments on commit a99fa97

Please sign in to comment.