Skip to first unread message

Rozelle Martin

unread,
May 27, 2018, 1:54:44 AM5/27/18
to mitappinv...@googlegroups.com



I am working on a lighting control app and need to send command strings from smartphone to (and possibly from) a controller on the local wifi network with a fixed IP address. Just something simple like "@SS3 A1 F5#". The controller I'm sending to will recognise the @ and # as start/end message characters. Would it be as simple as this or is that wishful thinking?


Pablo Bertu

unread,
May 27, 2018, 10:11:58 AM5/27/18
to MIT App Inventor Forum
Hi Rozelle,

I imagine that will send a complete HTTP message (with its header and other overhead) instead of the plain string you are defining.

You can install an IP traffic analyzer (maybe Wireshark but there are others simpler) in your PC, point the web component to the PC IP address and execute the app, to check what arrives.

Hope this helps. Best regards!

Pablo

Rozelle Martin

unread,
May 27, 2018, 12:48:18 PM5/27/18
to MIT App Inventor Forum
Thanks Pablo, I'll try that.

Rozelle Martin

unread,
May 28, 2018, 3:31:15 AM5/28/18
to mitappinv...@googlegroups.com
I'm not really sure how to construct the message/header, etc.. Can someone advise what a simple text message string needs to contain to be sent to a specific IP address such as 192.168.137.1:80? Thanks

Pablo Bertu

unread,
May 28, 2018, 8:18:16 AM5/28/18
to MIT App Inventor Forum
Maybe @JuanAntonio can help. He´s kind of a networking wizard :)

If it comes to developing an extension, I would be interested in co-sponsoring it.

Regards,

Bertu

Ghica

unread,
May 28, 2018, 10:35:07 AM5/28/18
to MIT App Inventor Forum
First try to get this right using a browser on your PC, you should have something like http://192.168.137.1:80 in your address bar, but probably you should add some parameters.
Did you actually try your wishful thinking blocks? Did they work? If not what was the error message?
Do you have some API documentation for your controller?
Cheers, Ghica.

Pablo Bertu

unread,
May 28, 2018, 2:19:41 PM5/28/18
to MIT App Inventor Forum
HI Ghica,

If the controller it´s "hearing" in TCP port 8000, it will (or should :) refuse all traffic incoming at other ports.  Or at least this is how the devices I know work.

Rozelle, can you change the incoming port of the controller?

Regards,

Bertu

Ghica

unread,
May 28, 2018, 2:39:36 PM5/28/18
to MIT App Inventor Forum
Then add :8000 to the url.
Cheers, Ghica

Pablo Bertu

unread,
May 28, 2018, 4:37:01 PM5/28/18
to MIT App Inventor Forum
Regretfully, it won´t work. The overhead of the HTTP POST or PUT commands is much more than the simple message that Rozelle´s controller is expecting.

Here´s a real example:


For sending a simple "AAA123", the Web component adds all the HTTP overhead.  I tried it both with POST and with PUT.


I guess a low-level extension would be the only way to do it.


Another solution, involving some hardware and Arduino software development, would be to connect the phone to an Arduino with a Bluetooth module (HC05/06), send the message via BT, and then forward it from the Arduino to the controller using a Wifi module with no HTTP, just plain TCP/IP connection and messaging.   That may be *very* expensive (compared to the price of the controller) and somewhat complex, but it should work.


Saludos!

Bertu

Ghica

unread,
May 29, 2018, 1:01:25 AM5/29/18
to MIT App Inventor Forum
There is a TCP extension written by a French guy. Look in Taifun’s extension list to find it.
Cheers, Ghica

Rozelle Martin

unread,
May 29, 2018, 3:43:52 AM5/29/18
to mitappinv...@googlegroups.com

Confused! I'm getting the messages above sent from the phone when I click the message button and an error message on the phone after some delay: "Error 1103: Unable to post or put the message "SS4 A01 F05#" with the specified URL 192.168.137.1:80". Sometimes also a message with a header which says at the end "IGNORED=STUFF". I'm a novice when it comes to network messaging as you have probably realised and I have no idea why the app is sending a header and something to the network but not the actual text string. I should add that the controller allows 3rd party interfaces so will handle the header content. Thank you for all the replies so far!

Pablo Bertu

unread,
May 29, 2018, 7:17:30 AM5/29/18
to MIT App Inventor Forum
Great Ghica! Good memory :)

The post in this forum related to that extension doesn´t have the link to download the aix file. I could find it in appybuilder:


Rozelle, you may want to download the aix file from here:


and give it a try. In the appybuilder forum post there´s some example coding.

Keep us updated!

Bertu

Juan Antonio

unread,
Jun 3, 2018, 3:28:45 PM6/3/18
to MIT App Inventor Forum
Gracias Pablo!

 "Internet Of Things" forum section I wrote about a board similar to Arduino with Wifi, is called NodeMcu (4 $):


In this post with NodeMcu you can controller several LEDs by WiFi, maybe it might interest someone.



Reply all
Reply to author
Forward
0 new messages