Mitsubishi Klimaanlage MELCLOUD

Steuert jemand auch seine Ecodan Wärmepumpe hiermit?

Gesendet von meinem SM-G975F mit Tapatalk

Hi Chris,

vielen Dank für den Denkanstoß. Der OperationMode für „Entfeuchten“ ist 2 und war in Deinem Profil noch nicht enthalten. Hab’ ich einfach ergänzt. :smiley:

Viele Grüße

Nico

Hi Nico!

Danke für die Rückmeldung und die Info zum Operation-Mode 2 - hab ich auf die 2do vom Modul geschrieben und kommt irgendwann in den Code rein. Aber schön, dass du dir temporär selbst helfen konntest :slight_smile:

Viele Grüße,
Chris

Hallo Chris,
vielen Dank für das Modul!
Hat ohne Probleme sofort funktioniert.
Nur wenn ich in der Instanz etwas abändere (z.B. „zusätzliche Variablen mit System-Informationen anzeigen“) kommt folgende Fehlermeldung:
Melcloud.JPG
Das nur zur Info!
Funktioniert trotzdem alles…

Hi Conan!

Danke für das Feedback!

Leider kann ich das Problem nicht nachvollziehen/verstehen.
Welche IPS-Version hast du im Einsatz und auf welcher Hardware/Betriebssystem? Stimmt das mit IPS 5.3 auf Raspberry Pi4 - was in deiner Signatur steht?

Denn es gibt im Modul nur ein Integer-Variablenprofil mit Min-/Max-Wert. Dort ist -100 der Minimalwert und -30 der Maximalwert. Eventuell hat hier die von dir verwendete IPS-Version ein Problem mit negativen Integer-Werten? :confused:

Schau dir bitte mal in deinem IPS das Integer-Variablenprofil „MEL.WifiSignalStrength“ an. Steht da -100 als Minimalwert und -30 als Maximalwert drin?

Viele Grüße,
Chris

Hi Chris,
ja… ich nutze IPS 5.3 auf einem Raspberry Pi4!
Das Profil sieht so aus:

Dank dir
Gruß
Bernd

muss ich des verstehen?

wenn ich den Befehl über Fiddle ausführe (auch wiederhole) funktioniert es und ich kann die Temperatur in der Wärmepumpe setzen. Wenn ich dies aber in Symcon nachbaue erhalte ich immer: The requested URL returned error: 500 Internal Server Error

was mach ich falsch :frowning:

FIDDLE:

