05.12.2022, 16:00
(05.12.2022, 12:53)admin Wrote: Try this and check that you get correct URL and response in Logs:Thanks I tried your script with the same result as before.
Code:http = require("socket.http")
http.TIMEOUT = 5
cmd = grp.getvalue() and "on" or "off"
url = "http://192.168.1.51/relay/0?turn=" .. cmd
log(url)
res, err = http.request(url)
log(res, err)
If your device supports MQTT you can use it instead of HTTP: https://forum.logicmachine.net/showthread.php?tid=3010
I get this in log for both ON and OFF telegram.
Shelly plug 05.12.2022 16:59:00
* string: http://192.168.1.51/relay/0?turn=off
Shelly plug 05.12.2022 16:59:00
* arg: 1
* string: {"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"overpower":false,"source":"http"}
* arg: 2
* number: 200
Shelly plug 05.12.2022 16:59:13
* string: http://192.168.1.51/relay/0?turn=off
Shelly plug 05.12.2022 16:59:13
* arg: 1
* string: {"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"overpower":false,"source":"http"}
* arg: 2
* number: 200