commit 77f2b33963a5ba48719b1bd172eeb7f04c1e16db Author: seo Date: Mon Jun 8 02:33:48 2026 +0900 Initial private import diff --git a/api.php b/api.php new file mode 100644 index 0000000..dee57b3 --- /dev/null +++ b/api.php @@ -0,0 +1,67 @@ + "error"]); + exit; + } + + echo json_encode([ + "result" => "ok", + "state" => $state["state"] // "on" or "off" + ]); + exit; +} + +/* +-------------------------------------------- + 2) 스위치 켜기 요청 (POST) +-------------------------------------------- +*/ +if ($_SERVER["REQUEST_METHOD"] === "POST") { + $res = haRequest("POST", "/services/switch/turn_on", [ + "entity_id" => $ENTITY + ]); + + echo json_encode(["result" => "sent"]); + exit; +} + +echo json_encode(["result" => "invalid_request"]);