POST https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/SetAtw HTTP/1.1
Host: app.melcloud.com
Connection: keep-alive
Content-Length: 1971
Accept: application/json, text/javascript, */*; q=0.01
X-MitsContextKey: 53D50CCE9EA84EC48E931F31B212E1
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Content-Type: application/json; charset=UTF-8
Origin: https://app.melcloud.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://app.melcloud.com/
Accept-Encoding: gzip, deflate, br
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: policyaccepted=true

{"EffectiveFlags":8589934720,"LocalIPAddress":null,"SetTemperatureZone1":18.5,"SetTemperatureZone2":20,"RoomTemperatureZone1":23,"RoomTemperatureZone2":23,"OperationMode":0,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-04T00:00:00","Sunrise":"2020-07-04T05:25:00","Sunset":"2020-07-04T21:28:00","Condition":116,"ID":338612365,"Humidity":88,"Temperature":13,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":6,"WeatherType":0},{"Date":"2020-07-04T03:00:00","Sunrise":"2020-07-04T05:25:00","Sunset":"2020-07-04T21:28:00","Condition":116,"ID":338612366,"Humidity":93,"Temperature":10,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":5,"WeatherType":2},{"Date":"2020-07-04T15:00:00","Sunrise":"2020-07-04T05:25:00","Sunset":"2020-07-04T21:28:00","Condition":116,"ID":338612370,"Humidity":47,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":6,"WeatherType":1},{"Date":"2020-07-05T03:00:00","Sunrise":"2020-07-05T05:26:00","Sunset":"2020-07-05T21:27:00","Condition":116,"ID":339094990,"Humidity":92,"Temperature":13,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":6,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":20,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":21,"SetCoolFlowTemperatureZone2":16,"HCControlType":1,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":17,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-03T21:44:01.167","NextCommunication":"2020-07-03T21:45:01.167","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}

Symcon:

$headers = array();
$headers[] = 'Host: app.melcloud.com';
$headers[] = 'Connection: keep-alive';
$headers[] = 'Content-Length: 1218';
$headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
$headers[] = 'X-MitsContextKey: ' . $token; // . $token; //53D50CCE9EA84EC48E931F31B212E1';// . $token; //53D50CCE9EA84EC48E931F31B212E1
$headers[] = 'X-Requested-With: XMLHttpRequest';
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36';
$headers[] = 'Content-Type: application/json; charset=UTF-8';
$headers[] = 'Origin: https://app.melcloud.com';
$headers[] = 'Sec-Fetch-Site: same-origin';
$headers[] = 'Sec-Fetch-Mode: cors';
$headers[] = 'Sec-Fetch-Dest: empty';
$headers[] = 'Referer: https://app.melcloud.com/';
$headers[] = 'Accept-Encoding: gzip, deflate, br';
$headers[] = 'Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7';
$headers[] = 'Cookie: policyaccepted=true';

$POSTfieldsTMP = '{"EffectiveFlags":8589934720,"LocalIPAddress":null,"SetTemperatureZone1":16.5,"SetTemperatureZone2":20,"RoomTemperatureZone1":23,"RoomTemperatureZone2":23,"OperationMode":0,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-04T00:00:00","Sunrise":"2020-07-04T05:25:00","Sunset":"2020-07-04T21:28:00","Condition":116,"ID":338612365,"Humidity":88,"Temperature":13,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":6,"WeatherType":0}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":20,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":21,"SetCoolFlowTemperatureZone2":16,"HCControlType":1,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":16,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-03T22:15:00.99","NextCommunication":"2020-07-03T22:16:00.99","Power":true,"HasPendingCommand":true,"Offline":false,"Scene":null,"SceneOwner":null}';

            $curl = curl_init('https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/SetAta');
            //curl_setopt($curl, CURLOPT_URL, $url);
			curl_setopt($curl, CURLOPT_HEADER, false);
            curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
            //curl_setopt($curl, CURLOPT_USERAGENT, $agent);
            curl_setopt($curl, CURLOPT_FAILONERROR, true);
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $POSTfieldsTMP);
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 2);
            curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 5000);
			curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
            curl_setopt($curl, CURLOPT_TIMEOUT_MS, 20000);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
			
            $data = curl_exec($curl);
            print_r($data);

Was du falsch machst? Du lässt mir keine Zeit :smiley: :wink: :stuck_out_tongue:

Ich schau mir das heute an und dann bekommen wir das schon hin :slight_smile:

Viele Grüße,
Chris

PS: Bitte da nicht zu viel an der API „rumspielen“ - bevor die irgendwann da noch richtig was umbauen und gar nichts mehr geht, wäre dann doof :wink:

Oke oke [emoji41] danke

Gesendet von meinem SM-G975F mit Tapatalk

Hallo Zusammen,

anbei sieht man ein Beispiel wie ich meine Wärmepumpe gerade im Sommer zum Kühlen und Warmwasser erzeugen steuere.
Ist zwar ziemlich durty programmiert, aber ich hoffe auf die Modulanpassung von Chris noch :-).
Vielleicht hilft es jemand.

Ansonsten kann mir vielleicht noch jemand erklären wie man die Bytes berechnen muss für das EffectiveFlags? Damit ich die Puffertemperatur anheben kann? Da ich dies über Fiddle nicht auslesen kann, da dies in der Melcloud Oberfläche nicht zu konfigurieren ist.

<?php

$s = IPS_GetScript(27365 /*[Heizung\MelCloud\module]*/);
include($s['ScriptFile']);
//Parameters
$username = 'xxxxx';
$password = 'xxxxx';
$loginurl = 'https://app.melcloud.com/Mitsubishi.Wifi.Client/Login/ClientLogin';
$url = 'https://app.melcloud.com/Mitsubishi.Wifi.Client/User/ListDevices/';
$appversion = "1.7.1.0";
$ch = curl_init();
$prognose = GetValue(50416 /*[Photovoltaik\Prognose\aktuelle Prognose]*/);
$Einspeisung10min = GetValue(10550 /*[Photovoltaik\Einspeisung letze 10min]*/);
$Einspeisung5min = GetValue(18209 /*[Photovoltaik\Einspeisung letzte 5min]*/);
$WPaufStrompause = GetValueBoolean(53603 /*[Heizung\MelCloud\Wärmepumpe auf Strompause]*/);
$WPZustand = GetValue(55605 /*[Heizung\MelCloud\Modus]*/);
$Update0 = False;
$Update1 = False;
$Update2 = False;
$Rücklauftemp = GetValue(59921 /*[Heizung\MelCloud\Rücklauftemp]*/);
$time = date("H:i");
echo $time . " Uhr ";

$taupunkt = max(GetValue(42601 /*[Heizung\Taupunkt Bad]*/), GetValue(43195 /*[Heizung\Taupunkt Esszimmer]*/), GetValue(48756 /*[Heizung\Taupunkt Wohnzimmer]*/));
echo " TauPunkt: " . round($taupunkt) . " ";
echo "Einspeisung10min: " . $Einspeisung10min . " Einspeisung5min: " . $Einspeisung5min . " Prognose: " . $prognose . " Strompause: " . $WPaufStrompause;

If ($WPaufStrompause == True)
{
    $timeout = 3600; //60 Minuten
    $watch = IPS_GetVariable(53603 /*[Heizung\MelCloud\Wärmepumpe auf Strompause]*/);

    if(($watch['VariableUpdated'] + $timeout) < time())
	{
	setValueBoolean (53603 /*[Heizung\MelCloud\Wärmepumpe auf Strompause]*/, False);
	}
}


