tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
882 stars 207 forks source link

Tuya LSC-Bell 8S(Mstar333_8M) doorbell driver #318

Open mrrepel opened 3 years ago

mrrepel commented 3 years ago

Device normal info

2021-08-06 16:19:09 DEBUG (SyncWorker_1) [tuya iot] Response: { "result": [ { "active_time": 1628259471, "biz_type": 0, "category": "sp", "create_time": 1628259471, "icon": "smart/icon/ay1511509043755MhIx1/f7ec3c13942221ae39ef8925c2bb1b84.png", "id": "bf709358238e29b62eboja", "ip": "XXXXX", "lat": "XXXXX", "local_key": "XXXXX", "lon": "XXXXX", "model": "", "name": "Wifi videodeurbel", "online": true, "owner_id": "XXXXX", "product_id": "wkyfpsgtzkrjmsgr", "product_name": "Wifi video doorbell", "status": [ { "code": "basic_indicator", "value": true }, { "code": "basic_flip", "value": false }, { "code": "basic_osd", "value": true }, { "code": "motion_sensitivity", "value": "1" }, { "code": "basic_nightvision", "value": "0" }, { "code": "sd_storge", "value": "0|0|0" }, { "code": "sd_status", "value": 5 }, { "code": "sd_format", "value": false }, { "code": "movement_detect_pic", "value": "$" }, { "code": "sd_format_state", "value": -20000 }, { "code": "motion_switch", "value": false }, { "code": "doorbell_active", "value": "" }, { "code": "record_switch", "value": true }, { "code": "record_mode", "value": "2" }, { "code": "basic_device_volume", "value": 10 }, { "code": "chime_settings", "value": "2" }, { "code": "motion_area_switch", "value": false }, { "code": "motion_area", "value": "" }, { "code": "alarm_message", "value": "" } ], "sub": false, "time_zone": "+02:00", "uid": "eu1626865384210GhnXe", "update_time": 1628259476, "uuid": "pp01e07696534b66540e" }, {

Zeunas commented 3 years ago

Looking for this too! Tried to add motion sensor (movenent_detect_pic) to binary_sensor.py and it's able to find it but the motion sensor reports raw data and binary sensor can't read it properly, so it always reports Clear.

Perhaps something can be done with the "alarm_message" as motion sensor, at least to include the doorbell's motion sensor.

mrrepel commented 3 years ago

Hi Zeunas,

Do you know how to add the "bell" button as binary sensor in Home Assistant ?

Gr

Barry

Zeunas commented 3 years ago

Unless the alarm_message sensor that you seem to have with your bell reports doorbell rings, you don't seem to have any other sensor / switch that can be identified as a "bell". Unfortunately the alarm_message sensor reports raw data which seems not to be yet supported by this integration sensors (similar problem to the motion detection). I'm saying this as I don't know how to format the raw data into something reportable by a sensor / binary_sensor, maybe there's a simple solution for it but I don't know python (only follow instructions and what I can find browsing).

mrrepel commented 3 years ago

Hi Zeunas,

Thanx for the reply. I only know Python as a snake :-) Maybe it will be supported in the future.

mrrepel commented 3 years ago

I've got a solution to this.

After installing the TuyaV2 in Home Assistant and the Tuya IoT platform it is possible to add virtual devices. I've added a virtual lamp and in the Tuya app i've created an automation that, when the bell is active, the light switches on. This virtual lamp is visible in Home Assistant so i can use this virtual lamp as a trigger.

Not only the bell button can be used, also the movement detection. So...have a go at it !

afbeelding

afbeelding