Example #1
0
function CheckSML($stream, $parentID)
{
    for ($i = 1; $i < count(EHz(0, 1)); $i++) {
        $var = stristr($stream, EHz($i, 1));
        if ($var != false) {
            CheckVariable(EHz($i, 0), EHz($i, 2), EHz($i, 3), $parentID);
            IPS_LogMessage('EHz', $i);
        } else {
            IPS_LogMessage('EHz <-> Port:', $stream);
        }
    }
    return true;
}
Example #2
0
 public function ReceiveData($JSONString)
 {
     $data = json_decode($JSONString);
     //IPS_LogMessage('EHz <- Port:', bin2hex(utf8_decode($data->Buffer)));
     $stream = bin2hex(utf8_decode($data->Buffer));
     for ($i = 1; $i < EHz(0, 1); $i++) {
         $var = stristr($stream, EHz($i, 1));
         IPS_LogMessage('EHz', $i);
         if ($var != false) {
             CheckVariable(EHz($i, 0), EHz($i, 2), EHz($i, 3), $this->InstanceID);
             IPS_LogMessage('EHz', $i);
         } else {
             IPS_LogMessage('EHz <-> Port:', $stream);
         }
     }
     return true;
 }
function EncodeMonitorNormalData($Monitordaten, $ID, $Bus)
{
    $Bus = 1;
    $array = str_split($Monitordaten, 24);
    for ($x = 0; $x < count($array); $x++) {
        if (substr($array[$x], 0, 2) == 'a7') {
            $typ = ord(hex2bin(substr($array[$x], 8, 2)));
            if ($Bus === ord(hex2bin(substr($array[$x], 4, 2)))) {
                IPS_LogMessage('Buderus Logamatic', 'ECO-CAN Adresse ' . $Bus . ' Array: ' . $array[$x]);
                $offset = ord(hex2bin(substr($array[$x], 12, 2)));
                $substring = substr($array[$x], 16, 2);
                IPS_LogMessage('Buderus Logamatic', 'ECO-CAN Adresse ' . $Bus . ' Data: ' . $typ . ' : ' . $offset . ' : ' . $substring);
                $var = CheckVariable($typ, -1, 0, $ID);
                $value = GetValueString($var);
                $newvalue = substr_replace($value, $substring, $offset * 2, 2);
                SetValueString($var, $newvalue);
                EncodeVariableData($ID, $typ);
            } else {
                IPS_LogMessage('Logamatic Gateway', 'EncodeMonitorNormalData für falsche Bus-Adresse');
            }
        }
    }
    return true;
}