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

DDF for IKEA TRADFRI motion sensor #7243

Merged
merged 2 commits into from Sep 24, 2023
Merged

Conversation

ebaauw
Copy link
Collaborator

@ebaauw ebaauw commented Sep 16, 2023

New DDF, in line with DDFs for other IKEA controllers (!).

The DDF handles both the gen-1 (E1525) and gen-2 (E1745) motion sensors. They use the same modelid; but the productid to tell them apart.

Note that these are indeed controllers (not sensors), sending On with Timed Off on detecting motion. Light can be controlled directly (without deCONZ running) by adding them to the associated group.

The sensors won't detect next motion for the period from On Time, so we set config.duration based on that parameter. This is a change with respect to the C++ code, that used config.delay for that. However the DDF logic to reset state/presence only works for config/duration, and it should be set to 0 (so the C++ code used config/delay instead) or to the config/delay value anyways.

The duration can set between 60 and 600 seconds on the gen-1 model, using the dial on the device, and is fixed to 180 seconds on the gen-2 model. The day/night setting on the device needs to be on night, or state/dark will always be reported as true.

Note that the C++ code will still add config/delay when motion is detected, but this is removed when deCONZ restarts.

{
  "config": {
    "alert": "none",
    "battery": 100,
    "delay": 60,
    "duration": 60,
    "group": "10461",
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "292eb36a4d8bea64772e663dde57870f",
  "lastannounced": null,
  "lastseen": "2023-09-16T23:03Z",
  "manufacturername": "IKEA of Sweden",
  "modelid": "TRADFRI motion sensor",
  "name": "TRADFRI motion sensor",
  "productid": "E1525",
  "state": {
    "dark": false,
    "lastupdated": "2023-09-16T23:04:46.969",
    "presence": true
  },
  "swversion": "1.2.214",
  "type": "ZHAPresence",
  "uniqueid": "00:0b:57:ff:fe:22:cf:5f-01-0006"
}
{
  "config": {
    "alert": "none",
    "battery": 100,
    "delay": 180,
    "duration": 180,
    "group": "20004",
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "0a91afd665efbbe9544fb2810405f52a",
  "lastannounced": null,
  "lastseen": "2023-09-16T23:04Z",
  "manufacturername": "IKEA of Sweden",
  "modelid": "TRADFRI motion sensor",
  "name": "Presence 130",
  "productid": "E1745",
  "state": {
    "dark": true,
    "lastupdated": "2023-09-16T23:04:45.342",
    "presence": true
  },
  "swversion": "2.0.022",
  "type": "ZHAPresence",
  "uniqueid": "14:b4:57:ff:fe:3e:ad:28-01-0006"
}

Parse _On with Timed Off_ into `state/presence`, `state/dark`, and `config/duration`.
@ebaauw ebaauw requested a review from manup September 16, 2023 23:05
@ebaauw ebaauw added Device Request Device Improvement Additional tag to attach to a existing issue. labels Sep 16, 2023
@ebaauw ebaauw added this to the v2.24.1-beta milestone Sep 16, 2023
@manup
Copy link
Member

manup commented Sep 24, 2023

Nice, looks like that we can remove quite some Ikea C++ code soon 👍

@manup manup merged commit 5b63503 into dresden-elektronik:master Sep 24, 2023
1 check failed
@ebaauw ebaauw deleted the motion branch September 24, 2023 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Device Improvement Additional tag to attach to a existing issue. Device Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants