(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)
Hello dear Admin
If I want to do the job reverse, means I want to receive a command/trigger from the Getface IP, what is the http command from the zennio getface should look like?
Best Regards,