lpgera / dirigera

An unofficial TypeScript client library for IKEA's DIRIGERA smart home hub
https://www.npmjs.com/package/dirigera
MIT License
55 stars 2 forks source link

Missing device: lightSensor #11

Closed grau closed 5 days ago

grau commented 6 days ago

Using this API in my home automation and really love it! But I found, that there is a device missing: My VALLHORN Motion sensors not only provide their data as "motionSensor" but addionally the room illuminance as "lightSensor". I just appended a datagram that I got from one of my motion sensors.

Would be cool, if you could add it. Thanks ahead!

{
  "id": "Some ID",
  "relationId": "Some other ID",
  "type": "unknown",
  "deviceType": "lightSensor",
  "createdAt": "2024-09-08T10:44:07.000Z",
  "isReachable": true,
  "lastSeen": "2024-10-19T19:36:01.000Z",
  "attributes": {
    "customName": "",
    "model": "VALLHORN Wireless Motion Sensor",
    "manufacturer": "IKEA of Sweden",
    "firmwareVersion": "1.0.64",
    "hardwareVersion": "1",
    "serialNumber": "Some serial",
    "productCode": "E2134",
    "illuminance": 1,
    "identifyStarted": "2000-01-01T00:00:00.000Z",
    "identifyPeriod": 0,
    "permittingJoin": false
  },
  "capabilities": {
    "canSend": [],
    "canReceive": [
      "customName"
    ]
  },
  "deviceSet": [],
  "remoteLinks": [],
  "isHidden": false
}

Some additional things I found out:

lpgera commented 5 days ago

This is very interesting, I've not seen a device that shows up as two different entities on the hub before. Thanks for the data dump!

Looks like these should have their own dedicated client.lightSensors.list() and client.lightSensors.get(...)API for providing theilluminance` attribute. So the VALLHORN sensor would then appear both in the motion sensors and in the light sensors list but with different data attributes.

I'll add the support for this soon!

lpgera commented 5 days ago

Version 1.2.0 is published to npm with the added lightSensor functionality.

grau commented 2 days ago

Thanks a lot for your fast response! Works like a charm!