micropython http request on wemos d1 mini - httprequest

I have a micropython-running Wemos D1 mini project board.
I am trying to send a simple HTTP request on another Wemos D1 mini running Easyesp, that has a relay attached to it on pin 5. The request works like this
http://192.168.1.102/control?cmd=GPIO,5,1 # turns relay on
http://192.168.1.102/control?cmd=GPIO,5,1 # turns relay off
I have had the wemos that controls the relay working with 0 trouble for past 6 months and i can use it with my smartphone/pc browser with no trouble.
When i run my micropython script, it freezes after 3rd button press to
<Response object at 3fff3580>
or i get a ERRCONNRESET error.
https://pastebin.com/uHQHpj1Z
I think i need to give some time for the wifi modem to do it's job?

<Response object at 3fff3580> is the response object send back from the other Wemos.
change
urequests.get("http://192.168.1.102/control?cmd=GPIO,5,1") and
urequests.get("http://192.168.1.102/control?cmd=GPIO,5,0") to
res = urequests.get("http://192.168.1.102/control?cmd=GPIO,5,1")
res = urequests.get("http://192.168.1.102/control?cmd=GPIO,5,0")
You can also check whether the request was success full or not by checking the status code.
You can find details about ERRCONNRESET from here

Related

Creating an api to a third party wss?

I am trying to get the OPEN HIGH LOW CLOSE prices from a Chart
this is the website in question : Website
and this is how the chart looks
after inspecting the flow of communication i noticed it connects to a websocket server
Initiating a socket connection to this link: wss://api-in.pocketoption.com:8095/socket.io/?EIO=3&transport=websocket
gives something like this :
but after the response it closes the connection, Looking at the response i can see there is an sid but cant figure what to do with the sid ?

Receiving and processing SMS via GSM Modem

i have GSM modem (ZTE MF112) connected via USB port. I can send and receive SMS with this modem through serial port but i want to monitor the modem continuously for received SMS. if an SMS received, i want to connect the database, search the required information and send it back to the sender.
i need the whole process auto-method without any human interference.
like:
A function which will monitor the Serial port
if an SMS is received, it will call another function and pass the queried information to it and that function will connect the database. if information is found that information will be return otherwise some message will be return to the first function.
Note: The code is needed in VB.Net
some body help me plz.
One way is you make a loop which check for for any unread messages after certain time period like 5 sec or 10 sec if there is any unread message it gets it from modem parse it and display it
I have figured it out. I have added a timer to my application and set its delay to 5000 ms (5 s). Inside the timer_tick event I wrote the code to check and list up unread SMS from the modem.

How do I keep track of websocket id's and send to a specific Websocket from ashx webserver in vb.net

I have a working echowebsocket server built in an ashx page using vb.net. it uses Websocket.SendAsync to push the message down to the client.
I need to be able to push a message to a specific websocket connection.
in a card game,
Player 1 and player two both connect to the server
When Player 1 takes his turn I need the server to push down a message to player 2 with player one's move in text.
so I need the server to keep track of who is connected and who to send the message too.

VB.net Video Streaming Via UDP Port Error

Good Day to all
I am Currently developing a video chat application with Vb.NET
I used the example as explained in this VIDEO. The application runs, but only up to the point I can see my own Webcam but I can't connect to the client unit.
I used try, and an exception came out saying ("The Operation is Not Allowed on Non Connected Sockets") I traced the problem to this code:
Publisher.Send(sendBytes, Bitmapz)
I tried the following
Disabling my firewall
selecting a different port
I set the port to the one in the video btw, (2013)
What should I do to get past the error?
OK i have actually seen this before, remove the blocking lines of code and try again. eg
the listener.blocking = false, just remove it

What is the protocol of GPS tracking device TK103?

I am currently working on getting a location of a vehicle to a server. I am using TK103 as my GPS device. It is sending ##,imei:<my_imei>,A; to the server when the server is started.
This is the only document of the protocol I could find on internet: https://web.archive.org/web/20140401000000*/http://www.zhyichina.com/en/gpstracking/gprs-data-protocol.xls
I followed it. But it does not work properly. It needs to send "ON" command many times to work and any of other commands did not work. Could you please help me to identify the problem.
When you get message like ##,imei:123456789012345,A; you need to respond with LOAD.
When you receive just IMEI number like 123456789012345; you need to respond with ON.
Here you can find the source code of the decoder for this protocol:
https://github.com/tananaev/traccar/blob/master/src/org/traccar/protocol/Gps103ProtocolDecoder.java