Welcome! Log In Create A New Profile

Advanced

WM24 Restsend

Posted by cardcoder 
WM24 Restsend
February 01, 2021 03:14PM
I am trying to control the Sonoff Basic R3 Home Automation unit.

I can make it work in Windev without issue.

I have copied the code to a cmd button on Windev 24 Express but it does not work.



ws_switch is string = [
{
"deviceid": "1000b8d2be",
"data": {
"switch": "on"
}
}
]

i is int
maReq is a httpRequest
myRep is a httpResponse
HttpVariant is a Variant



maReq..URL = "[192.168.1.56];
maReq..Header["content-type"] = "application/json"
maReq..Content=ws_switch
maReq..Method=httpPost

myRep = RESTSend(maReq)










What else do I need to do?

Kindest Regards,

Mike
Argus
Re: WM24 Restsend
February 01, 2021 03:36PM
in windev, by default "is string" defines an ANSI string
in mobile, it defines a UNICODE string

So if you want to create code that works EVERYWHERE, you need to define PRECISELY what you are doing
Here you need to say
ws_switch is ANSI string

There may be another problem, but that one is clear
Re: WM24 Restsend
February 01, 2021 03:50PM
Argus,

THANK YOU! All help greatly received.

Kindest Regards,

Mike
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: