logo elektroda
logo elektroda
X

Understanding OpenBecken SendGet Function and Variable Integration possibility

cdtdsilva 903 1
ADVERTISEMENT
  • #1 21203748
    cdtdsilva
    Level 10  
    I was trying to get more details on the OpenBecken function 'SendGet' but can't seem to find any references to it.

    I know for example it's possible to pass on a declaration to turn on a switch on another tasmota / Open Becken device with a command such as:

    http://192.168.5.23/cm?cmnd=Power%201, 0"


    And since we're here, what does this piece at the end of the code do?

    Also, what's the best way to mix this function with some variables, for example where I can have a separate array with the IP address and the final 1/0 to toggle the output? Would the best way be to store these on a buffer using sprintf?

    One example I put together (not actual working code)

    sprintf(buffer, "SendGet http://192.168.1.%d/cm?cmnd=Power%20%d",myip,myvar);
    CMD_ExecuteCommand("buffer", 0);
    


    Or is there a nicer way to do it?

    Thanks!
  • ADVERTISEMENT
  • #2 21209657
    p.kaczmarek2
    Moderator Smart Home
    I've recently posted an OBK clock build, the topic is in Polish but you can view Autoexec.bat because it's in English:
    https://www.elektroda.pl/rtvforum/topic4073144.html

    cdtdsilva wrote:

    http://192.168.5.23/cm?cmnd=Power%201, 0"


    Where did you get this command? It doesn't seem right. For spaces, you need to use %20 I guess.


    cdtdsilva wrote:

    sprintf(buffer, "SendGet http://192.168.1.%d/cm?cmnd=Power%20%d",myip,myvar);
    CMD_ExecuteCommand("buffer", 0);
    


    This is not OBK issue, it's C language issue.
    There are multiple problems
    - you have put buffer with quotation marks, this will not compile I guess? Or even worse if it does...
    - you need to escape the % character correctly, see https://stackoverflow.com/questions/3206496/h...marks-so-they-wont-be-recognized-as-variables

    I'd say that you need:
    Code: C / C++
    Log in, to see the code
    Helpful post? Buy me a coffee.
ADVERTISEMENT