Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions IPSViewConnect/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ protected function GetViewIDByName($viewName) {
}
}
if ($viewID === false) {
$snapshot = json_decode(IPS_GetSnapshot(), true);
$snapshot = IPS_GetSnapshot();
if (!is_array($snapshot)) {
$snapshot = json_decode($snapshot, true);
}
if ($snapshot == null) {
throw new Exception('Error during json_decode of Snapshot in GetViewIDByName!');
}
Expand Down Expand Up @@ -242,7 +245,10 @@ protected function GetInstanceIDUserViews() {

// -------------------------------------------------------------------------
protected function API_GetSnapshot($params) {
$snapshot = json_decode(IPS_GetSnapshot(), true);
$snapshot = IPS_GetSnapshot();
if (!is_array($snapshot)) {
$snapshot = json_decode($snapshot, true);
}
if ($snapshot == null) {
throw new Exception('Error during json_decode of Snapshot!');
}
Expand Down Expand Up @@ -332,7 +338,9 @@ protected function API_GetSnapshotChanges($params) {
if ($changes === false) {
throw new Exception('Error receiving SnapshotChanges: '.print_r(error_get_last(), true));
}
$changes = json_decode($changes, true);
if (!is_array($changes)) {
$changes = json_decode($changes, true);
}
$result = Array();

foreach ($changes as $change) {
Expand Down Expand Up @@ -422,7 +430,10 @@ protected function API_AssignViewData($method, $params) {
$view=null;

// Add special IP-Symcon Instance IDs
$snapshot = json_decode(IPS_GetSnapshot(), true);
$snapshot = IPS_GetSnapshot();
if (!is_array($snapshot)) {
$snapshot = json_decode($snapshot, true);
}
if ($snapshot == null) {
throw new Exception('Error during json_decode of Snapshot in AssignViewData!');
}
Expand Down Expand Up @@ -627,7 +638,11 @@ protected function ProcessHookAPIMethod($method, $params) {
} else if ($method == 'IPS_GetSnapshotChanges') {
return $this->API_GetSnapshotChanges($params);
} else if ($method == 'IPS_GetPresentations') {
return IPS_GetPresentations();
$presentations = IPS_GetPresentations();
if (is_array($presentations)) {
$presentations = json_encode($presentations);
}
return $presentations;

} else if ($method == 'IPS_GetLicensee') {
return IPS_GetLicensee();
Expand Down