File tree Expand file tree Collapse file tree 4 files changed +105
-0
lines changed
Expand file tree Collapse file tree 4 files changed +105
-0
lines changed Original file line number Diff line number Diff line change 44
55use rutgerkirkels \DomoticzPHP \Factories \Lighting2Factory ;
66use rutgerkirkels \DomoticzPHP \Factories \TempAndHumidityFactory ;
7+ use rutgerkirkels \DomoticzPHP \Factories \ThermostatFactory ;
78
89class Client
910{
@@ -76,6 +77,10 @@ public function getDeviceByIdx(int $idx) {
7677 return $ this ->getTempAndHumidity ($ receivedDevice )->get ();
7778 break ;
7879
80+ case 'Thermostat ' :
81+ return $ this ->getThermostat ($ receivedDevice )->get ();
82+ break ;
83+
7984 default :
8085
8186 }
@@ -112,6 +117,11 @@ public function getDevices(string $filter = null) {
112117
113118 case 'Temp + Humidity ' :
114119 $ devices [] = $ this ->getTempAndHumidity ($ receivedDevice )->get ();
120+ break ;
121+
122+ case 'Thermostat ' :
123+ $ devices [] = $ this ->getThermostat ($ receivedDevice )->get ();
124+ break ;
115125 default :
116126
117127 }
@@ -138,4 +148,8 @@ protected function getLighting2($deviceData) {
138148 protected function getTempAndHumidity ($ deviceData ) {
139149 return new TempAndHumidityFactory ($ deviceData );
140150 }
151+
152+ protected function getThermostat ($ deviceData ) {
153+ return new ThermostatFactory ($ deviceData );
154+ }
141155}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace rutgerkirkels \DomoticzPHP \Devices \Thermostat ;
4+
5+
6+ use rutgerkirkels \DomoticzPHP \Devices \AbstractDevice ;
7+
8+ class SetPoint extends AbstractDevice
9+ {
10+ /**
11+ * @var float
12+ */
13+ protected $ setPoint ;
14+
15+ public function __construct (object $ deviceData )
16+ {
17+ parent ::__construct ($ deviceData );
18+ $ this ->setSetPoint (floatval ($ this ->data ));
19+ }
20+
21+ /**
22+ * @return float
23+ */
24+ public function getSetPoint (): float
25+ {
26+ return $ this ->setPoint ;
27+ }
28+
29+ /**
30+ * @param float $setPoint
31+ */
32+ protected function setSetPoint (float $ setPoint ): void
33+ {
34+ $ this ->setPoint = $ setPoint ;
35+ }
36+
37+
38+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace rutgerkirkels \DomoticzPHP \Factories \Thermostat ;
4+
5+
6+ use rutgerkirkels \DomoticzPHP \Factories \AbstractDeviceFactory ;
7+
8+ class SetPointFactory extends AbstractDeviceFactory
9+ {
10+ public $ data ;
11+
12+ public function __construct (object $ deviceData )
13+ {
14+ switch ($ deviceData ->SubType ) {
15+
16+ case 'SetPoint ' :
17+ $ this ->data = new \rutgerkirkels \DomoticzPHP \Devices \Thermostat \SetPoint ($ deviceData );
18+ break ;
19+
20+ }
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Created by PhpStorm.
4+ * User: rutgerkirkels
5+ * Date: 04-02-18
6+ * Time: 17:58
7+ */
8+
9+ namespace rutgerkirkels \DomoticzPHP \Factories ;
10+
11+
12+ use rutgerkirkels \DomoticzPHP \Factories \Thermostat \SetPointFactory ;
13+
14+ class ThermostatFactory extends AbstractDeviceFactory
15+ {
16+ protected $ data ;
17+
18+ public function __construct ($ deviceData )
19+ {
20+ switch ($ deviceData ->SubType ) {
21+
22+ case 'SetPoint ' :
23+ $ this ->data = (new SetPointFactory ($ deviceData ))->get ();
24+ break ;
25+
26+
27+ default :
28+
29+ }
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments