localtuya icon indicating copy to clipboard operation
localtuya copied to clipboard

Alarm Local Tuya model: PG103/PG105/PG106/PG107/PG109

Open besiktas97 opened this issue 1 year ago • 12 comments

The problem

Is it possible to add the alarm device in local tuya and yes how can I do that ? See below for all information:

Environment

  • Localtuya version: V5.1.0
  • Home Assistant Core version: 2023.5.2
  • [x] Does the device work using the Home Assistant Tuya Cloud component ?
  • [] Does the device work using the Tinytuya (https://github.com/jasonacox/tinytuya) command line tool ?
  • [] Was the device working with earlier versions of localtuya ? Which one?
  • [] Are you using the Tuya/SmartLife App in parallel ?

Steps to reproduce

DP dump

Provide Home Assistant traceback/logs

 "integration_manifest": {
    "domain": "localtuya",
    "name": "LocalTuya integration",
    "version": "5.1.0",
    "documentation": "https://github.com/rospogrigio/localtuya/",
    "dependencies": [],
    "codeowners": [
      "@rospogrigio",
      "@postlund"
    ],
    "issue_tracker": "https://github.com/rospogrigio/localtuya/issues",
    "requirements": [],
    "config_flow": true,
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "device_config": {
      "friendly_name": "Thuis Alarm",
      "host": "192.168.68.144",
      "device_id": "",
      "local_key": "",
      "protocol_version": "3.3",
      "enable_debug": false,
      "model": "Multifunction alarm",
      "dps_strings": [
        "1 (value: disarmed)",
        "2 (value: 0)",
        "3 (value: 3)",
        "4 (value: True)",
        "6 (value: True)",
        "10 (value: True)",
        "12 (value: False)",
        "13 (value: True)",
        "27 (value: True)",
        "28 (value: 0)",
        "32 (value: normal)",
        "101 (value: normal)"
      ],
      "entities": [
        {
          "id": 32,
          "friendly_name": "Thuis Alarm",
          "state_on": "True",
          "state_off": "False",
          "device_class": "safety",
          "platform": "binary_sensor"
        }
      ],
      "product_key": ""
    },
    "device_cloud_info": {
      "active_time": 1683619314,
      "biz_type": 0,
      "category": "mal",
      "create_time": 1683619314,
      "icon": "smart/icon/ay15500268672065IQ53/e34e9fa4032bbee6fe6c47f52a6358a4.jpg",
      "id": "bf2969595058da96b4u2jv",
      "ip": "37.251.92.83",
      "lat": "51.8300",
      "local_key": "",
      "lon": "4.6800",
      "model": "PG103/PG105/PG106/PG107/PG109",
      "name": "Thuis Alarm",
      "online": true,
      "owner_id": "7142243",
      "product_id": "gyitctrjj1kefxp2",
      "product_name": "Multifunction alarm",
      "status": [
        {
          "code": "master_mode",
          "value": "disarmed"
        },
        {
          "code": "delay_set",
          "value": 0
        },
        {
          "code": "alarm_time",
          "value": 3
        },
        {
          "code": "switch_alarm_sound",
          "value": true
        },
        {
          "code": "switch_alarm_light",
          "value": true
        },
        {
          "code": "switch_mode_sound",
          "value": true
        },
        {
          "code": "switch_kb_sound",
          "value": false
        },
        {
          "code": "switch_kb_light",
          "value": true
        },
        {
          "code": "muffling",
          "value": false
        },
        {
          "code": "alarm_msg",
          "value": "AEEAQwAgAFAAbwB3AGUAcgAgAFIAZQBzAHQAbwByAGUAZA=="
        },
        {
          "code": "switch_alarm_propel",
          "value": true
        },
        {
          "code": "alarm_delay_time",
          "value": 0
        },
        {
          "code": "master_state",
          "value": "normal"
        },
        {
          "code": "factory_reset",
          "value": false
        },
        {
          "code": "sub_class",
          "value": "remote_controller"
        },
        {
          "code": "sub_admin",
          "value": "AgADAP///////wH///////8L////////"
        },
        {
          "code": "sub_state",
          "value": "normal"
        }
      ],
      "sub": false,
      "time_zone": "+02:00",
      "uid": "",
      "update_time": 1683626555,
      "uuid": ""
    }

Additional information

besiktas97 avatar May 09 '23 10:05 besiktas97

Uhhmm someone can check this out please?

besiktas97 avatar May 24 '23 20:05 besiktas97

..it should be simple to implement, is really a 3 state switch (arm, home, disarmed) and a sate sensor (normal, sos/alarm) that should be converted to binary sensor (imho)...I make it work telling localtuya it was a 'vacuum' (just to have a lot of DPs to play with...)...btw I use protocol 3.4 in case someone wonder..

...vacuum fanspeed set to arm/home/disarm can opperate the alarm (dps 1) and dps 32 is the current state...I fighting now to make a "template alarm control panel" so I will not be using vacuum things in my scripts, etc..

If someone is willing to set me in the right direction I could try to make the implmentation...I think there is a bunch of wifi alarm panels based on this (lot of simillar products just with different brand in aliexpress :-P

p.s: they are recognized and work with the cloud tuya in home assistant, but is my last tuya device that is depending on the cloud, so hopefully can be integrated, willing to help ...

here are the dps dump that I toke in each alarm condition:

Disarm Device status: { 'dps': { '1': 'disarmed', '2': 40, '3': 3, '4': True, '6': True, '10': True, '12': False, '13': True, '27': True, '28': 30, '32': 'normal', '101': 'normal' } }


Arm home Device status: { 'dps': { '1': 'home', '2': 40, '3': 3, '4': True, '6': True, '10': True, '12': False, '13': True, '27': True, '28': 30, '32': 'normal', '101': 'normal' } }

Arming ...I was checking if something change during arming process but no.. Device status: { 'dps': { '1': 'arm', '2': 40, '3': 3, '4': True, '6': True, '10': True, '12': False, '13': True, '27': True, '28': 30, '32': 'normal', '101': 'normal' } }

Device status: { 'dps': { '1': 'arm', '2': 40, '3': 3, '4': True, '6': True, '10': True, '12': False, '13': True, '27': True, '28': 30, '32': 'normal', '101': 'normal' } }


Arm Away Device status: { 'dps': { '1': 'arm', '2': 40, '3': 3, '4': True, '6': True, '10': True, '12': False, '13': True, '27': True, '28': 30, '32': 'normal', '101': 'normal' } }


Alarm Triggered by sensor Device status: { 'dps': { '1': 'sos', '2': 40, '3': 3, '4': True, '6': True, '10': True, '12': False, '13': True, '27': True, '28': 30, '32': 'alarm', '101': 'normal' } }


Alarm Triggered by sos button/remotes Device status: { 'dps': { '1': 'arm', '2': 40, '3': 3, '4': True, '6': True, '10': True, '12': False, '13': True, '27': True, '28': 30, '32': 'sos', '101': 'normal' } }

mhenriquezschott avatar Aug 14 '23 23:08 mhenriquezschott

...oh yeah, and dps 1 also should be used to trigger the alarm with a "alarm" or "sos" state...

mhenriquezschott avatar Aug 14 '23 23:08 mhenriquezschott

Would be looking forward to this.

sityware avatar Aug 31 '23 19:08 sityware

This is from the Tuya device control properties if it helps?

{
  "result": {
    "properties": [
      {
        "code": "master_mode",
        "custom_name": "",
        "dp_id": 1,
        "time": 1693511026999,
        "value": "disarmed"
      },
      {
        "code": "delay_set",
        "custom_name": "",
        "dp_id": 2,
        "time": 1693510964653,
        "value": 40
      },
      {
        "code": "alarm_time",
        "custom_name": "",
        "dp_id": 3,
        "time": 1693510964653,
        "value": 3
      },
      {
        "code": "switch_alarm_sound",
        "custom_name": "",
        "dp_id": 4,
        "time": 1693510964653,
        "value": true
      },
      {
        "code": "switch_alarm_light",
        "custom_name": "",
        "dp_id": 6,
        "time": 1693511047190,
        "value": true
      },
      {
        "code": "switch_mode_sound",
        "custom_name": "",
        "dp_id": 10,
        "time": 1693510964653,
        "value": true
      },
      {
        "code": "switch_kb_sound",
        "custom_name": "",
        "dp_id": 12,
        "time": 1693510964653,
        "value": false
      },
      {
        "code": "switch_kb_light",
        "custom_name": "",
        "dp_id": 13,
        "time": 1693510964653,
        "value": false
      },
      {
        "code": "zone_attribute",
        "custom_name": "",
        "dp_id": 24,
        "time": 1693510695651,
        "value": "MODE_HOME_ARM"
      },
      {
        "code": "muffling",
        "custom_name": "",
        "dp_id": 25,
        "time": 1693510964653,
        "value": false
      },
      {
        "code": "alarm_message",
        "custom_name": "",
        "dp_id": 26,
        "time": 1693510840740
      },
      {
        "code": "switch_alarm_propel",
        "custom_name": "",
        "dp_id": 27,
        "time": 1693510964653,
        "value": true
      },
      {
        "code": "alarm_delay_time",
        "custom_name": "",
        "dp_id": 28,
        "time": 1693511061206,
        "value": 15
      },
      {
        "code": "master_state",
        "custom_name": "",
        "dp_id": 32,
        "time": 1693510695651,
        "value": "normal"
      },
      {
        "code": "factory_reset",
        "custom_name": "",
        "dp_id": 34,
        "time": 1693510695651,
        "value": false
      },
      {
        "code": "sub_class",
        "custom_name": "",
        "dp_id": 36,
        "time": 1693510695651,
        "value": "remote_controller"
      },
      {
        "code": "sub_type",
        "custom_name": "",
        "dp_id": 37,
        "time": 1693510695651,
        "value": "OTHER"
      },
      {
        "code": "sub_admin",
        "custom_name": "",
        "dp_id": 38,
        "time": 1693511072905,
        "value": ""
      },
      {
        "code": "sub_state",
        "custom_name": "",
        "dp_id": 39,
        "time": 1693510695651,
        "value": "normal"
      },
      {
        "code": "alarm_call_unit",
        "custom_name": "",
        "dp_id": 45,
        "time": 1693510840740
      },
      {
        "code": "PowerEvent",
        "custom_name": "",
        "dp_id": 101,
        "time": 1693510964653,
        "value": "normal"
      },
      {
        "code": "zone_number",
        "custom_name": "",
        "dp_id": 103,
        "time": 1693510840740
      },
      {
        "code": "OtherEvent",
        "custom_name": "",
        "dp_id": 104,
        "time": 1693510695651,
        "value": "Normal"
      }
    ]
  }

sityware avatar Aug 31 '23 22:08 sityware

I have PGST PG-107 alarm, device id: z75vinnyhtgxhaxw. When I check status(): {'dps': {'1': 'arm', '2': 5, '3': 3, '4': False, '6': False, '12': False, '13': False, '27': True, '28': 5, '101': 'normal'}}

So, there is absent dps id '32': 'sos' or 'alarm'. I am able to arm or disarm, but can't detect alarm. Is there possibility to get that dpsId:32?

Also, smart life application allows to manage sensors... But I can't find possibility to make same with localtuya...

MrSkiv avatar Oct 12 '23 14:10 MrSkiv

I have PGST PG-107 alarm, device id: z75vinnyhtgxhaxw. When I check status(): {'dps': {'1': 'arm', '2': 5, '3': 3, '4': False, '6': False, '12': False, '13': False, '27': True, '28': 5, '101': 'normal'}}

So, there is absent dps id '32': 'sos' or 'alarm'. I am able to arm or disarm, but can't detect alarm. Is there possibility to get that dpsId:32?

Also, smart life application allows to manage sensors... But I can't find possibility to make same with localtuya...

From testing DPS 32 is not sent locally. This is only sent to the Tuya cloud. So if your device is connected to Tuya it will trigger. The only option for receiving the Alarm locally is to use a Sonoff RF bridge, to receive the alarm signal when it triggers. You can then pass this to Home Assistant for example. There is a Youtube video about the whole process.

sityware avatar Oct 12 '23 21:10 sityware

I have PGST PG-107 alarm, device id: z75vinnyhtgxhaxw. When I check status(): {'dps': {'1': 'arm', '2': 5, '3': 3, '4': False, '6': False, '12': False, '13': False, '27': True, '28': 5, '101': 'normal'}} So, there is absent dps id '32': 'sos' or 'alarm'. I am able to arm or disarm, but can't detect alarm. Is there possibility to get that dpsId:32? Also, smart life application allows to manage sensors... But I can't find possibility to make same with localtuya...

From testing DPS 32 is not sent locally. This is only sent to the Tuya cloud. So if your device is connected to Tuya it will trigger. The only option for receiving the Alarm locally is to use a Sonoff RF bridge, to receive the alarm signal when it triggers. You can then pass this to Home Assistant for example. There is a Youtube video about the whole process.

Thank you for the answer. I have played with HA and Sonoff RF bridge (IMHO this solution is a little unreliable. Otherwise, what for then that PG107 device???). For security and reliability I am willing to use specialized Alarm system. I prefer, that it would be offline (some days ago: tuya network was offline for couple of hours. I don't know, if this was my operator fault or global problem). At the moment, localtuya has too little features (I mean, PG107 with localtuya): alarm detection, alarm message (which sensor alarmed), sensor management: add/delete/change zone. Looks like that I forced to use tuya cloud solution...

MrSkiv avatar Oct 13 '23 07:10 MrSkiv

I have some problem - PG13 alarm system, local tuya has identical data, cloud tuya gives 1 work switch - ON/OFF (unit at HA addon looks as "Alarm Host (unsupported)" somebody have any ideas how to set up it correctly - for example to get some data, alarms?

nnov4k avatar Mar 08 '24 09:03 nnov4k

Any update on this? is there any way to add the PG* alarms to LocalTuya?

agustinscaz avatar Mar 14 '24 21:03 agustinscaz

Im using https://github.com/make-all/tuya-local HACS addON, works good, all switches works from the box

nnov4k avatar Mar 15 '24 08:03 nnov4k

Im using https://github.com/make-all/tuya-local HACS addON, works good, all switches works from the box

Hi @nnov4k, how did you setup the alarm with that Tuya local integration?

polcape avatar Jul 26 '24 20:07 polcape