| @@ 281-291 (lines=11) @@ | ||
| 278 | * |
|
| 279 | * @return Promise |
|
| 280 | */ |
|
| 281 | public function toggle() |
|
| 282 | { |
|
| 283 | $data = [ |
|
| 284 | 'id' => hexdec($this->getId()), |
|
| 285 | 'method' => 'toggle', |
|
| 286 | 'params' => [], |
|
| 287 | ]; |
|
| 288 | $this->send($data); |
|
| 289 | ||
| 290 | return $this->read(); |
|
| 291 | } |
|
| 292 | ||
| 293 | /** |
|
| 294 | * This method is used to save current state of smart LED in persistent memory. So if user powers off and then |
|
| @@ 299-309 (lines=11) @@ | ||
| 296 | * |
|
| 297 | * @return Promise |
|
| 298 | */ |
|
| 299 | public function setDefault() |
|
| 300 | { |
|
| 301 | $data = [ |
|
| 302 | 'id' => hexdec($this->getId()), |
|
| 303 | 'method' => 'set_default', |
|
| 304 | 'params' => [], |
|
| 305 | ]; |
|
| 306 | $this->send($data); |
|
| 307 | ||
| 308 | return $this->read(); |
|
| 309 | } |
|
| 310 | ||
| 311 | /** |
|
| 312 | * This method is used to start a color flow. Color flow is a series of smart LED visible state changing. It can be |
|
| @@ 353-363 (lines=11) @@ | ||
| 350 | * |
|
| 351 | * @return Promise |
|
| 352 | */ |
|
| 353 | public function stopCf() |
|
| 354 | { |
|
| 355 | $data = [ |
|
| 356 | 'id' => hexdec($this->getId()), |
|
| 357 | 'method' => 'stop_cf', |
|
| 358 | 'params' => [], |
|
| 359 | ]; |
|
| 360 | $this->send($data); |
|
| 361 | ||
| 362 | return $this->read(); |
|
| 363 | } |
|
| 364 | ||
| 365 | /** |
|
| 366 | * This method is used to set the smart LED directly to specified state. If the smart LED is off, then it will turn |
|
| @@ 379-389 (lines=11) @@ | ||
| 376 | * |
|
| 377 | * @return Promise |
|
| 378 | */ |
|
| 379 | public function setScene(array $params) |
|
| 380 | { |
|
| 381 | $data = [ |
|
| 382 | 'id' => hexdec($this->getId()), |
|
| 383 | 'method' => 'set_scene', |
|
| 384 | 'params' => $params, |
|
| 385 | ]; |
|
| 386 | $this->send($data); |
|
| 387 | ||
| 388 | return $this->read(); |
|
| 389 | } |
|
| 390 | ||
| 391 | /** |
|
| 392 | * This method is used to start a timer job on the smart LED |
|
| @@ 421-433 (lines=13) @@ | ||
| 418 | * |
|
| 419 | * @return Promise |
|
| 420 | */ |
|
| 421 | public function cronGet(int $type) |
|
| 422 | { |
|
| 423 | $data = [ |
|
| 424 | 'id' => hexdec($this->getId()), |
|
| 425 | 'method' => 'cron_get', |
|
| 426 | 'params' => [ |
|
| 427 | $type, |
|
| 428 | ], |
|
| 429 | ]; |
|
| 430 | $this->send($data); |
|
| 431 | ||
| 432 | return $this->read(); |
|
| 433 | } |
|
| 434 | ||
| 435 | /** |
|
| 436 | * This method is used to stop the specified cron job |
|
| @@ 442-454 (lines=13) @@ | ||
| 439 | * |
|
| 440 | * @return Promise |
|
| 441 | */ |
|
| 442 | public function cronDel(int $type) |
|
| 443 | { |
|
| 444 | $data = [ |
|
| 445 | 'id' => hexdec($this->getId()), |
|
| 446 | 'method' => 'cron_del', |
|
| 447 | 'params' => [ |
|
| 448 | $type, |
|
| 449 | ], |
|
| 450 | ]; |
|
| 451 | $this->send($data); |
|
| 452 | ||
| 453 | return $this->read(); |
|
| 454 | } |
|
| 455 | ||
| 456 | /** |
|
| 457 | * This method is used to change brightness, CT or color of a smart LED without knowing the current value, it's |
|
| @@ 473-486 (lines=14) @@ | ||
| 470 | * |
|
| 471 | * @return Promise |
|
| 472 | */ |
|
| 473 | public function setAdjust(string $action, string $prop) |
|
| 474 | { |
|
| 475 | $data = [ |
|
| 476 | 'id' => hexdec($this->getId()), |
|
| 477 | 'method' => 'set_adjust', |
|
| 478 | 'params' => [ |
|
| 479 | $action, |
|
| 480 | $prop, |
|
| 481 | ], |
|
| 482 | ]; |
|
| 483 | $this->send($data); |
|
| 484 | ||
| 485 | return $this->read(); |
|
| 486 | } |
|
| 487 | ||
| 488 | /** |
|
| 489 | * This method is used to start or stop music mode on a device |
|
| @@ 528-540 (lines=13) @@ | ||
| 525 | * |
|
| 526 | * @return Promise |
|
| 527 | */ |
|
| 528 | public function setName(string $name) |
|
| 529 | { |
|
| 530 | $data = [ |
|
| 531 | 'id' => hexdec($this->getId()), |
|
| 532 | 'method' => 'set_name', |
|
| 533 | 'params' => [ |
|
| 534 | $name, |
|
| 535 | ], |
|
| 536 | ]; |
|
| 537 | $this->send($data); |
|
| 538 | ||
| 539 | return $this->read(); |
|
| 540 | } |
|
| 541 | } |
|
| 542 | ||