Skip to content

Commit

Permalink
fix linked property device
Browse files Browse the repository at this point in the history
  • Loading branch information
Исупов Андрей Николаевич committed Feb 29, 2024
1 parent f017b88 commit b8f71b0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/openhasp/openhasp.class.php
Expand Up @@ -356,7 +356,7 @@ function processPanelMessage($panel, $topic, $msg)
$value= json_decode($msg,true);
$panel['IP'] = $value["ip"];
SQLUpdate("hasp_panels", $panel);
$this->setLinkedProperty($panel,"ip", $msg);
$this->setLinkedProperty($panel,"ip", $value["ip"]);
}
else if ($key == "idle"){
$res = $this->setLinkedProperty($panel,"idle", $msg);
Expand All @@ -370,6 +370,7 @@ function processPanelMessage($panel, $topic, $msg)
else if ($key == "backlight"){
$backlight = json_decode($msg,true);
$this->setLinkedProperty($panel,"brightness", $backlight['brightness']);
$this->setLinkedProperty($panel,"backlight", $backlight['state']);
}
else if (preg_match('/^p(\d+)b(\d+)$/', $key, $matches)) {
$page_index = $matches[1];
Expand Down Expand Up @@ -458,10 +459,12 @@ function propertySetHandle($object, $property, $value)
if (preg_match($pattern, $key, $matches))
{
$name = $matches[1];
if ($name == 'backlight')
$this->sendValue($panels[$i]['MQTT_PATH'], "backlight" , "{\"state\":\"$value\"}");
if ($name == 'brightness')
$this->sendValue($panels[$i]['MQTT_PATH'], "backlight" , $value);
else
$this->sendValue($panels[$i]['MQTT_PATH'], $name , $value);
$this->sendValue($panels[$i]['MQTT_PATH'], "backlight" , "{\"brightness\":\"$value\"}");
if ($name == 'page')
$this->sendValue($panels[$i]['MQTT_PATH'], "page" , $value);
}
}
}
Expand Down

0 comments on commit b8f71b0

Please sign in to comment.