Ich bekomme beim Auslesen, setzen einer Datei in eine Variable folgende Fehlermeldung:
Warning: Cannot auto-convert value for parameter VariableValue (Type does not match) in /mnt/data/symcon/scripts/21137.ips.php on line 42
Auslesen möchte ich Folgende Position:
(
[components] => Array
(
[hca.main] => Array
(
[hca.washerMode] => Array
(
[mode] => Array
(
[value] => others
[timestamp] => 2023-09-17T11:27:46.435Z
)
[supportedModes] => Array
(
[value] => Array
(
[0] => normal
[1] => quickWash
[2] => eco
[3] => mix
[4] => spinOnly
Anbei das Script:
$status_id = 27268;
// Befehl zusammenstellen und per CURL absetzen
$Header = array(
'Authorization: Bearer ’ . $Access_Token,
‚Content-Type: application/json‘,
‚Accept: application/json‘,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, $Header);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $Command);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‚GET‘);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = explode(„\r\n\r\n“, $response); // Header abtrennen
$daten = json_decode($data[1], true); // Array erstellen
$status = $daten[‚components‘][‚hca.main‘][‚hca.washerMode‘][‚supportedModes‘][‚value‘];
SetValueString($status_id, $status);
print_r($daten);