Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www
#15

(08-06-2018, 20:37)t3gathome Wrote:  Setting a hostname works also, but one big problem with the OTA name...: it is with an underscore "_" and the esp changes it unfortunately to a minus "-". That's why I think it was not working for you :/.
I have it working again at my setup Smile:

Code:
if (wifi.createTCP(mux_id, "WD-1", 80, 0)) {

and

char *get_json = "GET / HTTP/1.1\r\nHost: WD-1 host:80\r\nConnection: close\r\n\r\n";



for the final setup I would recommend changing to hostnames (the idea also came from engolling). Sometimes users don't have access to ip management... Or they could change because of a dhcp server, that cannot be switched off.

(08-06-2018, 22:05)t3gathome Wrote:  If we want to use a concatenated String variable (let's assume: "WD-"+X) as Hostname, than we can use these two assignments:

if (wifi.createTCP(mux_id, "WD-"+String(variableX), 80, 0)) {

String s_VariableX = String(variableX);
char *prefix = "GET / HTTP/1.1\r\nHost: WD-";
char *postfix =" host:80\r\nConnection: close\r\n\r\n"; 
String url = prefix +s_VariableX+ postfix;
const char *get_json = url.c_str(); //this whole thing can be done once as init also... --> then I think we can save microcontroller cycles!


I hope this helps you a bit for convincing to switch to hostnames Wink

At least in my local network, no matter the host name I define for each WD unit, it isn't work. I can only reach them when using their IP address.
Anyway, if it is working for you, instead of an IP address you can use an host name. Everything you put between " " will be used as the host name:

if (wifi.createTCP(WIFIunit_address [0] [i], 80, 0))

Code:
//---------------------------------------------------------
//    Enable / Disable getting Temperature / Humidity from WiFI sensors (Usually the local T/H sensor on Wireless Display units)
//---------------------------------------------------------
#define ENABLE_TH_FROM_WIFISENSORS     1                        // 1= Enable, 0= Disable

                                                                // Sequencial list of WiFi sensors addresses. Don't leave holes
const char* WIFIunit_address [][4]= { "192.168.1.154"            // IP address of first WiFi sensor
                                   , "192.168.1.153"            // IP address of second WiFi sensor
                                   , "0"                        // IP address of third WiFi sensor
                                   , "0"                        // IP address of fourth WiFi sensor
                                   };


Per example, instead of 192.168.1.154 you can put there "WD-1". Unused sensors SHOULD start by ZERO

I already sent to your email a test version (Pro2 PLUS and WD software)

Reply


Messages In This Thread
[Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 04-06-2018, 23:36
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 05-06-2018, 22:12
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 05-06-2018, 22:24
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 05-06-2018, 22:36
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 05-06-2018, 22:49
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 05-06-2018, 22:41
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 06-06-2018, 20:34
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 07-06-2018, 03:23
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by markkkk42 - 07-06-2018, 06:26
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 07-06-2018, 19:19
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 07-06-2018, 21:03
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 08-06-2018, 03:15
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 08-06-2018, 20:37
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 08-06-2018, 22:05
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 09-06-2018, 02:16
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by engolling - 10-06-2018, 22:04
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 12-06-2018, 21:59
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by engolling - 13-06-2018, 20:52
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 11-06-2018, 00:56
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 12-06-2018, 22:10
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 12-06-2018, 22:17
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 12-06-2018, 22:33
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 13-06-2018, 23:32
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 13-06-2018, 23:37
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 14-06-2018, 01:22
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 25-06-2018, 17:16
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 25-06-2018, 23:24
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 20-06-2018, 22:27
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 01-07-2018, 19:36
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 25-06-2018, 17:10
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 03-07-2018, 15:41
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 04-07-2018, 22:54
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by t3gathome - 08-07-2018, 21:02
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by werk_ag - 08-07-2018, 23:17
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by uncle_bob - 09-07-2018, 08:56
RE: [Pro2 Plus RX] Integrating RESTful Sensor Data - working solution for local wifi/www - by hornychz - 08-07-2018, 23:40



Users browsing this thread: 1 Guest(s)