-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
26 lines (18 loc) · 757 Bytes
/
Copy pathindex.php
File metadata and controls
26 lines (18 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require('../credentials.php');
require('../../vendor/autoload.php');
use Mukhin\AjaxSystemsApi\AjaxSystemsApiClient;
use Mukhin\AjaxSystemsApi\Exception\Exception;
$ajaxSystemsClient = new AjaxSystemsApiClient();
try {
$ajaxSystemsClient->login(AJAX_SYSTEMS_LOGIN, AJAX_SYSTEMS_PASSWORD);
$ajaxSystemsClient->getCsaConnection();
if ($ajaxSystemsClient->setSwitchState(AjaxSystemsApiClient::COMMAND_SWITCH_STATE_ON, AJAX_WALL_SWITCH_ID,AJAX_DEFAULT_HUB_ID)) {
echo "Switch turned on\n";
}
if ($ajaxSystemsClient->setSwitchState(AjaxSystemsApiClient::COMMAND_SWITCH_STATE_OFF, AJAX_WALL_SWITCH_ID,AJAX_DEFAULT_HUB_ID)) {
echo "Switch turned off\n";
}
} catch (Exception $e) {
echo $e->getMessage();
}