Skip to content

Commit

Permalink
Merge pull request #3 from sergejey/master
Browse files Browse the repository at this point in the history
Fixing sql errors
  • Loading branch information
fandaymon committed Aug 3, 2022
2 parents e324560 + ca3f234 commit 283048c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions modules/tuya/tuya.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function admin(&$out)
{
$this->getConfig();

if ((time() - (int)gg('cycle_tuyaRun')) < $this->config['TUYA_INTERVAL']+30) {
if ((time() - (int)gg('cycle_tuyaRun')) < (int)$this->config['TUYA_INTERVAL']+30) {
$out['CYCLERUN'] = 1;
} else {
$out['CYCLERUN'] = 0;
Expand Down Expand Up @@ -1132,9 +1132,9 @@ function Tuya_Web_Status() {

if ($rec==NULL) {
if (isset($device['moduleMap']['infrared'])) {
$ir_flag = True;
$ir_flag = 1;
} else {
$ir_flag = False;
$ir_flag = 0;
}
$rec['IR_FLAG'] = $ir_flag;

Expand All @@ -1157,12 +1157,12 @@ function Tuya_Web_Status() {
if (is_null($rec['MAC'])) $rec['MAC'] ='';
if (is_null($rec['LOCAL_KEY'])) $rec['LOCAL_KEY'] ='';
if (is_null($rec['MESH_ID'])) $rec['MESH_ID'] ='';
if (is_null($rec['IR_FLAG'])) $rec['IR_FLAG'] = False;
if (is_null($rec['IR_FLAG'])) $rec['IR_FLAG'] = 0;

if (isset($device['moduleMap']['infrared'])) {
$ir_flag = True;
$ir_flag = 1;
} else {
$ir_flag = False;
$ir_flag = 0;
}


Expand Down Expand Up @@ -1247,9 +1247,9 @@ function Tuya_Web_Discovery_Devices() {

if ($rec==NULL) {
if (isset($device['moduleMap']['infrared'])) {
$ir_flag = True;
$ir_flag = 1;
} else {
$ir_flag = False;
$ir_flag = 0;
}
$rec['IR_FLAG'] = $ir_flag;

Expand All @@ -1273,12 +1273,12 @@ function Tuya_Web_Discovery_Devices() {
if (is_null($rec['MAC'])) $rec['MAC'] ='';
if (is_null($rec['LOCAL_KEY'])) $rec['LOCAL_KEY'] ='';
if (is_null($rec['MESH_ID'])) $rec['MESH_ID'] ='';
if (is_null($rec['IR_FLAG'])) $rec['IR_FLAG'] = False;
if (is_null($rec['IR_FLAG'])) $rec['IR_FLAG'] = 0;

if (isset($device['moduleMap']['infrared'])) {
$ir_flag = True;
$ir_flag = 1;
} else {
$ir_flag = False;
$ir_flag = 0;
}


Expand All @@ -1289,7 +1289,6 @@ function Tuya_Web_Discovery_Devices() {
$rec['MESH_ID'] = $device['meshId'];
$rec['MAC'] = $device['mac'];
$rec['IR_FLAG'] = $ir_flag;

$rec['ID']=SQLUpdate('tudevices',$rec);
}
}
Expand Down Expand Up @@ -1323,7 +1322,7 @@ function Tuya_Web_Discovery_Devices() {
$cmd_rec['VALUE_TYPE'] = $sc[$device['productId']][$key]['type'];

$cmd_rec['VALUE_MAX'] = $sc[$device['productId']][$key]['max'];
$cmd_rec['VALUE_SCALE'] = $sc[$device['productId']][$key]['scale'];
$cmd_rec['VALUE_SCALE'] = (int)$sc[$device['productId']][$key]['scale'];
$cmd_rec['DIVIDEDBY2'] = 0;
$cmd_rec['DIVIDEDBY10'] = 0;
$cmd_rec['DIVIDEDBY100'] = 0;
Expand Down
2 changes: 1 addition & 1 deletion modules/tuya/tuya_edit.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
$rec['TYPE'] = $type;

global $send12;
$rec['SEND12'] = $send12;
$rec['SEND12'] = (int)$send12;

global $flags12;
$rec['FLAGS12'] = $flags12;
Expand Down

0 comments on commit 283048c

Please sign in to comment.