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