# WOOX R7049 smoke detector

**URL:** <https://forum.phoscon.de/t/woox-r7049-smoke-detector/4186>\
**Category:** DDF-Library\
**Created:** [November 17, 2023, 5:43pm UTC](https://forum.phoscon.de/t/woox-r7049-smoke-detector/4186 "2023-11-17T17:43:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Finne75](https://forum.phoscon.de/user_avatar/forum.phoscon.de/finne75/32/1538_2.png) [@Finne75](https://forum.phoscon.de/u/Finne75)\
**Post date:** [November 17, 2023, 5:43pm UTC](https://forum.phoscon.de/t/woox-r7049-smoke-detector/4186/1 "2023-11-17T17:43:38Z")

</div>

I am trying to create a DDF for the WOOX R7049 smoke detector, see below. I used the code in [tuya.cpp](https://github.com/dresden-elektronik/deconz-rest-plugin/blob/123292d9f1ecce29634023c904c6c5dcc11b212e/tuya.cpp#L925) as far as possible, and at least test indication works. However, for the “lowbattery” attribute, DP 14 needs to be read out, any idea how to build this in?

```auto
{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_aycxwiau",
  "modelid": "TS0601",
  "vendor": "WOOX",
  "product": "Smart Smoke Alarm R7049",
  "sleeper": true,
  "status": "Gold",
  "path": "/devices/Woox_smart_smoke_alarm_r7049.json",
  "subdevices": [
    {
      "type": "$TYPE_FIRE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0xef00"
      ],
      "fingerprint": {
        "profile": "0x0104",
        "device": "0x0051",
        "endpoint": "0x01",
        "in": [
          "0x0000",
          "0xEF00"
        ]
      },
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/errorcode",
          "awake": true,
          "parse": {
            "dpid": 11,
            "eval": "Item.val = String(Attr.val);",
            "fn": "tuya"
          }
        },
        {
          "name": "state/fire",
          "awake": true,
          "parse": {
            "dpid": 1,
            "eval": "Item.val = (Attr.val == 0 ? true : false);",
            "fn": "tuya"
          },
          "default": false
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/lowbattery",
          "description": "True when the device battery runs low."
        },
        {
          "name": "state/test",
          "awake": true,
          "parse": {
            "dpid": 8,
            "eval": "Item.val = (Attr.val == 0 ? false : true);",
            "fn": "tuya"
          },
          "default": false
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0xEF00"
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Finne75](https://forum.phoscon.de/user_avatar/forum.phoscon.de/finne75/32/1538_2.png) [@Finne75](https://forum.phoscon.de/u/Finne75)\
**Post date:** [November 18, 2023, 11:42am UTC](https://forum.phoscon.de/t/woox-r7049-smoke-detector/4186/2 "2023-11-18T11:42:11Z")

</div>

Update: seems to work now.

```auto
                    {
    "config": {
        "on": true,
        "reachable": true
    },
    "ep": 1,
    "etag": "2a0ccb96b42eca71aa614fbfb6d8db33",
    "lastannounced": "2023-11-18T11:37:48Z",
    "lastseen": "2023-11-18T11:37Z",
    "manufacturername": "_TZE200_aycxwiau",
    "modelid": "TS0601",
    "name": "Fire 526",
    "state": {
        "errorcode": "0",
        "fire": false,
        "lastupdated": "2023-11-18T11:38:06.927",
        "lowbattery": false,
        "test": false
    },
    "swversion": "1.0.1",
    "type": "ZHAFire",
    "uniqueid": "b4:e3:f9:ff:fe:37:9c:d9-01-ef00"
}

```

DDF:

```auto
{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_aycxwiau",
  "modelid": "TS0601",
  "vendor": "WOOX",
  "product": "Smart Smoke Alarm R7049",
  "sleeper": true,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_FIRE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0xef00"
      ],
      "fingerprint": {
        "profile": "0x0104",
        "device": "0x0051",
        "endpoint": "0x01",
        "in": [
          "0x0000",
          "0xEF00"
        ]
      },
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "awake": true,
          "parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/errorcode",
          "awake": true,
          "parse": {
            "dpid": 11,
            "eval": "Item.val = String(Attr.val);",
            "fn": "tuya"
          }
        },
        {
          "name": "state/fire",
          "awake": true,
          "parse": {"dpid": 1, "eval": "Item.val = (Attr.val == 0 ? true : false);","fn": "tuya" },
          "default": false
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/lowbattery",
          "parse": {"dpid": 14, "eval": "Item.val = (Attr.val == 0 ? true : false);", "fn": "tuya" },
          "default": false
        },
        {
          "name": "state/test",
          "awake": true,
          "parse": {"dpid": 8, "eval": "Item.val = (Attr.val == 0 ? false : true);", "fn": "tuya" },
          "default": false
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0xEF00"
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Smanar](https://forum.phoscon.de/user_avatar/forum.phoscon.de/smanar/32/60_2.png) [@Smanar](https://forum.phoscon.de/u/Smanar)\
**Post date:** [November 18, 2023, 12:59pm UTC](https://forum.phoscon.de/t/woox-r7049-smoke-detector/4186/3 "2023-11-18T12:59:53Z")

</div>

Ha yep, to have the support using DDF instead of legacy code.  
I have check all already present device that look like this one (using the tuya cluster), but they are different, so realy need a new DDF (and Woox have it’s own folder for device)

> <https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/tuya/_TZE200_dq1mfjug_smoke_sensor.json>

> <https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/tuya/_TZE200_TS0601_smoke_detector.json>

Are you sure you need the “tuya bind” (at the end), most of tuya device have it natively.  
Already present DDF can have problem too ^^ (I have see some “possible useless” code inside)

---

<div class="post-metadata">

**Author:** ![Finne75](https://forum.phoscon.de/user_avatar/forum.phoscon.de/finne75/32/1538_2.png) [@Finne75](https://forum.phoscon.de/u/Finne75)\
**Post date:** [November 18, 2023, 2:44pm UTC](https://forum.phoscon.de/t/woox-r7049-smoke-detector/4186/4 "2023-11-18T14:44:20Z")

</div>

Hi Smanar, no I am not sure, should I remove it? [Here](https://github.com/dresden-elektronik/deconz-rest-plugin/pull/7360) is the PR, although somehow also some previous commits are included and I don’t know how to fix it 🙄. Note that I changed the lowbattery logic (true if DPID 14 == 0) based on some experiments and measurements. I always wondered why these devices permanently needed new batteries 😁.

BTW, one thing I find quite annoying is that in the DDF editor in the GUI, DDFs are not reloaded properly if modifications via an external editor are done. I have to restart deconz every time (hassio add-on).

---

<div class="post-metadata">

**Author:** ![Smanar](https://forum.phoscon.de/user_avatar/forum.phoscon.de/smanar/32/60_2.png) [@Smanar](https://forum.phoscon.de/u/Smanar)\
**Post date:** [November 18, 2023, 5:33pm UTC](https://forum.phoscon.de/t/woox-r7049-smoke-detector/4186/5 "2023-11-18T17:33:01Z")

</div>

> [@Finne75](#):
>
> no I am not sure, should I remove it?

Make the test, there is another DDF with it, but I m sure at 99% it’s useless.

> I always wondered why these devices permanently needed new batteries

Can be deconz fault sometime, or protection from tuya on some others, and ofc bad code in DDF ^^

> BTW, one thing I find quite annoying is that in the DDF editor in the GUI, DDFs are not reloaded properly if modifications via an external editor are done. I have to restart deconz every time (hassio add-on).

Yeah, for me the editor is not usable for sensors, too much problem, less problem using a text editor, but no other choice than restarting deconz.

> although somehow also some previous commits are included and I don’t know how to fix it

Yep, have just see that, you mean about the “bosch device” ?  
I think it will be easier to restart the PR, you are just using your browser to do it ? So need to play with branch, you need to return to the master branch before creating a new one, else depending on your manipulation you can make a new branch based on the actual one.

Edit:  
There is problem, you are not synchronised with the offical master

`This branch is 2 commits ahead, 1 commit behind dresden-elektronik:master.`

And this is not easier to correct ( `commit behind` are not a problem, but for `ahead ` it’s another story), on my side have used command line to repair that, but perhaps this can help you [Restauration d’une demande de tirage (pull request) - Documentation GitHub](https://docs.github.com/fr/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/reverting-a-pull-request)

The problem is probably from thoses PR, you have made in in the master branch, so now you have a new one (your master don’t follow the official one)

> **[Comparing dresden-elektronik:master...Finne75:master ·...](https://github.com/dresden-elektronik/deconz-rest-plugin/compare/master...Finne75:deconz-rest-plugin:master)**
>
> deCONZ REST-API plugin to control ZigBee devices. Contribute to dresden-elektronik/deconz-rest-plugin development by creating an account on GitHub.

Edit:  
**IMPORTANT.**

Now it’s too late, you have a PR with them [DDF for Bosch Smoke Alarm II (#9) by Finne75 · Pull Request #7354 · dresden-elektronik/deconz-rest-plugin · GitHub](https://github.com/dresden-elektronik/deconz-rest-plugin/pull/7354)  
If you edit something you will losse your PR.

For me it’s better to wait for Manup merge your first PR and after make a new one for next devices.

This PR is already approuved and in the Milestone, so will be merged soon.