//Wenn Warmwasser warm gemacht wird nichts unternehmen
If ($WPZustand <> 1)
{
 
 //Wenn WP aus, prüfen ob sich einschalten lohnt
 If ($WPZustand == 0 and $WPZustand <> 3)
 {
 	 
	 If ($Einspeisung10min > 3000 and $prognose > 4000 and $WPaufStrompause == False and GetValue(20166 /*[Heizung\Warmwasserboiler\Temperatur]*/) <= 43)
	 { 
	 $Update0 = True;
     $Content_Length0 = 1970;
     $POSTfieldsTMP0 = '{"EffectiveFlags":1,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":20,"RoomTemperatureZone1":22,"RoomTemperatureZone2":22,"OperationMode":0,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-28T12:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484897,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":0},{"Date":"2020-07-28T15:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484898,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":1},{"Date":"2020-07-29T03:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":176,"ID":350989814,"Humidity":75,"Temperature":18,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":2,"WeatherType":2},{"Date":"2020-07-29T15:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":116,"ID":350989818,"Humidity":44,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":3,"WeatherType":1}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":23,"SetCoolFlowTemperatureZone2":23,"HCControlType":1,"TankWaterTemperature":36,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-28T10:50:01.04","NextCommunication":"2020-07-28T10:51:01.04","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
     
	 
	 //Warmwasser erzeugen
     $Update1 = True;
     $Content_Length1 = 1977;
     $POSTfieldsTMP1 = '{"EffectiveFlags":65536,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":20,"RoomTemperatureZone1":22,"RoomTemperatureZone2":22,"OperationMode":0,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-28T12:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484897,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":0},{"Date":"2020-07-28T15:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484898,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":1},{"Date":"2020-07-29T03:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":176,"ID":350989814,"Humidity":75,"Temperature":18,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":2,"WeatherType":2},{"Date":"2020-07-29T15:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":116,"ID":350989818,"Humidity":44,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":3,"WeatherType":1}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":23,"SetCoolFlowTemperatureZone2":23,"HCControlType":1,"TankWaterTemperature":36,"SetTankWaterTemperature":43,"ForcedHotWaterMode":"true","UnitStatus":0,"OutdoorTemperature":28,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-28T11:05:01.997","NextCommunication":"2020-07-28T11:06:01.997","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
	 echo "WP in Warmwasserbetrieb schalten";
	 setValueBoolean (32449 /*[Heizung\MelCloud\Warmwasser heute gemacht?]*/, True);
	 
	 }
	 else If ($Einspeisung10min > 3000 and $prognose > 4000 and $WPaufStrompause == False and (GetValue(48582 /*[Heizung\Thermo Esszimmer\TEMPERATURE]*/) >= 22.5 or GetValue(17671 /*[Heizung\Thermo Wohnzimmer\TEMPERATURE]*/) >= 23))
	 {
	 
     //Einschalten
     $Update0 = True;
     $Content_Length0 = 1970;
     $POSTfieldsTMP0 = '{"EffectiveFlags":1,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":20,"RoomTemperatureZone1":22,"RoomTemperatureZone2":22,"OperationMode":0,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-28T12:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484897,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":0},{"Date":"2020-07-28T15:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484898,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":1},{"Date":"2020-07-29T03:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":176,"ID":350989814,"Humidity":75,"Temperature":18,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":2,"WeatherType":2},{"Date":"2020-07-29T15:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":116,"ID":350989818,"Humidity":44,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":3,"WeatherType":1}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":23,"SetCoolFlowTemperatureZone2":23,"HCControlType":1,"TankWaterTemperature":36,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-28T10:50:01.04","NextCommunication":"2020-07-28T10:51:01.04","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
     
     

	 //Kühlen aktivieren
	 $Update1 = True;
     $Content_Length1 = 1993;
	 $POSTfieldsTMP1 = '{"EffectiveFlags":8,"LocalIPAddress":null,"SetTemperatureZone1":22,"SetTemperatureZone2":10,"RoomTemperatureZone1":22.5,"RoomTemperatureZone2":22.5,"OperationMode":3,"OperationModeZone1":3,"OperationModeZone2":4,"WeatherObservations":[{"Date":"2020-07-22T21:00:00","Sunrise":"2020-07-22T05:45:00","Sunset":"2020-07-22T21:14:00","Condition":176,"ID":347480172,"Humidity":70,"Temperature":20,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":0},{"Date":"2020-07-23T03:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982190,"Humidity":81,"Temperature":16,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":2},{"Date":"2020-07-23T15:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982194,"Humidity":45,"Temperature":26,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":4,"WeatherType":1},{"Date":"2020-07-24T03:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479382,"Humidity":69,"Temperature":17,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":4,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":20,"SetCoolFlowTemperatureZone2":10,"HCControlType":2,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":"","Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":false,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":false,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-22T18:00:57.627","NextCommunication":"2020-07-22T18:01:57.627","Power":true,"HasPendingCommand":true,"Offline":false,"Scene":null,"SceneOwner":null}';            
	 //Temperatur einstellen
     $Update2 = True;
	 $Content_Length2 = 1984;
	 $POSTfieldsTMP2 = '{"EffectiveFlags":8589934720,"LocalIPAddress":null,"SetTemperatureZone1":22,"SetTemperatureZone2":20,"RoomTemperatureZone1":22,"RoomTemperatureZone2":22,"OperationMode":2,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-23T18:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":116,"ID":347982195,"Humidity":58,"Temperature":22,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":4,"WeatherType":0},{"Date":"2020-07-24T03:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479382,"Humidity":86,"Temperature":14,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":4,"WeatherType":2},{"Date":"2020-07-24T15:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479386,"Humidity":45,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":5,"WeatherType":1},{"Date":"2020-07-25T03:00:00","Sunrise":"2020-07-25T05:49:00","Sunset":"2020-07-25T21:10:00","Condition":176,"ID":348979190,"Humidity":92,"Temperature":12,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":5,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":20,"SetCoolFlowTemperatureZone2":10,"HCControlType":1,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":24,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":false,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-23T16:26:57.707","NextCommunication":"2020-07-23T16:27:57.707","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
	 echo "WP in Kühlbetrieb schalten";
	 }
	 else if(($time >= "19:00") && ($time < "21:00") and GetValue(32449 /*[Heizung\MelCloud\Warmwasser heute gemacht?]*/ == False and GetValue(20166 /*[Heizung\Warmwasserboiler\Temperatur]*/) <= 40))
	 {
	 $Update0 = True;
     $Content_Length0 = 1970;
     $POSTfieldsTMP0 = '{"EffectiveFlags":1,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":20,"RoomTemperatureZone1":22,"RoomTemperatureZone2":22,"OperationMode":0,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-28T12:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484897,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":0},{"Date":"2020-07-28T15:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484898,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":1},{"Date":"2020-07-29T03:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":176,"ID":350989814,"Humidity":75,"Temperature":18,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":2,"WeatherType":2},{"Date":"2020-07-29T15:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":116,"ID":350989818,"Humidity":44,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":3,"WeatherType":1}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":23,"SetCoolFlowTemperatureZone2":23,"HCControlType":1,"TankWaterTemperature":36,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-28T10:50:01.04","NextCommunication":"2020-07-28T10:51:01.04","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
     
	 
	 //Warmwasser erzeugen
     $Update1 = True;
     $Content_Length1 = 1977;
     $POSTfieldsTMP1 = '{"EffectiveFlags":65536,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":20,"RoomTemperatureZone1":22,"RoomTemperatureZone2":22,"OperationMode":0,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-28T12:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484897,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":0},{"Date":"2020-07-28T15:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484898,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":1},{"Date":"2020-07-29T03:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":176,"ID":350989814,"Humidity":75,"Temperature":18,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":2,"WeatherType":2},{"Date":"2020-07-29T15:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":116,"ID":350989818,"Humidity":44,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":3,"WeatherType":1}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":23,"SetCoolFlowTemperatureZone2":23,"HCControlType":1,"TankWaterTemperature":36,"SetTankWaterTemperature":43,"ForcedHotWaterMode":"true","UnitStatus":0,"OutdoorTemperature":28,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-28T11:05:01.997","NextCommunication":"2020-07-28T11:06:01.997","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
	 echo "WP in Warmwasserbetrieb schalten";
	 setValueBoolean (32449 /*[Heizung\MelCloud\Warmwasser heute gemacht?]*/, True);
	 
	 }
 }
 //Wenn WP auf Kühlbetrieb prüfen ob ausschalten
 
	 IF (($Einspeisung5min < 100 or $Rücklauftemp <= $taupunkt or (GetValue(48582 /*[Heizung\Thermo Esszimmer\TEMPERATURE]*/) <= 22.0 or GetValue(17671 /*[Heizung\Thermo Wohnzimmer\TEMPERATURE]*/) <= 22.5)) and $WPZustand <> 0)
		 {
		 //Heizen also WP ausschalten
		 //$POSTfieldsTMP = '{"EffectiveFlags":8589934720,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":20,"RoomTemperatureZone1":22.5,"RoomTemperatureZone2":22.5,"OperationMode":0,"OperationModeZone1":1,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-22T21:00:00","Sunrise":"2020-07-22T05:45:00","Sunset":"2020-07-22T21:14:00","Condition":176,"ID":347480172,"Humidity":70,"Temperature":20,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":0},{"Date":"2020-07-23T03:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982190,"Humidity":81,"Temperature":16,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":2},{"Date":"2020-07-23T15:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982194,"Humidity":45,"Temperature":26,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":4,"WeatherType":1},{"Date":"2020-07-24T03:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479382,"Humidity":69,"Temperature":17,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":4,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":20,"SetCoolFlowTemperatureZone2":19,"HCControlType":1,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":27,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-22T17:37:57.017","NextCommunication":"2020-07-22T17:38:57.017","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
		 
         //Ausschalten
         $Content_Length0 = 1974;
         $POSTfieldsTMP0 = '{"EffectiveFlags":1,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":20,"RoomTemperatureZone1":22,"RoomTemperatureZone2":22,"OperationMode":0,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-28T12:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484897,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":0},{"Date":"2020-07-28T15:00:00","Sunrise":"2020-07-28T05:52:00","Sunset":"2020-07-28T21:06:00","Condition":116,"ID":350484898,"Humidity":50,"Temperature":28,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":2,"WeatherType":1},{"Date":"2020-07-29T03:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":176,"ID":350989814,"Humidity":75,"Temperature":18,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":2,"WeatherType":2},{"Date":"2020-07-29T15:00:00","Sunrise":"2020-07-29T05:54:00","Sunset":"2020-07-29T21:05:00","Condition":116,"ID":350989818,"Humidity":44,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":3,"WeatherType":1}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":23,"SetCoolFlowTemperatureZone2":23,"HCControlType":1,"TankWaterTemperature":36.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":true,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-28T10:51:01.133","NextCommunication":"2020-07-28T10:52:01.133","Power":false,"HasPendingCommand":true,"Offline":false,"Scene":null,"SceneOwner":null}';
         $Update0 = True;
         
         
         //$Content_Length = 1994;
		 //$POSTfieldsTMP = '{"EffectiveFlags":8,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":10,"RoomTemperatureZone1":22.5,"RoomTemperatureZone2":22.5,"OperationMode":3,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-22T21:00:00","Sunrise":"2020-07-22T05:45:00","Sunset":"2020-07-22T21:14:00","Condition":176,"ID":347480172,"Humidity":70,"Temperature":20,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":0},{"Date":"2020-07-23T03:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982190,"Humidity":81,"Temperature":16,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":2},{"Date":"2020-07-23T15:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982194,"Humidity":45,"Temperature":26,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":4,"WeatherType":1},{"Date":"2020-07-24T03:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479382,"Humidity":69,"Temperature":17,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":4,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":20,"SetCoolFlowTemperatureZone2":10,"HCControlType":1,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":"","Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":false,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":false,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-22T17:59:57.303","NextCommunication":"2020-07-22T18:00:57.303","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
		 
		 //$Content_Length1 = 1984;
		 //$POSTfieldsTMP1 = '{"EffectiveFlags":8589934720,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":20,"RoomTemperatureZone1":22,"RoomTemperatureZone2":22,"OperationMode":2,"OperationModeZone1":0,"OperationModeZone2":1,"WeatherObservations":[{"Date":"2020-07-23T18:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":116,"ID":347982195,"Humidity":58,"Temperature":22,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":4,"WeatherType":0},{"Date":"2020-07-24T03:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479382,"Humidity":86,"Temperature":14,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":4,"WeatherType":2},{"Date":"2020-07-24T15:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479386,"Humidity":45,"Temperature":24,"Icon":"wsymbol_0002_sunny_intervals","ConditionName":"Partly Cloudy","Day":5,"WeatherType":1},{"Date":"2020-07-25T03:00:00","Sunrise":"2020-07-25T05:49:00","Sunset":"2020-07-25T21:10:00","Condition":176,"ID":348979190,"Humidity":92,"Temperature":12,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":5,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":20,"SetCoolFlowTemperatureZone2":10,"HCControlType":1,"TankWaterTemperature":43.5,"SetTankWaterTemperature":45,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":24,"EcoHotWater":true,"Zone1Name":null,"Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":true,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":false,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-23T16:26:57.707","NextCommunication":"2020-07-23T16:27:57.707","Power":true,"HasPendingCommand":false,"Offline":false,"Scene":null,"SceneOwner":null}';
		 
         echo "WP ausschalten";
		 If ($WPaufStrompause == False)
			 {
			 setValueBoolean (53603 /*[Heizung\MelCloud\Wärmepumpe auf Strompause]*/, True);
			 }
		 }
		 
		 
		 


If ($Update0 == True)
{
//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);


			

//Warmwasser erhöhen
//$POSTfieldsTMP = '{"EffectiveFlags":8,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":10,"RoomTemperatureZone1":22.5,"RoomTemperatureZone2":22.5,"OperationMode":3,"OperationModeZone1":3,"OperationModeZone2":4,"WeatherObservations":[{"Date":"2020-07-22T21:00:00","Sunrise":"2020-07-22T05:45:00","Sunset":"2020-07-22T21:14:00","Condition":176,"ID":347480172,"Humidity":70,"Temperature":20,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":0},{"Date":"2020-07-23T03:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982190,"Humidity":81,"Temperature":16,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":2},{"Date":"2020-07-23T15:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982194,"Humidity":45,"Temperature":26,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":4,"WeatherType":1},{"Date":"2020-07-24T03:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479382,"Humidity":69,"Temperature":17,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":4,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":20,"SetCoolFlowTemperatureZone2":10,"HCControlType":2,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":"","Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":false,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":false,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-22T18:00:57.627","NextCommunication":"2020-07-22T18:01:57.627","Power":true,"HasPendingCommand":true,"Offline":false,"Scene":null,"SceneOwner":null}';            
//$Content_Length = 1993;			
		
		
$headers = array();
$headers[] = 'Host: app.melcloud.com';
$headers[] = 'Connection: keep-alive';
$headers[] = 'Content-Length: ' . $Content_Length0;
$headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
$headers[] = 'X-MitsContextKey: ' . $token;
$headers[] = 'X-Requested-With: XMLHttpRequest';
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36';
$headers[] = 'Content-Type: application/json; charset=UTF-8';
$headers[] = 'Origin: https://app.melcloud.com';
$headers[] = 'Sec-Fetch-Site: same-origin';
$headers[] = 'Sec-Fetch-Mode: cors';
$headers[] = 'Sec-Fetch-Dest: empty';
$headers[] = 'Referer: https://app.melcloud.com/';
$headers[] = 'Accept-Encoding: gzip, deflate, br';
$headers[] = 'Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7';
$headers[] = 'Cookie: policyaccepted=true';


			$curl = curl_init('https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/SetAtw');
            curl_setopt($curl, CURLOPT_HEADER, false);
            curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($curl, CURLOPT_FAILONERROR, true);
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $POSTfieldsTMP0);
            curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 5000);
			curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
            curl_setopt($curl, CURLOPT_TIMEOUT_MS, 20000);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
			
            $data = curl_exec($curl);
            
			
                

        if (curl_error($curl) !== '') {
            $cURL_Error = curl_error($curl);
			echo $cURL_Error;
            $this->SendDebug(__FUNCTION__, $this->Translate('ERROR // Connection to the MELCloud failed // cURL Error = ' . $cURL_Error), 0);
            IPS_LogMessage('MELCloud-' . __FUNCTION__, $this->Translate('ERROR // Connection to the MELCloud failed // cURL Error = ') . $cURL_Error);
            curl_close($curl);
            return false;
        }

        $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);

        if ($data === false) {
            $this->Debug_OutputGenerate($this->Translate('ERROR when sending data'), $http_code);
            return false;
        }

        $dataAR = json_decode($data, true);
		
		
}	
		
		
		
