03.12.2022, 17:54
(This post was last modified: 03.12.2022, 17:54 by victor.back.)
Hi.
Can someone answer where I do wrong in this script for controling a shelly plug.
The url works as it suppose to when paste it in a web browser.
The shelly plug is just turn OFF either if I put the controling GA to "ON" or "OFF".
Can someone answer where I do wrong in this script for controling a shelly plug.
The url works as it suppose to when paste it in a web browser.
The shelly plug is just turn OFF either if I put the controling GA to "ON" or "OFF".
Code:
http = require("socket.http")
http.TIMEOUT = 5
ShellyPlugON = "http://192.168.1.51/relay/0?turn=on"
ShellyPlugOFF = "http://192.168.1.51/relay/0?turn=off"
value = grp.getvalue()
if value == true then
http.request(ShellyPlugON)
else
http.request(ShellyPlugOFF)
end