deconz-rest-plugin: Rules fail to fire with conditions on DDF devices

Describe the bug

Some rules don’t fire, when conditions are based on attributes of devices exposed through DDFs. After changing the DDF status from Gold to Draft, the rules fire again.

Steps to reproduce the behavior

I noticed this for the Hue motion sensor, where I have a rule with:

  "conditions": [
    {
      "address": "/sensors/222/state/presence",
      "operator": "eq",
      "value": "true"
    },
    {
      "address": "/sensors/222/state/presence",
      "operator": "dx"
    },
    {
      "address": "/sensors/221/state/status",
      "operator": "gt",
      "value": "-1"
    },
    {
      "address": "/sensors/221/state/status",
      "operator": "lt",
      "value": "4"
    }

It seems like the dx condition on presence isn’t firing.

Expected behavior

Rules should work independent of how device is exposed (through legacy C++ code or through DDF).

Screenshots

n/a

Environment

  • Host system Raspberry Pi
  • Running method: Raspbian
  • Firmware version: 26400500, but also others
  • deCONZ version: 2.71.1, but also earlier versions
  • Device: RaspBee I, but also others
  • Do you use an USB extension cable: (yes / no) – only relevant for ConBee I/II
  • Is there any other USB or serial devices connected to the host system? If so: Which?

deCONZ Logs

Additional context

I’m not exactly sure what’s going on. I think some rules that should be triggered by daylight or dark are failing as well (also Hue motion sensor). It would seem the web socket events are issued alright.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 16 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Turns out the missing part was that the DDF didn’t set the Event::num() which is used in the rules. Beside the fix in #6288 I’ve spotted another problem in the device state machine which is fixed in #6289.

It would be nice to see this fixed. Just created a rule in hue essentials to have a Philips sensor switch on lights when movement is detected while it is dark, and the rule does not work. Can also confirm that the rule does work, if the DDF status is set to draft. Will retest again with DDF status set to Gold once a fix is available.