I'm trying to use the arduino to talk to a networked power strip
See connection information here http://www.synaccess-net.com/downloadDoc/NPStartup-B.pdf
I've connected but cannot seem to send user and password
Any ideas where to start?
I'm trying to use the arduino to talk to a networked power strip
See connection information here http://www.synaccess-net.com/downloadDoc/NPStartup-B.pdf
I've connected but cannot seem to send user and password
Any ideas where to start?
Any ideas where to start?
Yes post the code that contains your failed attempt at sending a password.
I'm modifing some example code,
I've removed the IP address of server and the user name and password in the code below
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(00,00,00,00);
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192,168,0,177);
EthernetClient client;
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
Ethernet.begin(mac, ip);
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
if (client.connect(server,90)) {
Serial.println("connected");
client.println("GET /cmd.cgi?$A1 username password");
}
else {
Serial.println("connection failed");
}
}
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
while (Serial.available()>0){
char inChar=Serial.read();
if(client.connected()){
client.print(inChar);
}
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
while(true);
}
}
Yields:
connecting...
connected
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="Protected"
Connection: close
401 Unauthorized: Password required
disconnecting.
Spaces and dollar signs are not allowed in a url. Maybe if you url encode them it would work
client.println("GET /cmd.cgi?%26A1%20username%20password");
Interesting, I tried your suggestion and while this may be unrelated I'm now getting the follow response
connecting...
connected
HTTP/1.1 414 Request-URI Too Long
Connection: close
414 Request-URI Too Long: Buffer overflow detected
disconnecting.
The startup guide is not very clear. It contains url errors, so it may be a matter of trial and error. Start with this:
client.println("GET /cmd.cgi?cmdCode=%26A1&Arg1=username&Arg2=password");
...and this:
client.println("GET /cmd.cgi?%26A1&username&password");
edit: If those fail, try accessing the power strip with a web browser.
http://device-ip
Then view the source of the login page. That might get you the info you need.
Yeah the guide is bad, most of the commands work when typed in the browser like the $A5 command returns 0000 0001 etc
the $A1 gives a $AF response indicating an error
Did you try viewing the source of the login page? The guide says
http://192.168.1.100
Then select "view source" on the browser tools. I don't know what web browser you use and they are different in the way you view the source, but on that page there should be a login form. If you post that, maybe we can help you determine how to get your Arduino to login.