Periodical sync from dev FTP
This commit is contained in:
parent
6f0fa2f81e
commit
ad89a18093
@ -77,9 +77,9 @@ class AutomationManager{
|
||||
}
|
||||
|
||||
} else if ($onValue['type'] == 'outHome') {
|
||||
|
||||
//TODO: Add Ovner to automation
|
||||
} else if ($onValue['type'] == 'inHome') {
|
||||
|
||||
//TODO: Add Ovner to automation
|
||||
} else if ($onValue['type'] == 'noOneHome') {
|
||||
$users = UserManager::getUsers();
|
||||
$membersHome = 0;
|
||||
@ -120,14 +120,19 @@ class AutomationManager{
|
||||
$subscribers = NotificationManager::getSubscription();
|
||||
$i = 0;
|
||||
|
||||
foreach ($subscribers as $key => $subscriber) {
|
||||
$logManager->write("[NOTIFICATION] SENDING NOTIFICATION TO" . $subscriber['id'] . " was executed" . $i);
|
||||
$title = 'Automatization '.$automation['name']." was just executed";
|
||||
$notification = new Notification(SERVERKEY);
|
||||
$notification->to($subscriber['token']);
|
||||
$notification->notification($title, '' , '', '');
|
||||
$notification->send();
|
||||
$notification = null;
|
||||
$notificationMng = new NotificationManager;
|
||||
$notificationData = [
|
||||
'title' => 'Automatization',
|
||||
'body' => 'Automatization '.$automation['name']." was just executed",
|
||||
'icon' => BASEDIR . '/app/templates/images/icon-192x192.png',
|
||||
];
|
||||
|
||||
if ($notificationData != []) {
|
||||
$subscribers = $notificationMng::getSubscription();
|
||||
foreach ($subscribers as $key => $subscriber) {
|
||||
$logManager->write("[NOTIFICATION/AUTOOMATION] SENDING TO" . $subscriber['id'] . " ");
|
||||
$notificationMng::sendSimpleNotification(SERVERKEY, $subscriber['token'], $notificationData);
|
||||
}
|
||||
}
|
||||
|
||||
$logManager->write("[AUTOMATIONS] automation id ". $automation['automation_id'] . " was executed");
|
||||
|
@ -2,6 +2,7 @@
|
||||
/**
|
||||
* Notification Manager
|
||||
*/
|
||||
//TODO: Working timestamp to body or $title
|
||||
class NotificationManager
|
||||
{
|
||||
function addSubscriber($userID = '', $token = ''){
|
||||
@ -19,7 +20,7 @@ class NotificationManager
|
||||
return Db::loadAll('SELECT * FROM notifications;', array());
|
||||
}
|
||||
|
||||
function sendSimpleNotification(string $serverKey, string $to, array $data){
|
||||
function sendSimpleNotification(string $serverKey, string $to, array $data, bool $timeStamp = false){
|
||||
$dataTemplate = [
|
||||
'title' => '',
|
||||
'body' => '',
|
||||
@ -30,6 +31,10 @@ class NotificationManager
|
||||
return;
|
||||
}
|
||||
|
||||
if ($timeStamp) {
|
||||
$data['title'] = $data['title'] . date();
|
||||
}
|
||||
|
||||
$notification = new Notification($serverKey);
|
||||
$notification->to($to);
|
||||
$notification->notification($data['title'], $data['body'], $data['icon'], '');
|
||||
@ -64,8 +69,12 @@ class Notification
|
||||
$this->jsonPayload["to"] = $to;
|
||||
}
|
||||
|
||||
function notification($title = '', $body = '', $icon = '', $action = '')
|
||||
function notification($title = '', $body = '', $icon = '', $action = '', bool $timeStamp = false)
|
||||
{
|
||||
if ($timeStamp) {
|
||||
$data['title'] = $data['title'] . date();
|
||||
}
|
||||
|
||||
$this->jsonPayload["data"]["notification"]["title"] = $title;
|
||||
$this->jsonPayload["data"]["notification"]["body"] = $body;
|
||||
$this->jsonPayload["data"]["notification"]["icon"] = $icon;
|
||||
|
@ -119,7 +119,7 @@ class Utilities
|
||||
case '>=': // Greater than or equal to
|
||||
return $value1 >= $value2;
|
||||
case '==': // Equal
|
||||
return $value1 == $value2;
|
||||
return ($value1 == $value2);
|
||||
case '===': // Identical
|
||||
return $value1 === $value2;
|
||||
case '!==': // Not Identical
|
||||
|
@ -62,9 +62,6 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php $LANGMNG->echo('t_time');?></th>
|
||||
<?php if (DEBUGMOD) { ?>
|
||||
<th><?php $LANGMNG->echo('t_raw');?></th>
|
||||
<?php } ?>
|
||||
<th><?php $LANGMNG->echo('t_state');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -72,10 +69,12 @@
|
||||
<?php foreach ($SUBDEVICE['events'] as $key => $value) { ?>
|
||||
<tr>
|
||||
<td><?php echo (new DateTime($value['time']))->format(DATEFORMAT); ?></td>
|
||||
<?php if (DEBUGMOD) { ?>
|
||||
<td><?php echo $SUBDEVICE['eventsRaw'][$key]['value']; ?></td>
|
||||
<?php } ?>
|
||||
<td title="test"><?php echo $value['value'] . $SUBDEVICE['unit'];?></td>
|
||||
<td title="test"><?php
|
||||
echo $value['value'] . $SUBDEVICE['unit'];
|
||||
if (DEBUGMOD) {
|
||||
echo ' (' . $SUBDEVICE['eventsRaw'][$key]['value'] . ')';
|
||||
}
|
||||
?></td>
|
||||
<?php //TODO: P5IDAT TOOLTIP PRO RAW VALUE?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
@ -69,15 +69,21 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="label">IP:</div>
|
||||
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['ip']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
|
||||
<input class="input" type="text" name="deviceIp" value="<?php echo $DEVICE['ip']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="label">Subnet:</div>
|
||||
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['subnet']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
|
||||
<input class="input" type="text" name="deviceSubnet" value="<?php echo $DEVICE['subnet']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="label">Gateway:</div>
|
||||
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['gateway']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
|
||||
<input class="input" type="text" name="deviceGateway" value="<?php echo $DEVICE['gateway']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
|
||||
</div>
|
||||
|
||||
<?php //TODO: ADD DNS TO DB MAKE ALL NETWORK SETTING EDITABLE ?>
|
||||
<div class="field">
|
||||
<div class="label">DNS:</div>
|
||||
<input class="input" type="text" name="deviceDns" value="<?php echo $DEVICE['dns']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
|
||||
</div>
|
||||
<?php if ($DEVICE['userIsAdmin']) { ?>
|
||||
<?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door', 'water'])) { ?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="col-12 col-md-6 col-xl-4 square-wrap noselect">
|
||||
<div class="rectangle-2">
|
||||
<div class="square-content double" id="scene-<?php echo $SCENEID ?>" onClick="ajaxPost('ajax',{scene_id:'<?php echo $SCENEID; ?>'}, this);" >
|
||||
<div class="square-content double" id="scene-<?php echo $SCENEID ?>" onClick="ajaxPost('ajax',{scene_id:'<?php echo $SCENEID; ?>',action:'execute'}, this);" >
|
||||
<div class="row">
|
||||
<div class="col-1">
|
||||
<h5 class="fa noselect">
|
||||
|
Loading…
Reference in New Issue
Block a user