sanjoyg / dirigera_platform

HomeAssistant Integration for Dirigera Platform
MIT License
122 stars 16 forks source link

Vallhorn motion sensor always reported as "clear" #26

Closed Enchufa2 closed 7 months ago

Enchufa2 commented 7 months ago

Thanks for this integration. I installed this to incorporate a Vallhorn motion sensor to some automations, but unfortunately it's always reported as "clear" when e.g. the Google Home app correctly reports the activity.

I've dumped the JSON with and without motion being detected and I noticed that this sensor does not use the isOn attribute, but the isDetected one instead. Here's the dump while I'm standing in front of the sensor:

{
   "id":[redacted],
   "relationId":[redacted],
   "type":"sensor",
   "deviceType":"motionSensor",
   "createdAt":"2024-03-29T02:18:45.000Z",
   "isReachable":true,
   "lastSeen":"2024-03-30T12:13:56.000Z",
   "attributes":{
      "customName":[redacted],
      "firmwareVersion":"1.0.64",
      "hardwareVersion":"1",
      "manufacturer":"IKEA of Sweden",
      "model":"VALLHORN Wireless Motion Sensor",
      "productCode":"E2134",
      "serialNumber":[redacted],
      "batteryPercentage":87,
      "isOn":false,
      "isDetected":true,
      "motionDetectedDelay":20,
      "identifyPeriod":0,
      "identifyStarted":"2000-01-01T00:00:00.000Z",
      "permittingJoin":false,
      "sensorConfig":{
         "scheduleOn":false,
         "onDuration":600,
         "schedule":{
            "onCondition":{
               "time":"22:00"
            },
            "offCondition":{
               "time":"06:00"
            }
         }
      },
      "circadianPresets":[

      ]
   },
   "capabilities":{
      "canSend":[

      ],
      "canReceive":[
         "customName"
      ]
   },
   "room":{
      [redacted]
   },
   "deviceSet":[

   ],
   "remoteLinks":[

   ],
   "isHidden":false
}

Note the isDetected attribute set to true, which is false when the view is clear. Is there a quick way to patch my installation to use this attribute while a proper fix is implemented?

Enchufa2 commented 7 months ago

Answering my question, yes, there's a quick workaround. For reference:

And now it works perfectly. This works for me because I'm planning on using Vallhorn sensors only, but a proper fix would probably be a bit more involved.

sanjoyg commented 7 months ago

Just to clarify, so the value to read is is_on and not is_detected is that correct?

sanjoyg commented 7 months ago

Try release 1.3.5.1 and let know. The issue should be fixed

Enchufa2 commented 7 months ago

I confirm it works perfectly, thanks!

sanjoyg commented 7 months ago

Great, closing the issues