host = $host;
$this->username = $username;
$this->password = $password;
}
function login()
{
$data = '';
$response = $this->doRequest($data);
$a = $response->attributes();
$this->sessionId = $a->SessionId;
$this->configurationVersion = $a->CurrentConfigurationVersion;
}
function doRequest($data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://'.$this->host.'/cmd');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
$xml = new SimpleXMLElement($output);
return $xml;
}
function getInformation()
{
$data = '';
$response = $this->doRequest($data);
return $response->ShcInformation;
}
function getAllLogicalDeviceStates()
{
$data = '';
$response = $this->doRequest($data);
return $response->States;
}
function getConfiguration()
{
$data = '';
$response = $this->doRequest($data);
return $response;
}
function switchActuator($logicalDeviceId, $on)
{
$data = '
'.$logicalDeviceId.'
'.($on?'true':'false').'
';
$response = $this->doRequest($data);
}
function setPointTemperature($logicalDeviceId, $pointTemperature)
{
$data = '
'.$logicalDeviceId.'
'.$pointTemperature.'
';
$response = $this->doRequest($data);
}
}