Daylight sensor does not have attributes lat and long

Hi,

I am trying to set the coordinates for the daylight sensor via REST API since they have not been set when setting up the Phoscon gateway. The daylight sensors currently is configured as follows:

$ curl http://192.168.123.123/api/1234567890/sensors/1 | jq .                                                                               {
  "config": {
    "configured": false,
    "on": true,
    "sunriseoffset": 30,
    "sunsetoffset": -30
  },
  "etag": "98e0a065627c5debb677a65865eb5623",
  "manufacturername": "Philips",
  "modelid": "PHDL00",
  "name": "Daylight",
  "state": {
    "dark": null,
    "daylight": null,
    "lastupdated": "none",
    "status": null
  },
  "swversion": "1.0",
  "type": "Daylight",
  "uniqueid": "00:21:2e:ff:ff:08:76:73-01"
}

When I try to set lat and long I get the following error:

$ curl -X PUT -d '{"lat":52.12345678,"long":9.12345678}' http://192.168.123.123/api/1234567890/sensors/1/config | jq .
[
  {
    "error": {
      "address": "/sensors/1/config/lat",
      "description": "parameter, lat, not available",
      "type": 6
    }
  },
  {
    "error": {
      "address": "/sensors/1/config/long",
      "description": "parameter, long, not available",
      "type": 6
    }
  }
]

What else can I do to configure the daylight sensor?

I start deconz with docker-compose on a Raspberry PI 4B 4GB with the following file:

version: "2.4"
services:
  deconz:
    image: deconzcommunity/deconz:stable
    container_name: deconz
    network_mode: host
    restart: always
    volumes:
      - /opt/deconz:/root/.local/share/dresden-elektronik/deCONZ
    devices:
      - /dev/ttyAMA0
    environment:
      - TZ=Europe/Berlin
      - DECONZ_DEVICE=/dev/ttyACM0
      - DECONZ_WEB_PORT=80
      - DECONZ_WS_PORT=443
      - DECONZ_VNC_MODE=1
      - DECONZ_VNC_PORT=5900
      - DECONZ_NOVNC_PORT=0
      - DEBUG_INFO=1
      - DEBUG_APS=0
      - DEBUG_ZCL=0
      - DEBUG_ZDP=0
      - DEBUG_OTAU=0
    cap_add:
      - ALL
    privileged: true

Thanks in advance for your help and best regards,
Tobias

Hi,

I have now reset the container and restored my settings from a previous backup. Now I get a different error message:

$ curl -X PUT -d '{"lat":52.12345678,"long":9.12345678}' http://192.168.123.123/api/1234567890/sensors/1/config | jq .
  {
    "error": {
      "address": "/sensors/1/config/lat",
      "description": "invalid value, 52.12345678, for parameter lat",
      "type": 7
    }
  },
  {
    "error": {
      "address": "/sensors/1/config/long",
      "description": "invalid value, 9.12345678, for parameter long",
      "type": 7
    }
  }
]

The API documentation gives the type “Number” for both parameters. I also tried with fewer decimal places (4), but I still get the same error.

Thanks and best regards,
Tobias

rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeString, QVariant::String, RConfigLat));

                else if (rid.suffix == RConfigLat || rid.suffix == RConfigLong) // String
                {
                    updated = true;
                }

Can you try with string instead of number ?

Thanks @Smanar,

it works when using a string instead of a number:

$ curl -X PUT -d '{"lat":"52.12345678","long":"9.12345678"}' http://192.168.123.123/api/1234567890/sensors/1/config | jq .
[
  {
    "success": {
      "/sensors/1/config/lat": "52.12345678"
    }
  },
  {
    "success": {
      "/sensors/1/config/long": "9.12345678"
    }
  }
]

But it’s strange that the two attributes are still not shown when doing a GET for the daylight sensor:

$ curl http://192.168.123.123/api/1234567890/sensors/1 | jq .                                                                            {
  "config": {
    "configured": true,
    "on": true,
    "sunriseoffset": 30,
    "sunsetoffset": -30
  },
  "etag": "82bf2617a9982465c42632357afcb6ba",
  "manufacturername": "Philips",
  "modelid": "PHDL00",
  "name": "Daylight",
  "state": {
    "dark": false,
    "daylight": true,
    "lastupdated": "2022-06-11T11:10:13.895",
    "status": 170,
    "sunrise": "2022-06-11T03:00:59",
    "sunset": "2022-06-11T19:43:47"
  },
  "swversion": "1.0",
  "type": "Daylight",
  "uniqueid": "00:21:2e:ff:ff:08:76:73-01"
}

But since configured is true now, the sensor should work. I will check if it changes its status tonight.

It’s normal, thoses value are hidden in the code.
For security reason I think.

Yes, that would make sense.