If ($Update1 == True)
{	
IPS_SLEEP(2000);	
		
		//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);


			

//Warmwasser erhöhen
//$POSTfieldsTMP = '{"EffectiveFlags":8,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":10,"RoomTemperatureZone1":22.5,"RoomTemperatureZone2":22.5,"OperationMode":3,"OperationModeZone1":3,"OperationModeZone2":4,"WeatherObservations":[{"Date":"2020-07-22T21:00:00","Sunrise":"2020-07-22T05:45:00","Sunset":"2020-07-22T21:14:00","Condition":176,"ID":347480172,"Humidity":70,"Temperature":20,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":0},{"Date":"2020-07-23T03:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982190,"Humidity":81,"Temperature":16,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":2},{"Date":"2020-07-23T15:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982194,"Humidity":45,"Temperature":26,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":4,"WeatherType":1},{"Date":"2020-07-24T03:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479382,"Humidity":69,"Temperature":17,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":4,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":20,"SetCoolFlowTemperatureZone2":10,"HCControlType":2,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":"","Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":false,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":false,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-22T18:00:57.627","NextCommunication":"2020-07-22T18:01:57.627","Power":true,"HasPendingCommand":true,"Offline":false,"Scene":null,"SceneOwner":null}';            
//$Content_Length = 1993;			
		
		
$headers = array();
$headers[] = 'Host: app.melcloud.com';
$headers[] = 'Connection: keep-alive';
$headers[] = 'Content-Length: ' . $Content_Length1;
$headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
$headers[] = 'X-MitsContextKey: ' . $token;
$headers[] = 'X-Requested-With: XMLHttpRequest';
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36';
$headers[] = 'Content-Type: application/json; charset=UTF-8';
$headers[] = 'Origin: https://app.melcloud.com';
$headers[] = 'Sec-Fetch-Site: same-origin';
$headers[] = 'Sec-Fetch-Mode: cors';
$headers[] = 'Sec-Fetch-Dest: empty';
$headers[] = 'Referer: https://app.melcloud.com/';
$headers[] = 'Accept-Encoding: gzip, deflate, br';
$headers[] = 'Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7';
$headers[] = 'Cookie: policyaccepted=true';


			$curl = curl_init('https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/SetAtw');
            curl_setopt($curl, CURLOPT_HEADER, false);
            curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($curl, CURLOPT_FAILONERROR, true);
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $POSTfieldsTMP1);
            curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 5000);
			curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
            curl_setopt($curl, CURLOPT_TIMEOUT_MS, 20000);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
			
            $data = curl_exec($curl);
            
			
                

        if (curl_error($curl) !== '') {
            $cURL_Error = curl_error($curl);
			echo $cURL_Error;
            $this->SendDebug(__FUNCTION__, $this->Translate('ERROR // Connection to the MELCloud failed // cURL Error = ' . $cURL_Error), 0);
            IPS_LogMessage('MELCloud-' . __FUNCTION__, $this->Translate('ERROR // Connection to the MELCloud failed // cURL Error = ') . $cURL_Error);
            curl_close($curl);
            return false;
        }

        $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);

        if ($data === false) {
            $this->Debug_OutputGenerate($this->Translate('ERROR when sending data'), $http_code);
            return false;
        }

        $dataAR = json_decode($data, true);
		
		
}		
		
		
		
		
If ($Update2 == True)
{
IPS_SLEEP(2000);		
		
		//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);


			

//Warmwasser erhöhen
//$POSTfieldsTMP = '{"EffectiveFlags":8,"LocalIPAddress":null,"SetTemperatureZone1":10,"SetTemperatureZone2":10,"RoomTemperatureZone1":22.5,"RoomTemperatureZone2":22.5,"OperationMode":3,"OperationModeZone1":3,"OperationModeZone2":4,"WeatherObservations":[{"Date":"2020-07-22T21:00:00","Sunrise":"2020-07-22T05:45:00","Sunset":"2020-07-22T21:14:00","Condition":176,"ID":347480172,"Humidity":70,"Temperature":20,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":0},{"Date":"2020-07-23T03:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982190,"Humidity":81,"Temperature":16,"Icon":"wsymbol_0025_light_rain_showers_night","ConditionName":"Patchy rain nearby","Day":3,"WeatherType":2},{"Date":"2020-07-23T15:00:00","Sunrise":"2020-07-23T05:46:00","Sunset":"2020-07-23T21:13:00","Condition":176,"ID":347982194,"Humidity":45,"Temperature":26,"Icon":"wsymbol_0009_light_rain_showers","ConditionName":"Patchy rain nearby","Day":4,"WeatherType":1},{"Date":"2020-07-24T03:00:00","Sunrise":"2020-07-24T05:47:00","Sunset":"2020-07-24T21:12:00","Condition":116,"ID":348479382,"Humidity":69,"Temperature":17,"Icon":"wsymbol_0008_clear_sky_night","ConditionName":"Partly Cloudy","Day":4,"WeatherType":2}],"ErrorMessage":null,"ErrorCode":8000,"SetHeatFlowTemperatureZone1":25,"SetHeatFlowTemperatureZone2":20,"SetCoolFlowTemperatureZone1":20,"SetCoolFlowTemperatureZone2":10,"HCControlType":2,"TankWaterTemperature":43.5,"SetTankWaterTemperature":43,"ForcedHotWaterMode":false,"UnitStatus":0,"OutdoorTemperature":26,"EcoHotWater":true,"Zone1Name":"","Zone2Name":null,"HolidayMode":false,"ProhibitZone1":false,"ProhibitZone2":false,"ProhibitHotWater":true,"TemperatureIncrementOverride":0,"IdleZone1":false,"IdleZone2":true,"DeviceID":122956,"DeviceType":1,"LastCommunication":"2020-07-22T18:00:57.627","NextCommunication":"2020-07-22T18:01:57.627","Power":true,"HasPendingCommand":true,"Offline":false,"Scene":null,"SceneOwner":null}';            
//$Content_Length = 1993;			
		
		
$headers = array();
$headers[] = 'Host: app.melcloud.com';
$headers[] = 'Connection: keep-alive';
$headers[] = 'Content-Length: ' . $Content_Length2;
$headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
$headers[] = 'X-MitsContextKey: ' . $token;
$headers[] = 'X-Requested-With: XMLHttpRequest';
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36';
$headers[] = 'Content-Type: application/json; charset=UTF-8';
$headers[] = 'Origin: https://app.melcloud.com';
$headers[] = 'Sec-Fetch-Site: same-origin';
$headers[] = 'Sec-Fetch-Mode: cors';
$headers[] = 'Sec-Fetch-Dest: empty';
$headers[] = 'Referer: https://app.melcloud.com/';
$headers[] = 'Accept-Encoding: gzip, deflate, br';
$headers[] = 'Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7';
$headers[] = 'Cookie: policyaccepted=true';


			$curl = curl_init('https://app.melcloud.com/Mitsubishi.Wifi.Client/Device/SetAtw');
            curl_setopt($curl, CURLOPT_HEADER, false);
            curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($curl, CURLOPT_FAILONERROR, true);
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $POSTfieldsTMP2);
            curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 5000);
			curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
            curl_setopt($curl, CURLOPT_TIMEOUT_MS, 20000);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
			
            $data = curl_exec($curl);
            
			
                

        if (curl_error($curl) !== '') {
            $cURL_Error = curl_error($curl);
			echo $cURL_Error;
            $this->SendDebug(__FUNCTION__, $this->Translate('ERROR // Connection to the MELCloud failed // cURL Error = ' . $cURL_Error), 0);
            IPS_LogMessage('MELCloud-' . __FUNCTION__, $this->Translate('ERROR // Connection to the MELCloud failed // cURL Error = ') . $cURL_Error);
            curl_close($curl);
            return false;
        }

        $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);

        if ($data === false) {
            $this->Debug_OutputGenerate($this->Translate('ERROR when sending data'), $http_code);
            return false;
        }

        $dataAR = json_decode($data, true);
		
		
}			
		
		

}        

 

