Mitsubishi Klimaanlage per API steuern mit MAC-567IF-E1 (Lösung)
benötigte Hardware: MAC-567IF-E1 (kostet im Netz zwischen 70 und 120€)
beigefügtes Script an den fett markierten Stellen anpassen
- Login Name
- Login Passwort
- DeviceID
dann über den NEO CREATOR auftrufen mit
http://[myServerIP]/Power.php?state=true <- schaltet die Klimaanlage ein
http://[myServerIP]/Power.php?state=false <- schaltet die Klimaanlage aus
folgendes PHP-Script auf einem WebServer ablegen:
//Parameters
$username = 'melCloud_email';
$password = 'melCloud_Password';
$loginurl = 'https://app.melcloud.com/Mitsubishi.Wifi.Client/Login/ClientLogin';
$url= 'https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/SetAta';
$appversion = "1.7.1.0";
$ch = curl_init();
//Curl options
curl_setopt($ch, CURLOPT_URL, $loginurl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'Email='.$username.'&password='.$password.'&AppVersion='.$appversion);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
//execute the the login
$login = curl_exec($ch);
$data = json_decode($login);
$token = $data->LoginData->ContextKey;
//print_r($token);
//execute the request (get info)
$ch = curl_init();
//Curl options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$state=$_GET['state'];
curl_setopt($ch, CURLOPT_POSTFIELDS, 'Power='.$state.'&DeviceID=123245678&EffectiveFlags=1&HasPendingCommand=true');
//Add the token in the request
$headers = array(
'X-MitsContextKey: ' . $token,
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//Execute
$response = curl_exec($ch);
curl_close($ch);
//Print the result in output
$response_json = json_decode($response, true);
print_r($response_json);
echo ("
Power set to '".$_GET['state']."'");
?>
Status:
Open Jan 23, 2022 - 21:59
AIO CREATOR NEO