2022-01-02 13:07:02 +01:00
|
|
|
<?php
|
2022-01-17 00:18:50 +01:00
|
|
|
logger(DEBUG,"Including class main.php");
|
|
|
|
|
2022-01-02 13:07:02 +01:00
|
|
|
class Message
|
|
|
|
{
|
|
|
|
public $id;
|
|
|
|
public $state = false;
|
|
|
|
public $msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
class topic {
|
|
|
|
public $mid;
|
|
|
|
public $status;
|
|
|
|
public $info;
|
|
|
|
public $devices;
|
|
|
|
public $groups;
|
|
|
|
public $extensions;
|
|
|
|
public $config;
|
2022-01-08 11:51:50 +01:00
|
|
|
public $callback;
|
2022-01-02 13:07:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class device
|
|
|
|
{
|
2022-01-19 00:22:34 +01:00
|
|
|
public $method; //0 = auto or 1 = manual
|
2022-01-02 13:07:02 +01:00
|
|
|
public $topic;
|
|
|
|
public $device;
|
|
|
|
public $ieeeAddress;
|
|
|
|
public $groupID;
|
|
|
|
public $friendlyName;
|
|
|
|
public $powerSource;
|
|
|
|
public $description;
|
|
|
|
public $functions;
|
|
|
|
public $payload;
|
2022-01-19 00:22:34 +01:00
|
|
|
public $availability;
|
2022-01-02 13:07:02 +01:00
|
|
|
|
2022-01-19 00:22:34 +01:00
|
|
|
private function __construct()
|
2022-01-02 13:07:02 +01:00
|
|
|
{
|
2022-01-19 00:22:34 +01:00
|
|
|
$this->availability = array("value" => null, "functions" => array());
|
|
|
|
var_dump($this->availability);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set($method=0) //, $event = null)
|
|
|
|
{
|
|
|
|
$this->method = $method;
|
|
|
|
publish($this->topic . "/" . $this->friendlyName, $this->payload, "set"); //, $event);
|
2022-01-02 13:07:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function get()
|
|
|
|
{
|
2022-01-19 00:22:34 +01:00
|
|
|
publish($this->topic . "/" . $this->friendlyNames, $this->payload, "get"); //, $event);
|
2022-01-02 13:07:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ranges
|
|
|
|
{
|
|
|
|
public $start; //datetime
|
|
|
|
public $end; //datetime
|
|
|
|
}
|
|
|
|
|
|
|
|
class event
|
|
|
|
{
|
|
|
|
public $ieeeAddress;
|
|
|
|
public $topic;
|
|
|
|
public $param;
|
|
|
|
public $value;
|
|
|
|
public $device;
|
|
|
|
public $published;
|
|
|
|
public $dateTimeEvent; // datetime : next occurence for recurrent event
|
|
|
|
public $startDatetime;
|
|
|
|
public $stopDatetime;
|
|
|
|
public $recurrenceInterval; // interval : for recurrent event
|
|
|
|
public $exceptionInterval; // array of object ranges
|
|
|
|
}
|
|
|
|
|
|
|
|
class interval
|
|
|
|
{
|
|
|
|
public $startDate;
|
|
|
|
public $endDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|