Daten auslesen:

<? 

//Parameters
$username = 'xxxxx';
$password = 'xxxxx';
$loginurl = 'https://app.melcloud.com/Mitsubishi.Wifi.Client/Login/ClientLogin';
$url = 'https://app.melcloud.com/Mitsubishi.Wifi.Client/User/ListDevices/';
$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);

//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);



//Create variables from recieved output

//Power status
/*
$power = $response_json[0]['Structure']['Devices'][0]['Device']['Power'];
if (preg_match('/\b1\b/',$power)){
    SetValueBoolean(11592, true);
	}
else{     
	SetValueBoolean(11592, false);
} 
*/
//Boiler temperature
$boilertemperatur = $response_json[0]['Structure']['Devices'][0]['Device']['TankWaterTemperature'];
setValueFloat (17988 /*[Heizung\MelCloud\Boilertemperatur]*/, "$boilertemperatur");



//Room temperature
$romtemperatur = $response_json[0]['Structure']['Devices'][0]['Device']['RoomTemperatureZone1'];
setValueFloat (28020 /*[Heizung\MelCloud\Raumtemperatur]*/, "$romtemperatur");

//Set temperature
$vorlauftemperatur = $response_json[0]['Structure']['Devices'][0]['Device']['FlowTemperature'];
setValueFloat (25723 /*[Heizung\MelCloud\Vorlauftemp]*/, "$vorlauftemperatur");

