à partir de ligne 106 de /3dparty/sonoff.php :
}
$str="";
for($i=0;$i<strlen($body);$i++) {
$caractere=substr($body,$i,1);
if (ord($caractere)>31 && ord($caractere)<127 && ord($caractere)!= 39 && ord($caractere)!= 92 && ord($caractere)!=96) $str=$str.$caractere;
else $str.="[".ord($caractere)."]";
//log::add($this->_log,'debug',"code ascii [".$i."]= ".ord($caractere));
}
log::add($this->_log,'debug'," Receive after decode :".$str);
}
catch (Exception $e) {
log::add($this->_log,'debug',' No SonOff @'.$url );
return NOTCONNECTED;
}
$test='{"seq":16,"error":0,"data":{"switch":"on","startup":"stay","pulse":"off","pulseWidth":500,"ssid":"virlouvet-network","otaUnlock":false,"fwVersion":"3.6.0","deviceid":"1000904426","bssid":"70:4f:57:8f:16:4a","signalStrength":-76}}';
log::add($this->_log,'debug'," static test");
$json_decoded_data = json_decode($test, true);
if ($jsonObj === null && json_last_error() !== JSON_ERROR_NONE) {
log::add($this->_log,'debug',' Static test fails - error:'.json_last_error() );
return BADRESPONSE;
}
normalement ca affiche receive… ok
puis j’ai mis une copie de ton log pour tester et déjà c’est KO !