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.

Shelly http command
#3
(05.12.2022, 12:53)admin Wrote: Try this and check that you get correct URL and response in Logs:
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
Thanks I tried your script with the same result as before.
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


Reply


Messages In This Thread
Shelly http command - by victor.back - 03.12.2022, 17:54
RE: Shelly http command - by admin - 05.12.2022, 12:53
RE: Shelly http command - by victor.back - 05.12.2022, 16:00
RE: Shelly http command - by admin - 05.12.2022, 16:02
RE: Shelly http command - by victor.back - 05.12.2022, 16:11
RE: Shelly http command - by ivob - 27.11.2023, 19:36
RE: Shelly http command - by admin - 28.11.2023, 07:04
RE: Shelly http command - by ivob - 28.11.2023, 07:50
RE: Shelly http command - by Daniel - 28.11.2023, 08:10
RE: Shelly http command - by ivob - 28.11.2023, 10:16
RE: Shelly http command - by ivob - 30.11.2023, 09:41
RE: Shelly http command - by admin - 30.11.2023, 09:42

Forum Jump: