Newer
Older
smart-home-server / server / SHServ / Tools / DeviceAPI / Relay.php
<?php

namespace SHServ\Tools\DeviceAPI;

class Relay extends Base {
	public function toggle_channel(int $channel_id = 0) {
		return $this -> post_action("toggle_channel", [
			"channel" => $channel_id
		]);
	}

	public function set_state(bool $state) {
		return $this -> post_action("set_state", [
			"state" => $state ? "on" : "off"
		]);
	}

	public function set_channel_state(bool $state, int $channel_id) {
		return $this -> post_action("set_channel_state", [
			"state" => $state ? "on" : "off",
			"channel" => $channel_id
		]);
	}
}