Skip to content
Permalink
Browse files

Merge pull request #16 from olehs/chechvals

Values Checking fixed
  • Loading branch information...
nick7zmail committed Nov 10, 2018
2 parents 6365a0f + dcdb065 commit f417778ed28a663ecef438b26a6db79a30fd6272
@@ -1,15 +1,21 @@
<?php
include_once(DIR_MODULES.'/dev_broadlink/broadlink.class.php');
function brLinkRawCommand($devid, $data)
{
$info = SQLSelectOne("SELECT * FROM dev_httpbrige_devices WHERE ID='".DbSafe($devid)."'");
$rm = Broadlink::CreateDevice($info['IP'], $info['MAC'], 80, $info['DEVTYPE']);
$decoded_keys = json_decode($info['KEYS']);
$rm->Auth($decoded_keys->id, $decoded_keys->key);
$rm->Send_data($data);
}
function brLinkCommand($command)
{
$command_arr=SQLSelectOne("SELECT * FROM dev_broadlink_commands WHERE TITLE='$command'");
$id=$command_arr['DEVICE_ID'];
$info=SQLSelectOne("SELECT * FROM dev_httpbrige_devices WHERE ID='$id'");
$data = $command_arr['VALUE'];
$rm = Broadlink::CreateDevice($info['IP'], $info['MAC'], 80, $info['DEVTYPE']);
$decoded_keys=json_decode($info['KEYS']);
$rm->Auth($decoded_keys->id, $decoded_keys->key);
$rm->Send_data($data);
$command_arr = SQLSelectOne("SELECT * FROM dev_broadlink_commands WHERE TITLE='".DbSafe($command)."'");
$devid = $command_arr['DEVICE_ID'];
$data = $command_arr['VALUE'];
brLinkRawCommand($devid, $data);
}
?>
?>

0 comments on commit f417778

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