Browse Source

fixed piface sensor support

tags/v0.1.4^0
Robin Thoni 7 years ago
parent
commit
84397bb8f5
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      app/Http/Business/Sensors/PiFaceSensor.php

+ 8
- 3
app/Http/Business/Sensors/PiFaceSensor.php View File

21
 
21
 
22
         $device = intval(isset($data['Device']) ? $data['Device'] : 0);
22
         $device = intval(isset($data['Device']) ? $data['Device'] : 0);
23
         $pin = intval(isset($data['Pin']) ? $data['Pin'] : 0);
23
         $pin = intval(isset($data['Pin']) ? $data['Pin'] : 0);
24
-        $trueValue = intval(isset($data['True']) ? $data['True'] : 0);
25
-        $falseValue = intval(isset($data['False']) ? $data['False'] : 0);
24
+        $trueValue = isset($data['True']) ? $data['True'] : 'Yes';
25
+        $falseValue = isset($data['False']) ? $data['False'] : 'No';
26
 
26
 
27
         $args = [
27
         $args = [
28
             'camotion-piface',
28
             'camotion-piface',
38
         }
38
         }
39
 
39
 
40
         $value = new SensorsValueDbo();
40
         $value = new SensorsValueDbo();
41
-        $value->setValue($output);
41
+        if ($output[0] == "0") {
42
+          $value->setValue($falseValue);
43
+        }
44
+        else {
45
+          $value->setValue($trueValue);
46
+        }
42
         return $value;
47
         return $value;
43
     }
48
     }
44
 }
49
 }

Loading…
Cancel
Save