//Set Soll temperature
$solllauftemperatur = $response_json[0]['Structure']['Devices'][0]['Device']['SetTemperatureZone1'];
setValueFloat (40161 /*[Heizung\MelCloud\Soll Temperatur]*/, "$solllauftemperatur");


$HeatPumpFrequency = $response_json[0]['Structure']['Devices'][0]['Device']['HeatPumpFrequency'];
setValueFloat (36214 /*[Heizung\MelCloud\Pumpenfrequenz]*/, "$HeatPumpFrequency");

$OperationMode = $response_json[0]['Structure']['Devices'][0]['Device']['OperationMode'];
setValue (55605 /*[Heizung\MelCloud\Modus]*/, "$OperationMode");

$OperationModeZone1 = $response_json[0]['Structure']['Devices'][0]['Device']['OperationModeZone1'];
setValue (12370 /*[Heizung\MelCloud\ModeZone1]*/, "$OperationModeZone1");


//Fan speed
$rücklauftemp = $response_json[0]['Structure']['Devices'][0]['Device']['ReturnTemperature'];
setValueFloat (59921 /*[Heizung\MelCloud\Rücklauftemp]*/, "$rücklauftemp");
//echo $fanspeed;
//Automatic fanspeed
/*$autofan = $response_json[0]['Structure']['Devices']['FlowTemperature'] ;
if (preg_match('/\b1\b/',$autofan)){
    SetValueBoolean(25045, true);
	}
else{     
	SetValueBoolean(25045, false);
} 
*/
//WiFi status
$Wifistatus = $response_json[0]['Structure']['Devices'][0]['Device']['WifiAdapterStatus'];
setValueString (47570 /*[Heizung\MelCloud\WifiStatus]*/, "$Wifistatus");

