Logic Machine Forum
SPZ number/LM - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: SPZ number/LM (/showthread.php?tid=4483)

Pages: 1 2


RE: SPZ number/LM - 2MAX - 17.01.2023

(17.01.2023, 07:55)admin Wrote: Try this and post what you get in Logs:
Code:
<?

require('apps')
vars = getvars()
log(vars)



RE: SPZ number/LM - admin - 17.01.2023

Click the log entry. Does it contain any more information?


RE: SPZ number/LM - 2MAX - 17.01.2023

(17.01.2023, 11:17)admin Wrote: Click the log entry. Does it contain any more information?

(17.01.2023, 11:17)admin Wrote: Click the log entry. Does it contain any more information?

Maybe text below helps

This is from app developer:
{
  "packetCounter":"25523",
  "datetime":"20181212 163419000",
  "plateText":"\u0031\u0039\u005a\u0046\u005a\u004c",
  "plateCountry":"NLD",
  "plateConfidence":"0.719640",
  "carState":"new",
  "geotag":{"lat": 50.418114,"lon": 30.476213},
  "imageType": "plate",
  "plateImageType": "png",
  "plateImageSize":  "0",
  "carMoveDirection":"in",
  "timeProcessing":"411",
  "timeDetection":"20181212 163419000",
  "plateCoordinates":[480, 270, 216, 30],
  "carID":"72006",
  "GEOtarget":"",
  "datetimezone":"2018-12-12T16:34:19+0200",
  "carVerticalDirection":"up",
  "recognitionZone":"1",
  "imagesURI":["/home/setup/opensdk/html/NumberOkEdgeHanwha/images/images/20181210171447…”, ...],
  "plateASCII":"19ZFZL",
  "plateUnicode":"\u0031\u0039\u005a\u0046\u005a\u004c",
  "sensorProviderID":"CAM_00166CC39D44"
}


RE: SPZ number/LM - admin - 17.01.2023

The documentation does not help as it does not provide the raw request format, only the data that the request contains.
The camera is sending a POST request that LM cannot parse. Unfortunately the raw request is discarded in this case.

Run this and post what you get in Logs:
Code:
<?

require('apps')
log(ngx.var.content_type)



RE: SPZ number/LM - 2MAX - 18.01.2023

(17.01.2023, 14:00)admin Wrote: The documentation does not help as it does not provide the raw request format, only the data that the request contains.
The camera is sending a POST request that LM cannot parse. Unfortunately the raw request is discarded in this case.

Run this and post what you get in Logs:
Code:
<?

require('apps')
log(ngx.var.content_type)



RE: SPZ number/LM - admin - 18.01.2023

Next thing to try:
Code:
<?

require('apps')

upload()
vars = getvars()

for key, value in pairs(vars) do
  log(key, value)
end



RE: SPZ number/LM - 2MAX - 18.01.2023

(18.01.2023, 08:04)admin Wrote: Next thing to try:
Code:
<?

require('apps')

upload()
vars = getvars()

for key, value in pairs(vars) do
  log(key, value)
end
Log is empty


RE: SPZ number/LM - admin - 18.01.2023

One more thing to try:
Code:
<?

require('apps')

sock = ngx.req.socket()
if sock then
  sock:settimeout(5 * 1000)
  data = sock:receive('*a')
  log(data)
else
  log('no request socket')
end



RE: SPZ number/LM - 2MAX - 18.01.2023

(18.01.2023, 12:17)admin Wrote: One more thing to try:
Code:
<?

require('apps')

sock = ngx.req.socket()
if sock then
  sock:settimeout(5 * 1000)
  data = sock:receive('*a')
  log(data)
else
  log('no request socket')
end

still empty, it is 10 minutes after event log on camera


RE: SPZ number/LM - admin - 18.01.2023

It should log something even if there's no data (nil). Open the same URL in your browser. Do you get "no request socket" logged?


RE: SPZ number/LM - 2MAX - 18.01.2023

(18.01.2023, 13:06)admin Wrote: It should log something even if there's no data (nil). Open the same URL in your browser. Do you get "no request socket" logged?

browser shows this :
Error in /www/user/kam.lp at line 11: attempt to call global '  log' (a nil value)

(18.01.2023, 13:06)admin Wrote: It should log something even if there's no data (nil). Open the same URL in your browser. Do you get "no request socket" logged?

and nothing in LM log


RE: SPZ number/LM - admin - 18.01.2023

This is a copy/paste issue. Remove all leading spaces and it will work. The previous example might also work if modified:
Code:
<?

require('apps')

upload()
vars = getvars()

for key, value in pairs(vars) do
log(key, value)
end



RE: SPZ number/LM - 2MAX - 19.01.2023

(18.01.2023, 13:53)admin Wrote: This is a copy/paste issue. Remove all leading spaces and it will work. The previous example might also work if modified:
Code:
<?

require('apps')

upload()
vars = getvars()

for key, value in pairs(vars) do
log(key, value)
end
This look to works fine, log rom event below :

* arg: 1
  * string: event
* arg: 2
  * string: {"packetCounter":"0",
"datetime":"20230119 101832000",
"plateText":"\u0050\u0030\u004c\u0049\u0043\u0049\u0045",
"plateCountry":"POL",
"plateConfidence":"0.843826",
"carState":"new",
"geotag":{"lat": 49,"lon": 17},"imageType": "plate","plateImageType": "png","plateImageSize": "0","carMoveDirection":"unknown",
"timeProcessing":"0",
"timeDetection":"20230119 101832000",
"plateCoordinates":[737, 137, 63, 20],
"carID":"698",
"GEOtarget":"/mnt/opensdk/html/NumberOkEdgeHanwha/images/images/2023119101833_58189/2023119101833_58189lp_P0LICIE.png",
"datetimezone":"2023-01-19T10:18:32+0100",
"carVerticalDirection":"unknown",
"recognitionZone":"1",
"imagesURI":["/home/setup/opensdk/html/NumberOkEdgeHanwha/images/images/2023119101833_58189/2023119101833_58189lp_P0LICIE.png","/home/setup/opensdk/html/NumberOkEdgeHanwha/images/images/2023119101833_58189/2023119101833_58189lp_P0LICIE.jpeg"],
"plateASCII":"P0LICIE",
"plateUnicode":"\u0050\u0030\u004c\u0049\u0043\u0049\u0045",
"sensorProviderID":"1"
}

(19.01.2023, 09:23)2MAX Wrote:
(18.01.2023, 13:53)admin Wrote: This is a copy/paste issue. Remove all leading spaces and it will work. The previous example might also work if modified:
Code:
<?

require('apps')

upload()
vars = getvars()

for key, value in pairs(vars) do
log(key, value)
end
This look to works fine, log rom event below :

* arg: 1
  * string: event
* arg: 2
  * string: {"packetCounter":"0",
"datetime":"20230119 101832000",
"plateText":"\u0050\u0030\u004c\u0049\u0043\u0049\u0045",
"plateCountry":"POL",
"plateConfidence":"0.843826",
"carState":"new",
"geotag":{"lat": 49,"lon": 17},"imageType": "plate","plateImageType": "png","plateImageSize": "0","carMoveDirection":"unknown",
"timeProcessing":"0",
"timeDetection":"20230119 101832000",
"plateCoordinates":[737, 137, 63, 20],
"carID":"698",
"GEOtarget":"/mnt/opensdk/html/NumberOkEdgeHanwha/images/images/2023119101833_58189/2023119101833_58189lp_P0LICIE.png",
"datetimezone":"2023-01-19T10:18:32+0100",
"carVerticalDirection":"unknown",
"recognitionZone":"1",
"imagesURI":["/home/setup/opensdk/html/NumberOkEdgeHanwha/images/images/2023119101833_58189/2023119101833_58189lp_P0LICIE.png","/home/setup/opensdk/html/NumberOkEdgeHanwha/images/images/2023119101833_58189/2023119101833_58189lp_P0LICIE.jpeg"],
"plateASCII":"P0LICIE",
"plateUnicode":"\u0050\u0030\u004c\u0049\u0043\u0049\u0045",
"sensorProviderID":"1"
}



RE: SPZ number/LM - admin - 19.01.2023

This will log the plate number text from the camera event:
Code:
<?

require('apps')

upload()
vars = getvars()

data, err = json.pdecode(vars.event)
if type(data) == 'table' then
  log(data.plateText)
else
  log('decode failed', err)
end



RE: SPZ number/LM - 2MAX - 19.01.2023

(19.01.2023, 09:29)admin Wrote: This will log the plate number text from the camera event:
Code:
<?

require('apps')

upload()
vars = getvars()

data, err = json.pdecode(vars.event)
if type(data) == 'table' then
  log(data.plateText)
else
  log('decode failed', err)
end

Thank You very much. It works! But onetimes it send 777706666 on LM, but in log from camera it is 77T706660, any idea why?

look pls on red


2023-01-19 16:15:21 (GMT 1),L0GMAX,POL,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 16:02:14 (GMT 1),2BZ8720,CZE,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 15:43:54 (GMT 1),P0ICIE,POL,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 15:42:39 (GMT 1),5M83333,CZE,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 15:22:18 (GMT 1),INS1,CYP,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 15:21:36 (GMT 1),IEI723705690,No Country,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 15:04:14 (GMT 1),77T706660,IRL,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 15:04:07 (GMT 1),77770666,ISR,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 15:03:58 (GMT 1),3AL6689,CZE,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 14:15:25 (GMT 1),SANITKAA0,No Country,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 14:12:41 (GMT 1),5M83333,CZE,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 14:11:54 (GMT 1),5M83333,CZE,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 14:11:26 (GMT 1),3333,LUX,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 14:11:13 (GMT 1),5M83333,CZE,Not in list,Save to SD Sent to NVR,Unknown
2023-01-19 14:10:33 (GMT 1),5M83333,CZE,Not in list,Save to SD Sent to NVR,Unknown


RE: SPZ number/LM - admin - 20.01.2023

Try using plateASCII instead of plateText. If it still happens then this question should be addressed to the camera manufacturer.