For Sensibo PURE (Air Purifier) is a little different script.
Code: Alles auswählen
!..Skript SENSIBO SKY several Device - Read status and wrote the Status to several Systemvariables
! v0.6 (c) by Alchy, modified by Omicron 6-2021
string APIKEY = "....................................";
string PODS = "............=Kitchen"; !DeviceID=DeviceName -> comma separated
string prefix = "VAR_AC_";
!++++++++ dont touch ++++++++++
string sDevPod; foreach (sDevPod, PODS.Split(",")){
string sDev = sDevPod.StrValueByIndex("=",1);
string sPod = sDevPod.StrValueByIndex("=",0);
var URL = "https://home.sensibo.com/api/v2/pods/"#sPod#"/acStates?fields=acState&apiKey='"#APIKEY#"'";
string srueck;string serr;string part; string sName;string sValue;integer count = 0;
system.Exec("wget --no-check-certificate -q -O - '"#URL#"'" , &srueck, &serr);
if(srueck == ""){ WriteLine("Request failure");}else{
srueck = srueck.Replace("\{", "").Replace("{", "").Replace("\"", "").Replace("}", "").Replace("result: [acState: on", "Status").Replace(" ", "");
WriteLine("\r\n"#sDev#"\r\n"#srueck);
foreach (part, srueck.Split(","))
{
count = count +1;
sName = part.StrValueByIndex(":",0);
sValue = part.StrValueByIndex(":",1);
if( (count == 4) || (count == 5) || (count == 6) || (count == 8) || (count == 9) || (count == 10) || (count == 11) ){
if (dom.GetObject(ID_SYSTEM_VARIABLES).Get(prefix#sDev#"_"#sName)) { dom.GetObject(ID_SYSTEM_VARIABLES).Get(prefix#sDev#"_"#sName).State(sValue); WriteLine( count#" Sysvar: "#prefix#sDev#"_"#sName #" switched to: "#sValue);
}else{WriteLine(count#" Sysvar: "#prefix#sDev#"_"#sName #" for Value: "#sValue #" -not there, please add at CCU");}
}}
}}
}
If my Sensibo SKY device (room) is named "Kitchen", it requires the following variables to be defined:
Code: Alles auswählen
VAR_AC_Kitchen_fanLevel
VAR_AC_Kitchen_horizontalSwing
VAR_AC_Kitchen_light
VAR_AC_Kitchen_mode
VAR_AC_Kitchen_on
VAR_AC_Kitchen_swing
VAR_AC_Kitchen_targetTemperature