?>

Hallo Chris,

ich hab seit geraumer Zeit diese Fehlermeldung im system

07.09.2020 21:27:07 | TimerPool | MELCloudIO (MELCloudConfigurator #17181) (Update_GetList): <br />
<b>Warning</b>: json_decode() expects parameter 1 to be string, array given in <b>C:\ProgramData\Symcon\modules\MELCloud\MEL_IO\module.php</b> on line <b>1207</b><br />
<br />
<b>Warning</b>: json_decode() expects parameter 1 to be string, array given in <b>C:\ProgramData\Symcon\modules\MELCloud\MEL_IO\module.php</b> on line <b>1207</b><br />
<br />
<b>Warning</b>: json_decode() expects parameter 1 to be string, array given in <b>C:\ProgramData\Symcon\modules\MELCloud\MEL_IO\module.php</b> on line <b>1207</b><br />
<br />
<b>Warning</b>: json_decode() expects parameter 1 to be string, array given in <b>C:\ProgramData\Symcon\modules\MELCloud\MEL_IO\module.php</b> on line <b>1207</b><br />

kannst du mir hier sagen was ich da für einen Fehler habe und wie ich den korrigieren kann.

Vielen Dank!
LG
Christian

Hi Christian,

hab ich schon von gehört. Das kam mit irgend einem Update/Änderung (entweder durch MelCloud oder IPS).
Hatte auch schon mal ein paar Tage darin investiert, aber dann bin ich auf eine andere/tiefere Problematik gestoßen und konnte danach erst gar nicht schauen…
…weil ich seit einiger Zeit ziemlich viel um die Ohren habe - auf vielen Ebenen…

Aber zur Beruhigung für alle - meine Module bekommen alle weiterhin Pflege (für IPS 5.5 müsste ja auch ein wenig was angepasst werden) - nur aktuell klappt das leider nicht wirklich zeitnah.
Ich bin also nicht komplett „abgetaucht“, nur temporär.

Viele Grüße,
Chris

Danke Chris für die rasche Antwort,

dann werde ich diese Meldung mal Ignorieren und abwarten denn mir ist an der Funktion kein Fehler aufgefallen das System funktioniert einwandfrei !

lg
Christian

@Bayaro
Hallo Chris, ich möchte nur kurz melden das diese Problem bei mir auch besteht:

02.05.2021, 09:25:35 | TimerPool            | MELCloudIO (MELCloudConfigurator #53831) (Update_GetList): <br />
<b>Warning</b>:  json_decode() expects parameter 1 to be string, array given in <b>/var/lib/symcon/modules/MELCloud/MEL_IO/module.php</b> on line <b>1207</b><br />

nur zur Info… kein Stress!

Auch euch habe ich nicht vergessen :wink:
Bin am Baustellen abarbeiten … :smiley:

1 „Gefällt mir“

Getreu dem Motto „Never change a running System“…

Heute kam eine Mail bzgl. durchzuführendem MelCloud Update beim Wifi-Adapter…. Hat das schon jemand durchgeführt? Läuft das Modul danach noch?

Ich hab’ das Update gerade durchgeführt, dauert ca. 10 Minuten. Ein kurzer Test (Ein- und Ausschalten über Webfront) hat fuktioniert.

1 „Gefällt mir“

Ist zwar jetzt nicht das eigentlich Thema von dem Thread, aber das macht mich neugierig.

@swissboy : Kannst du mir etwas zu deiner Anbindung an die Balboa Steuerung erzählen?

danke+lg
hagi

Hallo,

Wir bekommen nächste Woche unsere Klimaanlage verbaut. Wie ich gerade lese, gibt es für IPS ein Interface zur Melcloud.

Gibt es was zu beachten, damit ich gleich mein Aha Erlebnis hab :smiley:

Die Daten kann wunderbar schonmal per Script auslesen, aber kann mir jemand ein paar Beispiele hier posten, wie ich was schalten kann z.b. die Temperatur setzten usw.

Nicht über das Modul, ich will es selber programmieren :wink:

Vielen Dank