13.04.2023, 10:24
(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