PHP_SMART_HOME_V3/app/api/AutomationsApi.php

35 lines
734 B
PHP
Raw Normal View History

2021-02-16 13:28:31 +00:00
<?php
class AutomationsApi extends ApiController
{
public function default()
{
//$this->requireAuth();
$response = [];
2021-02-17 07:37:08 +00:00
$response = AutomationManager::getAll(["automation_id","name","enabled"]);
2021-02-16 13:28:31 +00:00
$this->response($response);
}
public function detail($automationId)
{
//$this->requireAuth();
2021-02-17 07:37:08 +00:00
$response = [];
$response = AutomationManager::getById($automationId, ["automation_id", "last_execution_time", "owner_id", "conditions", "tasks"]);
$this->response($response);
}
2021-02-23 11:41:34 +00:00
public function create()
{
2021-02-23 11:41:48 +00:00
$this->requireAuth();
2021-02-23 11:41:34 +00:00
$obj = $this->input;
$response = [];
$response = AutomationManager::create($obj['name'],$obj['days'], $obj['tasks'], $obj['conditions']);
$this->response(['value'=>'OK']);
}
2021-02-16 13:28:31 +00:00
}