rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.83k stars 545 forks source link

Support for [APP Powered by Tuya] DIGOO DG-HAMB 2G Alarm #192

Open Asom-Velz opened 3 years ago

Asom-Velz commented 3 years ago

Hi

do you plan to support for the DIGOO DG-HAMB 2G alarm which is working with APP Powered by Tuya? IMG_9221 IMG_9222 IMG_9223 IMG_9224

postlund commented 3 years ago

Probably at some point. We don't really have a roadmap or general plan for what we add, it's driven by requests and if someone wants to implement it. Would imagine this is similar to #119.

To help out, please attach a DPS dump of your device.

https://github.com/rospogrigio/localtuya/wiki/HOWTO-get-a-DPs-dump

Shaman2 commented 3 years ago

Probably at some point. We don't really have a roadmap or general plan for what we add, it's driven by requests and if someone wants to implement it. Would imagine this is similar to #119.

To help out, please attach a DPS dump of your device.

https://github.com/rospogrigio/localtuya/wiki/HOWTO-get-a-DPs-dump

yes, may it the some as 119

postlund commented 3 years ago

Likely yes, but it probably uses other datapoints so dump would be great!

Asom-Velz commented 3 years ago

Than you for your replies,

I read the article of how to create a DPS dump of my device but I have a question

Where I have to extract in order to run the test.py?

I am running Home Assistant on a NUC Win10Pro + VM Workstation 16 The only available location is the console in the VM Machine

HAonVM-rsz

Regards Anastasios

dademo-1999 commented 3 years ago

Likely yes, but it probably uses other datapoints so dump would be great!

Hello, my device looks like being similar to #119 too. It's a GAUTONE PG107 Wifi GSM Alarm (I think it's manufactered by PGST). I run DPS dump and that's the result:

DPS [1] VALUE [disarmed] DPS [2] VALUE [40] DPS [3] VALUE [3] DPS [4] VALUE [True] DPS [6] VALUE [True] DPS [12] VALUE [False] DPS [13] VALUE [False] DPS [20] VALUE [False] DPS [21] VALUE [False] DPS [27] VALUE [True] DPS [28] VALUE [30] DPS [101] VALUE [normal]

Hope it helps.

Asom-Velz commented 3 years ago

Yes it seems that it is exactly the same model with different brand.

Still it would be grade if someone can give me a roadmap how to take a DPS dump since I am running on a NUC Win10Pro + VM Workstation 16 and I dont know were to run the run the test.py script.

dademo-1999 commented 3 years ago

Yes it seems that it is exactly the same model with different brand.

Still it would be grade if someone can give me a roadmap how to take a DPS dump since I am running on a NUC Win10Pro + VM Workstation 16 and I dont know were to run the run the test.py script.

I run test.py from a linux machine (in my case was a Paralles Desktop VM machine). You don't need to run the script from the same Home Assistant machine. You just need to be on the same network and type the correct deviceID, IPaddress and localKey

Asom-Velz commented 3 years ago

Hi I don't have linux machine and also I don't have knowledge from linux. Any other solution based on windows machine or directly @ VM Machine console?

Clipboard-1

dademo-1999 commented 3 years ago

Hi I don't have linux machine and also I don't have knowledge from linux. Any other solution based on windows machine or directly @ VM Machine console?

Clipboard-1

Can't help sorry. But, running a simply usb live versione of Linux, I think it's easier than running the script from the VM workstation or directly from Windows. However, il you google "run linux script on windows", you can find different tutorials. Not sure it works and sure I can post the link here for the board policy .

ropmip commented 3 years ago

I have this model and I am able to integrate in homeassistant with this plug-in. Added all the dps as sensors to monitor changes. Only conclusion for now is status (dps1-arm/disarmed) and power status (dps101 - normal / powerDisconnect). Even with reduced funcionality this allows to use the alarm status as condition for automations.

dademo-1999 commented 3 years ago

I have this model and I am able to integrate in homeassistant with this plug-in. Added all the dps as sensors to monitor changes. Only conclusion for now is status (dps1-arm/disarmed) and power status (dps101 - normal / powerDisconnect). Even with reduced funcionality this allows to use the alarm status as condition for automations.

Have you find a way to arm/disarm through home assistant?

ropmip commented 3 years ago

Have you find a way to arm/disarm through home assistant?

Yes! Just checked that I can use the service localtuya.set_dp to arm / disarm (dp: 1) For digoo values for dp: 1 can be:

arm
disarmed
home

