Newer
Older
smart-home-server / server / ControlScripts / Scopes / TestScriptsScope.php
<?php

namespace ControlScripts\Scopes;

use \SHServ\Entities\Device;

class TestScriptsScope extends \SHServ\Middleware\ControlScripts implements \SHServ\Implements\ControlScriptsInterface {
	public function register_events_handlers(): void {
	}

	public function register_sync_map(): void {

	}

	public function register_actions_scripts(): void {
		$this -> add_action_script([
			"alias" => "stand_relay_toggle",
			"icon" => '<i class="ph ph-flask"></i>',
			"name" => "Toggle Stang Relay",
			"description" => "Управление тестовым стендом у меня на столе. Просто переключатель",
			"author" => "Eugene Sukhodolskiy"
		], function($params) {
			$device = $this -> devices() -> by_alias("test_stand_relay");
			return [
				"device_response" => $device -> device_api() -> toggle_channel(),
			];
		});
	}

	public function register_regular_scripts(): void {
	}

}