Error when creating or deleting codes

Hello,

I created a PHP routine to control different NUKI devices.
All smartlocks working perfect. I can create and delete pins, except on two devices.

Sometimes I can’t create a PIN, sometime I can’t delete a PIN. Its very frustrating.
When i sync the device via Nuki web, nothing happens. The battery is ok.

What can I do?
I also have the problem, that the timezone for all codes is +2h.
When I create a PIN for 14:00, the PIN in NUKI is valid from 16:00

Here a part of my code:

$bearercode = "mysecretbearercode"; 
$startzeitpunkt = $startid-120;
$endzeitpunkt = $startzeitpunkt+3600;

$startparamter = date("Y-m-d",$startzeitpunkt) ."T".date("H:i:s",$startzeitpunkt) . ".000Z";
$zielparamter = date("Y-m-d",$endzeitpunkt) ."T".date("H:i:s",$endzeitpunkt) . ".000Z";

$data = array(
"name" => "B".$orderid."ok",
"type" => 13,
"code" => $pinid,
"allowedFromDate" =>  $startparamter,
"allowedUntilDate" => $zielparamter,
"allowedWeekDays" => 0
);	
$jsonData = json_encode($data);

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, 'https://api.nuki.io/smartlock/mysmartpinid/auth'); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
	curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);

	$headers = array();
	$headers[] = 'Content-Type: application/json';
	$headers[] = 'Accept: application/json';
	$headers[] = 'Authorization: Bearer ' . $bearercode;
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

	$result = curl_exec($ch);
	if (curl_errno($ch)) {
		// echo 'Error:' . curl_error($ch);
	}
	curl_close($ch);

Thanks for any response.
Ronny

If they are Smart Lock 3.0s please check if they are affected by this: Service Program for Nuki Smart Lock 3.0 - Nuki

Nuki uses UTC for start and end dates.
e.g. PIN should be valid from 1.1.2022 00:00:00 is in UTC

Time periods are relativ to the local time.
e.g. PIN should allow locking each day from 14:00 to 16:00 means 14:00 to 16:00 in local time)

Thank you for the link. No, they are not affected.
But the error is always only on the same devices.

Which Smart Lock type is it?
If it is connected through a Bridge make sure that the connection between bridge and SL is green on the connection info screen.

I can’t answer your question, because I don’t own or build the system.
I only connect it via booking software and the nuki api.

But i have access to the nuki web interface. Can i see the information you requested there?

No, you need a Nuki App which has an authorization for the lock.

I let the customer check the app. Looks all fine.
We tested both smartlooks again and it works fine. Very strange.