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.

Http Api command to Zennio Getface IP
#5
(16.05.2018, 12:38)admin Wrote: Attach this code to an event script (boolean object). It will contol switch 1 depending on object value. Make sure that Switch API is enabled without encryption and authentication. log(...) call at the end should be removed if script is working correctly.

Code:
require('socket.http')

switch = 1

value = event.getvalue()
if value then
 action = 'on'
else
 action = 'off'
end

url = 'http://192.168.1.101/api/switch/ctrl?switch=' .. switch .. '&action=' .. action
res, err = socket.http.request(url)

log(res, err)

Hi

Works perfectly, thanks! Smile

Now to my next question, how to read a input from Zennio Getface IP ? 
is there an easy way?

Br Even.
Reply


Messages In This Thread
RE: Http Api command to Zennio Getface IP - by Evens - 16.05.2018, 14:19

Forum Jump: