This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Synology surveillance Station webhook
#1
I have configured the webhook on surveillance station and made a survstat.lp script to receive the webhook.

If i look in it i see this data after the test:
Code:
equire('apps') -- read POST data body = ngx.req.get_body_data() if body then -- decode data as JSON data = json.pdecode(body) -- check that data is a table if type(data) == 'table' then log(data) -- movement detected, you can check data.camera_id if you have multiple cameras if data.event_type == 'movement' then -- do something when movement happens end end end

How can i now use the movement to turn on a light?
Reply
#2
You can use grp.write inside .lp scripts, just make sure that you have require('apps') before grp.write.
Reply
#3
(13.04.2023, 10:12)KoBra Wrote: I have configured the webhook on surveillance station and made a survstat.lp script to receive the webhook.

If i look in it i see this data after the test:
Code:
equire('apps') -- read POST data body = ngx.req.get_body_data() if body then -- decode data as JSON data = json.pdecode(body) -- check that data is a table if type(data) == 'table' then log(data) -- movement detected, you can check data.camera_id if you have multiple cameras if data.event_type == 'movement' then -- do something when movement happens end end end

How can i now use the movement to turn on a light?

I used this from the netatmo camera topic in my .lp script
Code:
equire('apps')
-- read POST data
body = ngx.req.get_body_data()

if body then
  -- decode data as JSON
  data = json.pdecode(body)

  -- check that data is a table
  if type(data) == 'table' then
    log(data)

    -- movement detected, you can check data.camera_id if you have multiple cameras
    if data.event_type == 'movement' then
      -- do something when movement happens
    end
  end
end
I think i need to modify this part as i have no clue what i am getting in from synology
Reply
#4
You're missing the starting <? tag in your .lp file. It should be like this:
Code:
<?
require('apps')
...
Reply


Forum Jump: