Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

http request confusion


Question

Posted

I am trying to send 2 http request to my motioneye server for starting and stopping (after 60 seconds) video recording, the corresponding url is at follows:

 

Start -> http://172.16.10.164:7999/1/config/set?emulate_motion=on

Stop -> http://172.16.10.164:7999/1/config/set?emulate_motion=off

 

Above URL works on browser, and I have a scene to do this as below

 

Please login or register to see this code.

I comment out the line start from local counter = 0, meaning that only do the emulate_motion = on part, the scene works, video captured, saw the debug message (Record Maindoor)

If I run the whole scene, debug window shows the counter immediately.  It looks to me that the upper part of the code (start recording) does not run, and of course the viedo is not captured

 

Anyone can help debug the code above? I am still lua newbie, thx! Btw I am on HC2 still.

 

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

Unfortunately you can't do fibaro:sleep while executing a net.HTTPClient:request(...), as the sleep will prevent the http request to run "in the background".

You could do a sleep after your success handler is called, or as I have done in this case call a "stop recording" function after 90s with the setTImeout function.

 

Please login or register to see this code.

 

Edited by jgab

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...