Skip to content
Permalink
Browse files

Update magichome.class.php

  • Loading branch information...
directman66 committed Oct 5, 2018
1 parent 9faf33d commit 48179f06afc01f0d4655e64b164e8532bfba3285
Showing with 18 additions and 13 deletions.
  1. +18 −13 modules/magichome/magichome.class.php
@@ -272,18 +272,18 @@ function propertySetHandle($object, $property, $value) {
//sg('test.mycommand', "command:".$command." value:".$value." type:".$type);
if ($type=='AK001-ZJ100') {
if ($command=='status'&& $value=='1') {
// $magichomeObject->turnon($deviceid);
// $magichomeObject->getinfo2($deviceid);
$magichomeObject->turnon($deviceid);
$magichomeObject->getinfo2($deviceid);
}
if ($command=='status'&& $value=='0') {
// $magichomeObject->turnoff($deviceid);
// $magichomeObject->getinfo2($deviceid);
$magichomeObject->turnoff($deviceid);
$magichomeObject->getinfo2($deviceid);
}
if ($command=='color') {
$colorhex=$value;
$ar =(str_split($colorhex, 2));
// $magichomeObject->set_colorhex($cid, $ar[0],$ar[1],$ar[2]);
// $magichomeObject->getinfo2($cid, $debug);
$magichomeObject->set_colorhex($cid, $ar[0],$ar[1],$ar[2]);
$magichomeObject->getinfo2($cid, $debug);
}
} //model
@@ -781,7 +781,10 @@ function getinfo2($id=0) {
if ($myrec['LINKED_OBJECT']!='' && $myrec['LINKED_PROPERTY']!='') {
setGlobal($myrec['LINKED_OBJECT'].'.'.$myrec['LINKED_PROPERTY'], $turn);
setGlobal($myrec['LINKED_OBJECT'].'.'.$myrec['LINKED_PROPERTY'], $turn,array($this->name => '0'));
}
@@ -791,23 +794,25 @@ function getinfo2($id=0) {
$myrec=SQLSelectOne("select * from magichome_commands where device_id='$globalid' and title='color'" );
$myrec['VALUE']=$color;
$myrec['UPDATED']=date('Y-m-d H:i:s');
/*
if ($myrec['LINKED_OBJECT']!='' && $myrec['LINKED_PROPERTY']!='') {
setGlobal($myrec['LINKED_OBJECT'].'.'.$myrec['LINKED_PROPERTY'], $turn);
setGlobal($myrec['LINKED_OBJECT'].'.'.$myrec['LINKED_PROPERTY'], $color,array($this->name => '0'));
}
*/
SQLUpdate('magichome_commands', $myrec);
$level=substr($buf,10,3);
$myrec=SQLSelectOne("select * from magichome_commands where device_id='$globalid' and title='level'" );
$myrec['VALUE']=$level;
$myrec['UPDATED']=date('Y-m-d H:i:s');
/*
if ($myrec['LINKED_OBJECT']!='' && $myrec['LINKED_PROPERTY']!='') {
setGlobal($myrec['LINKED_OBJECT'].'.'.$myrec['LINKED_PROPERTY'], $turn);
setGlobal($myrec['LINKED_OBJECT'].'.'.$myrec['LINKED_PROPERTY'], $level,array($this->name => '0'));
}
*/
SQLUpdate('magichome_commands', $myrec);

0 comments on commit 48179f0

Please sign in to comment.
You can’t perform that action at this time.