Jump to content

Recommended Posts

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 by Jos
added codebox and Tidied source
Link to post
Share on other sites

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 post
Share on other sites
  • 2 weeks later...
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 post
Share on other sites
  • 2 weeks later...

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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...