|
@@ -75,9 +75,10 @@ class DeviceListener
|
|
|
$entity = $args->getEntity();
|
|
|
if ($entity instanceof DeviceInterface) {
|
|
|
if($deviceId = $this->getRemoteDeviceId($entity)) {
|
|
|
-
|
|
|
$url = "{$this->devicePutUrl}{$deviceId}";
|
|
|
$this->send($args, $url, HttpRequestInterface::METHOD_PUT);
|
|
|
+ } else {
|
|
|
+ $this->send($args, $this->devicePostUrl, HttpRequestInterface::METHOD_POST);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -111,6 +112,8 @@ class DeviceListener
|
|
|
$filters = array('deviceId'=>$deviceId,'deviceType'=>$deviceType,'tenancyId'=>$tenancyId);
|
|
|
$data = $this->webservice->getData("device_post_url",$filters);
|
|
|
|
|
|
+ file_put_contents("/var/flowdat/error.log",json_encode($data));
|
|
|
+
|
|
|
$deviceId = null;
|
|
|
if(isset($data[0]))
|
|
|
$deviceId = $data[0]['id'];
|