Skip to content

Commit 4ffb6d9

Browse files
committed
Added MotionSensor device
1 parent 391afc4 commit 4ffb6d9

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/Client.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public function getDevices(string $filter = null) {
8989
$devices = [];
9090
foreach ($receivedDevices as $receivedDevice) {
9191

92-
9392
switch ($receivedDevice->Type) {
9493

9594
case 'Light/Switch':
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace rutgerkirkels\DomoticzPHP\Devices\Switches;
4+
5+
/**
6+
* Class MotionSensor
7+
* @package rutgerkirkels\DomoticzPHP\Devices\Switches
8+
*/
9+
class MotionSensor extends AbstractSwitch
10+
{
11+
public function getBatteryLevel() {
12+
return $this->batteryLevel;
13+
}
14+
15+
}

src/Factories/SwitchFactory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use rutgerkirkels\DomoticzPHP\Devices\Switches\Dimmer;
66
use rutgerkirkels\DomoticzPHP\Devices\Switches\DoorContact;
7+
use rutgerkirkels\DomoticzPHP\Devices\Switches\MotionSensor;
78
use rutgerkirkels\DomoticzPHP\Devices\Switches\OnOff;
89

910
/**
@@ -30,6 +31,10 @@ public function __construct(object $deviceData)
3031
$this->data = new DoorContact($deviceData);
3132
break;
3233

34+
case 'Motion Sensor':
35+
$this->data = new MotionSensor($deviceData);
36+
break;
37+
3338
}
3439
}
3540

0 commit comments

Comments
 (0)