Username and Password in Json Home Automation


#1

Hi guys,
Very new to Json and have been given a file that I have managed to modify slightly for my needs.
It somehow sends a command to my Domoticz Home automation from an Arduino with Ethernet, to switch on a switch, I will be adding more info to the file soon,however my Domoticz requires a password to enable the switch to change state, but I cannot find anywhere how to include this info, I am attaching the script in the hope someone can assist
many thanks
// SPI and Ethernet is needed for Ethernet shield

#include <SPI.h>
#include <Ethernet.h>

//DEBUG 1 Sends output to SerialPort

#define DEBUG 1
#define OPEN 1 // HIGH
#define CLOSED 0 // LOW
#define UNKNOWN 2 // — reset / force update

//INPUT PIN Numbers on Arduino
#define PIN_MUTFAK_SU 2

// Last Status of the Sensors
int MUTFAK_SUStatus = UNKNOWN;

// IDX numbers of PIR and Reed Contacts on Domoticz-Devices Page

int IDX_Hall_sensor = 517;

// Arduino MAC ve IP addresses

byte mac = {
xxxx, xxxx, xxxx, xxxx, xxxx, xxxx};//Random address
IPAddress ip(192,168,x,xxx); //IP Address of Arduino

IPAddress domoticz(192,168,x,xxx:domoticz); // Domoticz IP Address
int port = xxxx; // Domoticz Port No
EthernetClient client;

//httprequest functions, sends status info to Domoticz

// /json.htm?type=command&param=switchlight&idx=XX&switchcmd=On
void httpRequestswitch(int IDX, String status) {
// When the connection is successful:
if (client.connect(domoticz, port)) {
#if DEBUG
Serial.print(“GET /json.htm?type=command&param=switchlight&idx=”);
Serial.print(IDX);
Serial.print("&switchcmd=");
Serial.println(status);
#endif
client.print( “GET /json.htm?type=command&param=switchlight&idx=”);
client.print(IDX);
client.print("&switchcmd=");
client.print(status);
client.println( " HTTP/1.1");
client.print( "Host: ");
client.println(ip);
client.println( “Connection: close”);
client.println();

client.println();
client.stop();
delay(150);

}
else {
client.stop();
}
}