I guess this way it sould be possible to have a manual alarm on homeassistant (with it's own code) that is linked with the status on my tuya alarm.

ropmip commented 3 years ago

Full DPs from digoo (monitored from within the integrations- only saw changes on 1 and 101 with normal usage)

 DPS [1] VALUE [disarmed] / [arm] / [home]
 DPS [2] VALUE [40] 
 DPS [3] VALUE [3]
 DPS [4] VALUE [True]
 DPS [6] VALUE [True]
 DPS [12] VALUE [False]
 DPS [13] VALUE [False]
 DPS [20] VALUE [True]
 DPS [21] VALUE [False]
 DPS [28] VALUE [30]
 DPS [101] VALUE [normal] / [powerDisconnect]

Update: (monitored while changing settings on smart life app) 2 - exit delay 3 - alarm duration 4 - arm beep 6 - Siren 12 - Arm SMS 13 - Backlight 20 - Call 21 - SMS 28 - entry delay

Murada99 commented 3 years ago

Hi, I have the same alarm PG107, I got the localKey but if I setup the alarm with localtuya, the alarm is deleted from the smartlife application. Each time I try to pair again with the mobile application, the localKey is changed and localtuya does not work anymore. I have to choice between localtuya or the mobile application. Do you have the same problem ?

ropmip commented 3 years ago

No, is working fine in homeassistant and controlling in smartlife app at the same time.

Murada99 commented 3 years ago

Hi ropmip, how do you get the localKey ? I get it using the command: tuya-cli link --api-key xxxxx --api-secret xxxx --schema xxx ..... This command associates with the alarm but then I lost the alarm in the app.

Murada99 commented 3 years ago

Oups, I get it working using another method.

Asom-Velz commented 3 years ago

Oups, I get it working using another method.

Is it possible to tell me the way to get the local key?

Murada99 commented 3 years ago

Yes, of course, I did the method in this link https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md

I started with "Linking a Tuya device with Smart Link" and but after the point 5, don't put your devices into linking mode, just do the "Listing Tuya devices from the Tuya Smart or Smart Life apps" method. Putting in linking mode, will generate a new local key.

Murada99 commented 3 years ago

I get this working. Status arm / disarmed / home are available in HA and I can set the alarm from HA, thx ropmip.

The next step is to be alerted in HA when the alarm is triggered. Has anyone succeeded in this?

ropmip commented 3 years ago

To make it simple on HA side I added a "manual alarm" to the HA configuration and linked it's status to the tuya alarm (with automations). This way I have a lovelace alarm control panel in HA that always reflects the tuya alarm status and I can even control it from lovelace (with a custom PIN). Full support implementation on the localtuya side could be to configure it directly as an alarm without the need for automations!

Murada99 commented 3 years ago

That's a good solution to work with the manual alarm control panel. How you get the information that the alarm was triggered ? I don't see a DPS with this information.

ropmip commented 3 years ago

I guess you have no dps with that information. One workaround is to configure an external rf siren on the alarm and have an HA sensor to capture that rf signal. One other option is to capture rf signal on HA directly from motion detectors. I have a custom rflink bridge and already use those sensors for other automations on HA.

Murada99 commented 3 years ago

thanks ! That sounds good, I have a rfxcom and an external siren, just need to capture the rf signal. Perfect solution.

agarbato commented 3 years ago

Thanks for sharing all the precious information guys :-)

I got mine finally working on HA. It's a TecPeak alarm working with Tuya/Smartlife apps.

Most of the dps are the same. Once I defined all the sensors changing settings on the app I was able to identify the correct things.

I share here my configuration.yaml , maybe it could be useful to somebody. I guess there is no way to get sensors of pirs and other accessories since tuya-cli don't detect any.

I still don't understand how to have an alarm switch on lovelace. I can only have sensors working but nothing else, I'm not HA expert though.

@ropmip you mention you use alarm manual Can you share if you can some automation you did?

  - host: 1.2.3.4
    device_id: xxxxxxxxxx
    local_key: xxxxxxxxxx
    friendly_name: Alarm
    protocol_version: "3.3"
    entities:
      - platform: sensor
        friendly_name: alarm.status
        id: 1
      - platform: sensor
        friendly_name: alarm.power
        id: 101
      - platform: sensor
        friendly_name: alarm.32
        id: 32
      - platform: sensor
        friendly_name: alarm.entry_delay
        id: 28
      - platform: sensor
        friendly_name: alarm.exit_delay
        id: 2
      - platform: sensor
        friendly_name: alarm.siren_duration
        id: 3
      - platform: sensor
        friendly_name: alarm.arm_beep
        id: 4
      - platform: sensor
        friendly_name: alarm.siren
        id: 6
      - platform: sensor
        friendly_name: alarm.arm_sms
        id: 12
      - platform: sensor
        friendly_name: alarm.backlight
        id: 13
      - platform: sensor
        friendly_name: alarm.25
        id: 25
      - platform: sensor
        friendly_name: alarm.message_propel
        id: 27

Ciaociao :-)

ropmip commented 3 years ago

@agarbato You can test on the services tab (programing tools) the name of the service is localtuya.set_dp You can set up an alarm in homeassistant with the manual integration https://www.home-assistant.io/integrations/manual/