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

Add new Fingerbot Plus Category: kg and Product ID: mknd4lci #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The integration works locally, but connection to Tuya BLE device requires device
* Fingerbots (category_id 'szjqr')
+ Fingerbot (product_ids 'ltak7e1p', 'y6kttvd6', 'yrnk7mnn', 'nvr2rocq', 'bnt7wajf', 'rvdceqjh', '5xhbk964'), 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', 'ndvkgsrm', 'yiihr7zh', 'neq16kgd'), almost same as original, has sensor button for manual control.
+ Fingerbot Plus (product_ids 'blliqpsj', 'ndvkgsrm', 'yiihr7zh', 'neq16kgd', 'mknd4lci'), almost same as original, has sensor button for manual control.
+ CubeTouch 1s (product_id '3yqdo5yt'), built-in battery with USB type C charging.
+ CubeTouch II (product_id 'xhf790if'), built-in battery with USB type C charging.

Expand Down Expand Up @@ -55,4 +55,3 @@ I am working on this integration in Ukraine. Our country was subjected to brutal
<p align="center">
<a href="https://www.buymeacoffee.com/3PaK6lXr4l"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy me an air defense"></a>
</p>

14 changes: 13 additions & 1 deletion custom_components/tuya_ble/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TuyaBLECategoryButtonMapping:
[
"blliqpsj",
"ndvkgsrm",
"yiihr7zh",
"yiihr7zh",
"neq16kgd"
], # Fingerbot Plus
[
Expand All @@ -95,6 +95,18 @@ class TuyaBLECategoryButtonMapping:
),
},
),
"kg": TuyaBLECategoryButtonMapping(
products={
**dict.fromkeys(
[
"mknd4lci"
], # Fingerbot Plus
[
TuyaBLEFingerbotModeMapping(dp_id=108),
],
),
},
),
"znhsb": TuyaBLECategoryButtonMapping(
products={
"cdlandip": # Smart water bottle
Expand Down
28 changes: 25 additions & 3 deletions custom_components/tuya_ble/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class TuyaBLECategoryInfo:
[
"blliqpsj",
"ndvkgsrm",
"yiihr7zh",
"yiihr7zh",
"neq16kgd"
], # device product_ids
TuyaBLEProductInfo(
Expand Down Expand Up @@ -264,14 +264,36 @@ class TuyaBLECategoryInfo:
),
},
),
"kg": TuyaBLECategoryInfo(
products={
**dict.fromkeys(
[
"mknd4lci"
], # device product_ids
TuyaBLEProductInfo(
name="Fingerbot Plus",
fingerbot=TuyaBLEFingerbotInfo(
switch=1,
mode=101,
up_position=106,
down_position=102,
hold_time=103,
reverse_positions=104,
manual_control=107,
program=109,
),
),
),
},
),
"wk": TuyaBLECategoryInfo(
products={
**dict.fromkeys(
[
"drlajpqc",
"drlajpqc",
"nhj2j7su",
], # device product_id
TuyaBLEProductInfo(
TuyaBLEProductInfo(
name="Thermostatic Radiator Valve",
),
),
Expand Down
51 changes: 51 additions & 0 deletions custom_components/tuya_ble/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,57 @@ class TuyaBLECategoryNumberMapping:
),
},
),
"kg": TuyaBLECategoryNumberMapping(
products={
**dict.fromkeys(
[
"mknd4lci"
], # Fingerbot Plus
[
TuyaBLENumberMapping(
dp_id=102,
description=TuyaBLEDownPositionDescription(),
is_available=is_fingerbot_not_in_program_mode,
),
TuyaBLEHoldTimeMapping(dp_id=103),
TuyaBLENumberMapping(
dp_id=106,
description=TuyaBLEUpPositionDescription(),
is_available=is_fingerbot_not_in_program_mode,
),
TuyaBLENumberMapping(
dp_id=109,
description=NumberEntityDescription(
key="program_repeats_count",
icon="mdi:repeat",
native_max_value=0xFFFE,
native_min_value=1,
native_step=1,
entity_category=EntityCategory.CONFIG,
),
is_available=is_fingerbot_repeat_count_available,
getter=get_fingerbot_program_repeat_count,
setter=set_fingerbot_program_repeat_count,
),
TuyaBLENumberMapping(
dp_id=109,
description=NumberEntityDescription(
key="program_idle_position",
icon="mdi:repeat",
native_max_value=100,
native_min_value=0,
native_step=1,
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.CONFIG,
),
is_available=is_fingerbot_in_program_mode,
getter=get_fingerbot_program_position,
setter=set_fingerbot_program_position,
),
],
),
},
),
"wk": TuyaBLECategoryNumberMapping(
products={
**dict.fromkeys(
Expand Down
16 changes: 14 additions & 2 deletions custom_components/tuya_ble/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TuyaBLEFingerbotModeMapping(TuyaBLESelectMapping):
entity_category=EntityCategory.CONFIG,
options=
[
FINGERBOT_MODE_PUSH,
FINGERBOT_MODE_PUSH,
FINGERBOT_MODE_SWITCH,
FINGERBOT_MODE_PROGRAM,
],
Expand Down Expand Up @@ -116,7 +116,7 @@ class TuyaBLECategorySelectMapping:
[
"blliqpsj",
"ndvkgsrm",
"yiihr7zh",
"yiihr7zh",
"neq16kgd"
], # Fingerbot Plus
[
Expand All @@ -133,6 +133,18 @@ class TuyaBLECategorySelectMapping:
),
},
),
"kg": TuyaBLECategorySelectMapping(
products={
**dict.fromkeys(
[
"mknd4lci"
], # Fingerbot Plus
[
TuyaBLEFingerbotModeMapping(dp_id=101),
],
),
},
),
"wsdcg": TuyaBLECategorySelectMapping(
products={
"ojzlzzsw": # Soil moisture sensor
Expand Down
14 changes: 13 additions & 1 deletion custom_components/tuya_ble/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class TuyaBLECategorySensorMapping:
[
"blliqpsj",
"ndvkgsrm",
"yiihr7zh",
"yiihr7zh",
"neq16kgd"
], # Fingerbot Plus
[
Expand All @@ -221,6 +221,18 @@ class TuyaBLECategorySensorMapping:
),
},
),
"kg": TuyaBLECategorySensorMapping(
products={
**dict.fromkeys(
[
"mknd4lci"
], # Fingerbot Plus
[
TuyaBLEBatteryMapping(dp_id=105),
],
),
},
),
"wsdcg": TuyaBLECategorySensorMapping(
products={
"ojzlzzsw": [ # Soil moisture sensor
Expand Down
42 changes: 41 additions & 1 deletion custom_components/tuya_ble/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def set_fingerbot_program_repeat_forever(
datapoint = self._device.datapoints[product.fingerbot.program]
if datapoint and type(datapoint.value) is bytes:
new_value = (
int.to_bytes(0xFFFF if value else 1, 2, "big") +
int.to_bytes(0xFFFF if value else 1, 2, "big") +
datapoint.value[2:]
)
self._hass.create_task(datapoint.set_value(new_value))
Expand Down Expand Up @@ -240,6 +240,46 @@ class TuyaBLECategorySwitchMapping:
),
},
),
"kg": TuyaBLECategorySwitchMapping(
products={
**dict.fromkeys(
[
"mknd4lci"
], # Fingerbot Plus
[
TuyaBLEFingerbotSwitchMapping(dp_id=1),
TuyaBLEReversePositionsMapping(dp_id=104),
TuyaBLESwitchMapping(
dp_id=107,
description=SwitchEntityDescription(
key="manual_control",
icon="mdi:gesture-tap-box",
entity_category=EntityCategory.CONFIG,
),
),
TuyaBLESwitchMapping(
dp_id=1,
description=SwitchEntityDescription(
key="program",
icon="mdi:repeat",
),
is_available=is_fingerbot_in_program_mode,
),
TuyaBLESwitchMapping(
dp_id=109,
description=SwitchEntityDescription(
key="program_repeat_forever",
icon="mdi:repeat",
entity_category=EntityCategory.CONFIG,
),
getter=get_fingerbot_program_repeat_forever,
is_available=is_fingerbot_in_program_mode,
setter=set_fingerbot_program_repeat_forever,
),
],
),
},
),
"wk": TuyaBLECategorySwitchMapping(
products={
**dict.fromkeys(
Expand Down
23 changes: 23 additions & 0 deletions custom_components/tuya_ble/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,29 @@ class TuyaBLECategoryTextMapping:
),
},
),
"kg": TuyaBLECategoryTextMapping(
products={
**dict.fromkeys(
[
"mknd4lci"
], # Fingerbot Plus
[
TuyaBLETextMapping(
dp_id=109,
description=TextEntityDescription(
key="program",
icon="mdi:repeat",
pattern="^((\d{1,2}|100)(\/\d{1,2})?)(;((\d{1,2}|100)(\/\d{1,2})?))+$",
entity_category=EntityCategory.CONFIG,
),
is_available=is_fingerbot_in_program_mode,
getter=get_fingerbot_program,
setter=set_fingerbot_program,
),
]
),
},
),
}


Expand Down