gladiator Posted April 20, 2021 Share Posted April 20, 2021 (edited) I'm trying to control my IoT devices through http commands through an AutoIt script. The toggle command does work with devices with Tasmota fw but unfortunately it works only the first time I issue the command with shelly 1 devices (i.e. if the device is ON and I run the script though the gui the device goes OFF the first time, it stays in OFF state the following times). You find here the script. If I run without GUI the only statement InetRead ( "http://192.168.0.33/relay/0?turn=toggle" ) It work flawlessly. Do you have any suggestion/hint for a solution or for proceeding in a debug ? ----------------------------------------------------------------------------------------------------- #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Label1 = GUICtrlCreateLabel("Prova shelly", 271, 64, 73, 17) GUICtrlSetFont(-1, 8, 800, 4, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Abatjour", 287, 152, 40, 17) $Button1 = GUICtrlCreateButton("Button1", 270, 176, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 InetRead("http://192.168.0.33/relay/0?turn=toggle") EndSwitch WEnd Edited April 20, 2021 by Jos added codebox and Tidied source Link to comment Share on other sites More sharing options...
Danp2 Posted April 20, 2021 Share Posted April 20, 2021 Have you tried using the Force Reload option? InetRead("http://192.168.0.33/relay/0?turn=toggle", $INET_FORCERELOAD) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
gladiator Posted April 20, 2021 Author Share Posted April 20, 2021 Yessssssss, Danp2, thanks a lot: that made the magic !!!!!! I appreciate VERY MUCH your prompt and effective support. May I try to ask an additional question ? Do you have an idea why this additional parameter is not needed with IoT devices with Tasmota fw and is mandatory with shelly devices ? Link to comment Share on other sites More sharing options...
JockoDundee Posted April 30, 2021 Share Posted April 30, 2021 On 4/20/2021 at 8:20 AM, gladiator said: Do you have an idea why this additional parameter is not needed with IoT devices with Tasmota fw and is mandatory with shelly devices ? Prolly because Tasmota has something along the lines of: <meta http-equiv=“Pragma” content=”no-cache”> <meta http-equiv=“Expires” content=”-1″> <meta http-equiv=“CACHE-CONTROL” content=”NO-CACHE”> in its page, which won’t go to the cache. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
gladiator Posted May 3, 2021 Author Share Posted May 3, 2021 Thanks JockoDundee !!! Link to comment Share on other sites More sharing options...
Confuzzled Posted May 13, 2021 Share Posted May 13, 2021 As an aside, does Tasmota support JSON and MQTT? Just asking as I know the answer, but it might send you down an interesting rabbit hole.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now