Logic Machine Forum
Logicmachine + Neato JS SDK - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Logicmachine + Neato JS SDK (/showthread.php?tid=1966)



Logicmachine + Neato JS SDK - usyntax - 14.03.2019

Hello,

I have problem with combining logicmachine and neato robot sdk. I have developed my sdk website which must control my robot.

For example:

If i write https://mywebsite.com/robot.php?start_robot=2 then my robot should start and
https://mywebsite.com/robot.php?start_robot=1 should stop. 

When website fully loaded then need 3-4 more seconds to start robot script. I tried to implement this url to logicmachine http request, but its not working.

For example(logicmachine script):

local http = require('socket.http')
value = event.getvalue()


if(value == true) then
    body = http.request('https://mywebsite.com/robot.php?start_robot=2')
else
    body = http.request('https://mywebsite.com/robot.php?start_robot=1')  
end

How i should deal with this situation?


RE: Logicmachine + Neato JS SDK - Daniel - 14.03.2019

Hi try this


Code:
robot = '2'



https = require('ssl.https')
escape = require('socket.url').escape

url = 'https://mywebsite.com/robot.php?start_robot=%s'
url = string.format(url, escape(robot))

res = https.request(url)
log(res)



RE: Logicmachine + Neato JS SDK - usyntax - 14.03.2019

(14.03.2019, 13:33)Daniel. Wrote: Hi try this


Code:
robot = '2'



https = require('ssl.https')
escape = require('socket.url').escape

url = 'https://mywebsite.com/robot.php?start_robot=%s'
url = string.format(url, escape(robot))

res = https.request(url)
log(res)



Code:
* string: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<p>Additionally, a 400 Bad Request
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>


Maybe should i try implement some header?


RE: Logicmachine + Neato JS SDK - admin - 15.03.2019

Quote:Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request
This means that something is wrong with your Apache configuration.