diff --git a/.gitignore b/.gitignore index 24ceb95..43c0f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .ftpconfig +.ftpconfig2 config.php _nemazat/index.html _nemazat/css/main.css.map diff --git a/.htaccess b/.htaccess index 1d7e144..a516291 100644 --- a/.htaccess +++ b/.htaccess @@ -2,7 +2,7 @@ Options -Indexes Options -MultiViews -Indexes RewriteEngine On -RewriteBase / +RewriteBase /vasek/home/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d @@ -10,8 +10,8 @@ RewriteCond %{REQUEST_FILENAME} !.css RewriteCond %{REQUEST_FILENAME} !.js RewriteRule (.*) index.php?url=$1 [QSA,L] -#RewriteCond %{HTTPS} off -#RewriteCond %{REQUEST_FILENAME} !api.php -#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] +RewriteCond %{HTTPS} off +RewriteCond %{REQUEST_FILENAME} !api.php +RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] AddType application/x-httpd-php .php .phtml diff --git a/_FIRMWARE/firmwares/Shelly1/Shelly1_arduino_ide_setting.png b/_FIRMWARE/firmwares/Shelly1/Shelly1_arduino_ide_setting.png new file mode 100644 index 0000000..02beef6 Binary files /dev/null and b/_FIRMWARE/firmwares/Shelly1/Shelly1_arduino_ide_setting.png differ diff --git a/_FIRMWARE/firmwares/Shelly1/Shelly1_v1/Shelly1_v1.ino b/_FIRMWARE/firmwares/Shelly1/Shelly1_v1/Shelly1_v1.ino new file mode 100644 index 0000000..b5fd438 --- /dev/null +++ b/_FIRMWARE/firmwares/Shelly1/Shelly1_v1/Shelly1_v1.ino @@ -0,0 +1,210 @@ +//Includes +#include +#include +#include +#include + +//Variables +const char* ssid = "Smart-Home"; +const char* pasw = "S1pjg3684dcCPTUQ"; +const char* hwId = "55f4g8d6ggh"; +const char* server = "http://dev.steelants.cz/vasek/home/api.php"; +int unsuccessfulRounds = 0; //Unsucesful atmpt counter +StaticJsonDocument<250> jsonContent; +bool buttonActive = false; +int interuptCount = 0; +int realState = 1; +int state = 0; +String requestJson = ""; + +//Pins +#define RELAY 4 //12 +#define SWITCH 5 //0 + +void ICACHE_RAM_ATTR handleInterrupt (); + +void setup() { + Serial.begin(9600); + EEPROM.begin(1); + while (!Serial) continue; + delay(10); + Serial.println('\n'); + Serial.println("HW: " + String(hwId)); + + pinMode(SWITCH, INPUT); + pinMode(RELAY, OUTPUT); + state = EEPROM.read(0); + digitalWrite(RELAY, state); + realState = state; + + attachInterrupt(digitalPinToInterrupt(SWITCH), handleInterrupt, CHANGE); + + + WiFi.persistent(false); + WiFi.mode(WIFI_STA); + + WiFi.begin(ssid, pasw); + checkConnection(); + + Serial.println('\n'); + Serial.println("Connection established!"); + Serial.print("IP address:"); + Serial.println(WiFi.localIP()); + Serial.print("MAC address:"); + Serial.println(WiFi.macAddress()); + + jsonContent = {}; + jsonContent["token"] = hwId; + jsonContent["values"]["on/off"]["value"] = (String)realState; + + serializeJson(jsonContent, requestJson); + Serial.println("JSON: " + requestJson); + DeserializationError error = deserializeJson(jsonContent, sendHttpRequest(requestJson)); +} + +void loop() { + if(unsuccessfulRounds >= 5) { + Serial.println("RESTARTING ESP"); + ESP.restart(); + } + jsonContent = {}; + jsonContent["token"] = hwId; + requestJson = ""; + if (buttonActive){ + int realStateLocal = digitalRead(SWITCH); + jsonContent["values"]["on/off"]["value"] = (String)realStateLocal; + digitalWrite(RELAY, realStateLocal); + realState = realStateLocal; + EEPROM.write(0, realState); + EEPROM.commit(); + serializeJson(jsonContent, requestJson); + Serial.println("JSON: " + requestJson); + + //HTTP CLIENT + DeserializationError error = deserializeJson(jsonContent, sendHttpRequest(requestJson)); + buttonActive = false; + } + jsonContent = {}; + jsonContent["token"] = hwId; + requestJson = ""; + serializeJson(jsonContent, requestJson); + Serial.println("JSON: " + requestJson); + + //HTTP CLIENT + DeserializationError error = deserializeJson(jsonContent, sendHttpRequest(requestJson)); + + if (error) { + Serial.println(error.c_str()); + unsuccessfulRounds++; + Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5"); + return; + } + //configuration setup + String hostName = jsonContent["device"]["hostname"]; + String ipAddress = jsonContent["device"]["ipAddress"]; + String gateway = jsonContent["device"]["gateway"]; + String subnet = jsonContent["device"]["subnet"]; + String requestState = jsonContent["state"]; + JsonObject object = jsonContent.as(); + if (!object["value"].isNull()) { + state = (int)jsonContent["value"]; + } + + if (requestState != "succes") { + unsuccessfulRounds++; + Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5"); + } else if (requestState == "succes") { + unsuccessfulRounds = 0; + } + + //Set static ip + setStaticIp(ipAddress, gateway, subnet); + WiFi.hostname(hostName); + Serial.println("state: " + (String)state + ", realState: " + (String)realState); + if (state != realState){ + if (state == 1 && realState == 0) { + Serial.println("ON state: " + (String)state + ", realState: " + (String)realState); + digitalWrite(RELAY, HIGH); // Turn the LED on by making the voltage LOW + realState = 1; + } else { + Serial.println("OFF"); + digitalWrite(RELAY, LOW); // Turn the LED on by making the voltage LOW + realState = 0; + } + EEPROM.write(0, realState); + EEPROM.commit(); + } +} + +void handleInterrupt() { + interuptCount++; + buttonActive = true; +} + +String sendHttpRequest (String requestJson) { + HTTPClient http; + http.setReuse(true); + http.begin(server); + http.addHeader("Content-Type", "text/plain"); //Specify content-type header + + int httpCode = http.POST(requestJson); + String payload = http.getString(); //Get the response payload + http.end(); + + Serial.println("HTTP CODE: " + String(httpCode) + ""); //Print HTTP return code + Serial.println("HTTP BODY: " + String(payload) + ""); //Print request response payload + + if (httpCode == -1) { + unsuccessfulRounds++; + Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5"); + return ""; + } + return payload; +} + +bool checkConnection() { + int count = 0; + Serial.print("Waiting for Wi-Fi connection"); + while ( count < 30 ) { + if (buttonActive){ + if (!realState == 1) { + digitalWrite(RELAY, HIGH); + realState = 1; + } else if (!realState == 0){ + digitalWrite(RELAY, LOW); + realState = 0; + } + EEPROM.write(0, realState); + EEPROM.commit(); + buttonActive = false; + } + delay(250); + if (WiFi.status() == WL_CONNECTED) { + Serial.println(); + Serial.println("Connected!"); + return (true); + } + Serial.print("."); + count++; + } + Serial.println("Timed out."); + return false; +} + +void setStaticIp(String ipAddress, String subnet, String gateway){ + //Set static ip + IPAddress staticIpAddress; + IPAddress subnetIpAddress; + IPAddress gatewayIpAddress; + + if ( + staticIpAddress.fromString(ipAddress) && + subnetIpAddress.fromString(subnet) && + gatewayIpAddress.fromString(gateway) && + WiFi.localIP() != staticIpAddress + ) { + WiFi.config(staticIpAddress, subnetIpAddress, gatewayIpAddress); + Serial.print("STATIC IP address:"); + Serial.println(WiFi.localIP()); + } +} diff --git a/_FIRMWARE/firmwares/Sonoff_Basic/Sonoff_Basic_v3/Sonoff_Basic_v3.ino b/_FIRMWARE/firmwares/Sonoff_Basic/Sonoff_Basic_v3/Sonoff_Basic_v3.ino index e0ee21d..c9de47f 100644 --- a/_FIRMWARE/firmwares/Sonoff_Basic/Sonoff_Basic_v3/Sonoff_Basic_v3.ino +++ b/_FIRMWARE/firmwares/Sonoff_Basic/Sonoff_Basic_v3/Sonoff_Basic_v3.ino @@ -5,9 +5,9 @@ #include //Variables -const char* ssid = "ssid"; -const char* pasw = "pasw"; -const char* hwId = "hwId"; +const char* ssid = "Smart-Home"; +const char* pasw = "S1pjg3684dcCPTUQ"; +const char* hwId = "452r5s8dad"; const char* server = "http://dev.steelants.cz/vasek/home/api.php"; int unsuccessfulRounds = 0; //Unsucesful atmpt counter StaticJsonDocument<250> jsonContent; diff --git a/api.php b/api.php index 4b682b5..ebc6f6e 100644 --- a/api.php +++ b/api.php @@ -38,6 +38,7 @@ Db::connect (DBHOST, DBUSER, DBPASS, DBNAME); //Read API data $json = file_get_contents('php://input'); $obj = json_decode($json, true); +$logManager->write("[API] Rest API request body -> decodet to json \n" . json_encode($obj, JSON_PRETTY_PRINT), LogRecordType::INFO); //zabespecit proti Ddosu if (isset($obj['user']) && $obj['user'] != ''){ @@ -69,9 +70,10 @@ if (DEBUGMOD != 1) { //automationExecution try { + AutomationManager::executeAll(); $fallbackManager = new FallbackManager(RANGES); $fallbackManager->check(); - AutomationManager::executeAll(); + //LogKeeper::purge(LOGTIMOUT); } catch (\Exception $e) { $logManager->write("[Automation] Something happen during automation execution", LogRecordType::ERROR); } diff --git a/app/class/FallbackManager.php b/app/class/FallbackManager.php index a775074..cb3fb79 100644 --- a/app/class/FallbackManager.php +++ b/app/class/FallbackManager.php @@ -2,6 +2,9 @@ /** * */ + + + class FallbackManager { public $deviceDefinitions = ""; @@ -13,7 +16,7 @@ class FallbackManager function check(){ //TODO: FIX IT - /*$allDevicesData = DeviceManager::getAllDevices(); + $allDevicesData = DeviceManager::getAllDevices(); foreach ($allDevicesData as $deviceKey => $deviceValue) { $allSubDevicesData = SubDeviceManager::getAllSubDevices($deviceValue['device_id']); foreach ($allSubDevicesData as $subDeviceKey => $subDeviceValue) { @@ -21,13 +24,21 @@ class FallbackManager continue; } + if (!isset($this->deviceDefinitions[$subDeviceValue['type']]["fallBackTime"])) { + continue; + } + $lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']); - $minutes = (time() - $lastRecord['time']) / 60; - echo $minutes; - if ( $minutes > 2){ + if ($lastRecord["value"] == $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]) { + continue; + } + + $minutes = (time() - strtotime($lastRecord['time'])) / 60; + + if ( $minutes > $this->deviceDefinitions[$subDeviceValue['type']]["fallBackTime"]){ RecordManager::create($deviceValue['device_id'], $subDeviceValue['type'], $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]); } } - }*/ + } } } diff --git a/app/class/LogManager.php b/app/class/LogManager.php index 5d2d984..95f82f4 100644 --- a/app/class/LogManager.php +++ b/app/class/LogManager.php @@ -9,6 +9,25 @@ class LogRecordType{ const INFO = 'info'; } +class LogKeeper +{ + function purge($days){ + $todayFileName = date("Y-m-d").'.log'; + $seconds = $days * 86400; + + $logFiles = scandir('./app/logs/'); + foreach ($logFiles as $key => $file) { + if (in_array($file,array(".","..", ".gitkeep", $todayFileName))) + { + continue; + } + if (filemtime($file) > $seconds) { + unlink('./app/logs/'.$file); + } + } + } +} + class LogManager { diff --git a/app/class/RecordManager.php b/app/class/RecordManager.php index e98eda6..22682f9 100644 --- a/app/class/RecordManager.php +++ b/app/class/RecordManager.php @@ -67,7 +67,7 @@ class RecordManager{ public static function clean ($day) { if (isset($day)) { - Db::command ('DELETE FROM records WHERE time < ADDDATE(NOW(), INTERVAL -? DAY);', array($day)); + Db::command ('DELETE FROM records WHERE `time` < ADDDATE(NOW(), INTERVAL -? DAY);', array($day)); } } diff --git a/app/class/Template.php b/app/class/Template.php index 4d99dab..0ebafb7 100644 --- a/app/class/Template.php +++ b/app/class/Template.php @@ -27,7 +27,7 @@ class Template extends Partial{ function render() { extract($this->assignedValues); if (!empty('app/controls/' . $this->path . '.php') && file_exists('app/controls/' . $this->path . '.php')) { - require_once('app/controls/' . $this->path . '.php'); + include('app/controls/' . $this->path . '.php'); } require_once('app/templates/' . $this->path . '.phtml'); } diff --git a/app/controls/automation.php b/app/controls/automation.php index 3fe2ac9..446f9c2 100644 --- a/app/controls/automation.php +++ b/app/controls/automation.php @@ -9,15 +9,15 @@ if (isset($_POST) && !empty($_POST)){ $onDays = $_POST['atDays']; //Debug - if (DEBUGMOD == 1) { - echo '
';
-			echo $permissionsInJson;
-			echo $deviceId;
-			var_dump(json_decode ($permissionsInJson));
-			echo '
'; - echo 'CONTINUE'; - die(); - } + // if (DEBUGMOD == 1) { + // echo '
';
+		// 	echo $permissionsInJson;
+		// 	echo $deviceId;
+		// 	var_dump(json_decode ($permissionsInJson));
+		// 	echo '
'; + // echo 'CONTINUE'; + // die(); + // } AutomationManager::create($_POST['name'], $onDays, $doCode, $ifCode); diff --git a/app/templates/js/script.js b/app/templates/js/script.js index 335dacb..3df7ca2 100644 --- a/app/templates/js/script.js +++ b/app/templates/js/script.js @@ -64,16 +64,16 @@ if ('serviceWorker' in navigator) { $('select[name="atSelector"]').change(function(e) { console.log($(this).val()); if( $(this).val() == 'time') { - + $('input[name="atTime"]').prop( "disabled", false ); - + $('select[name="atDeviceValueInt"]').prop( "disabled", true ); $('input[name="atDeviceValue"]').prop( "disabled", true ); } else if( $(this).val() == 'atDeviceValue') { - + $('select[name="atDeviceValue"]').prop( "disabled", false ); $('input[name="atDeviceValueInt"]').prop( "disabled", false ); - + $('input[name="atTime"]').prop( "disabled", true ); } }); @@ -88,7 +88,7 @@ $("div.square-content").on('touchend', function (e){ $("div.square-content").on('touchstart', function (eTarget) { navigator.vibrate([500]); var id = ''; - + var windowLoc = $(location).attr('pathname'); windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/")); console.log(windowLoc); @@ -99,9 +99,9 @@ $("div.square-content").on('touchstart', function (eTarget) { } else if (windowLoc == "/automation") { id = $(this).attr('id').replace('automation-', ''); } - + var subId = $(this).attr('data-sub-device-id'); - + touch++; if(touch == 2 && touchSubId == subId){ console.log("Detail"); @@ -109,7 +109,7 @@ $("div.square-content").on('touchstart', function (eTarget) { $("#modal-detail-"+subId).removeClass('modal-container-hiden').show(); ajaxChart(subId); } else if (windowLoc == "/scene") { - + } else if (windowLoc == "/automation") { } touch = 0; @@ -117,7 +117,7 @@ $("div.square-content").on('touchstart', function (eTarget) { return; } touchSubId = subId; - + pressTimer = window.setTimeout(function (e) { console.log("Setting"); $("#modal-setting-"+id).removeClass('modal-container-hiden').show(); @@ -202,14 +202,14 @@ var windowLoc = $(location).attr('pathname'); windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/")); console.log(); if (windowLoc == "/") { - + var selectRoomId = localStorage.getItem("selectedRoomId"); - + if (selectRoomId == null) { selectRoomId = 'all'; } - - + + console.log('Saved Selected Room ID '+ selectRoomId); $('[name="room"]').val(selectRoomId); $('.device-button').each(function(){ @@ -221,8 +221,8 @@ if (windowLoc == "/") { } } }); - - + + } //Room selector @@ -239,51 +239,55 @@ $( '[name="room"]' ).change(function (e) { }); } }); + + /* var windowLoc = $(location).attr('pathname'); windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/")); console.log(); if (windowLoc == "/") { -var autoUpdate = setInterval(function(){ -if (pending == false) { -pending = true; -$.ajax({ -url: 'ajax', -type: 'POST', -dataType: 'json', -data: { -"action": 'getState' -}, -success: function(data){ -console.log(data); -for (const key in data) { -if (data.hasOwnProperty(key)) { -const device = data[key]; -$('[data-sub-device-id="'+key+'"]') -.find('.device-button-value') -.text(device['value']) -.attr('title',device['time']) -} -} -}, -error: function (request, status, error) { -console.log("ERROR ajaxChart():", request, error); -}, -complete: function (){ -pending = false; -} -}); -} -},4000); + var autoUpdate = setInterval(function(){ + if (pending == false) { + pending = true; + $.ajax({ + url: 'ajax', + type: 'POST', + dataType: 'json', + data: { + "action": 'getState' + }, + success: function(data){ + console.log(data); + for (const key in data) { + if (data.hasOwnProperty(key)) { + const device = data[key]; + $('[data-sub-device-id="'+key+'"]') + .find('.device-button-value') + .text(device['value']) + .attr('title',device['time']) + } + } + }, + error: function (request, status, error) { + console.log("ERROR ajaxChart():", request, error); + }, + complete: function (){ + pending = false; + } + }); + } + },4000); }*/ + + //Graphs $('.graph-period').on('click', function (e) { var subId = $(this).attr('data-sub-device-id'); var period = $(this).attr('data-period'); var groupBy = $(this).attr('data-group'); - + ajaxChart(subId, period, groupBy); }); diff --git a/app/templates/log.phtml b/app/templates/log.phtml index c747c83..97b11b5 100644 --- a/app/templates/log.phtml +++ b/app/templates/log.phtml @@ -22,6 +22,7 @@
+
/>echo('l_use'); ?> />echo('l_edit'); ?> - +
@@ -156,10 +156,10 @@
- + - - + +
diff --git a/app/views/Ajax.php b/app/views/Ajax.php index 1a97418..7276de2 100644 --- a/app/views/Ajax.php +++ b/app/views/Ajax.php @@ -145,6 +145,77 @@ class Ajax extends Template echo 'no action detected'; break; } + } else if ( + isset($_POST['action']) && + $_POST['action'] != '' + ) { + $updateData = []; + $allDevicesData = DeviceManager::getAllDevices(); + foreach ($allDevicesData as $deviceKey => $deviceValue) { + $allSubDevices = SubDeviceManager::getAllSubDevices($deviceValue['device_id']); + foreach ($allSubDevices as $key => $subDevicesData) { + + $lastRecord = RecordManager::getLastRecord($subDevicesData['subdevice_id']); + $parsedValue = $lastRecord['value'] . $subDevicesData['unit']; + + //TODO: udělat parser a ten použít jak v houmu tak zde + switch ($subDevicesData['type']) { + case 'on/off': + $replacementTrue = 'On'; + $replacementFalse = 'Off'; + $operator = '=='; + $breakValue = 1; + break; + + case 'door': + $replacementTrue = 'Closed'; + $replacementFalse = 'Open'; + $operator = '=='; + $breakValue = 1; + break; + + case 'light': + $replacementTrue = 'Light'; + $replacementFalse = 'Dark'; + $operator = '=='; + $breakValue = 1; + if ($lastRecord['value'] != 1 && $lastRecord['value'] != 0) { //Digital Light Senzor + $operator = '<'; + $breakValue = 810; + } + break; + + case 'water': + $replacementTrue = 'Wet'; + $replacementFalse = 'Dry'; + $operator = '=='; + $breakValue = 1; + break; + + default: + $replacementTrue = ''; + $replacementFalse = ''; + break; + } + + if ($replacementTrue != '' && $replacementFalse != '') { + //parsing last values + $parsedValue = $replacementFalse; + + if (Utilities::checkOperator($lastRecord['value'], $operator, $breakValue)) { + $parsedValue = $replacementTrue; + } + } + + $updateData[$subDevicesData['subdevice_id']] = [ + 'time' => $lastRecord['time'], + 'value' => $parsedValue, + ]; + } + } + + //TODO: PRO JS VRACET DATA + echo json_encode($updateData, JSON_PRETTY_PRINT); } } } diff --git a/app/views/Home.php b/app/views/Home.php index cee57d4..b9b2f4d 100644 --- a/app/views/Home.php +++ b/app/views/Home.php @@ -7,11 +7,6 @@ class Home extends Template { global $userManager; global $langMng; - $roomManager = new RoomManager(); - $deviceManager = new DeviceManager(); - $subDeviceManager = new SubDeviceManager(); - $recordManager = new RecordManager(); - $utilities = new Utilities(); if (!$userManager->isLogin()){ header('Location: ' . BASEDIR . 'login'); @@ -20,7 +15,7 @@ class Home extends Template $template = new Template('home'); //users instantialize - $users = $userManager->getUsers(); + $users = UserManager::getUsers(); $template->prepare('users', $users); //Users at home Info @@ -39,16 +34,16 @@ class Home extends Template $roomsItems = []; - $roomsData = $roomManager->getAllRooms(); + $roomsData = RoomManager::getAllRooms(); foreach ($roomsData as $roomKey => $roomsData) { $devices = []; - $devicesData = $deviceManager->getAllDevicesInRoom($roomsData['room_id']); + $devicesData = DeviceManager::getAllDevicesInRoom($roomsData['room_id']); foreach ($devicesData as $deviceKey => $deviceData) { $subDevices = []; - $subDevicesData = $subDeviceManager->getAllSubDevices($deviceData['device_id']); + $subDevicesData = SubDeviceManager::getAllSubDevices($deviceData['device_id']); foreach ($subDevicesData as $subDeviceKey => $subDeviceData) { - $events = $recordManager->getLastRecord($subDeviceData['subdevice_id'], 5); + $events = RecordManager::getLastRecord($subDeviceData['subdevice_id'], 5); $eventsRaw = $events; $connectionError = true; @@ -105,7 +100,7 @@ class Home extends Template //parsing last values $parsedValue = $replacementFalse; - if ($utilities->checkOperator($lastValue, $operator, $breakValue)) { + if (Utilities::checkOperator($lastValue, $operator, $breakValue)) { $parsedValue = $replacementTrue; } @@ -113,14 +108,14 @@ class Home extends Template //parsing last events values foreach ($events as $key => $value) { $events[$key]['value'] = $replacementFalse; - if ($utilities->checkOperator($value['value'], $operator, $breakValue)) { + if (Utilities::checkOperator($value['value'], $operator, $breakValue)) { $events[$key]['value'] = $replacementTrue; } } } $LastRecordTime = new DateTime($lastRecord['time']); - $niceTime = $utilities->ago($LastRecordTime); + $niceTime = Utilities::ago($LastRecordTime); $interval = $LastRecordTime->diff(new DateTime()); $hours = $interval->format('%h'); @@ -180,7 +175,7 @@ class Home extends Template ]; } - $rooms = $roomManager->getAllRooms(); + $rooms = RoomManager::getAllRooms(); $template->prepare('baseDir', BASEDIR); $template->prepare('debugMod', DEBUGMOD); $template->prepare('title', 'Home'); diff --git a/app/views/Log.php b/app/views/Log.php index 3e80f29..fae038a 100644 --- a/app/views/Log.php +++ b/app/views/Log.php @@ -26,6 +26,8 @@ class Log extends Template } $template->prepare('baseDir', BASEDIR); + $template->prepare('debugMod', DEBUGMOD); + $template->prepare('logToLiveTime', LOGTIMOUT); $template->prepare('title', 'Logy'); $template->prepare('logsFiles', $result); $template->prepare('langMng', $langMng); diff --git a/make.sh b/make.sh new file mode 100644 index 0000000..94978ba --- /dev/null +++ b/make.sh @@ -0,0 +1,34 @@ +#! /bin/sh +apt install dialog; + +#dialog --stdout --title "Smart-Home" \ + #--backtitle "Select update chanel :)" \ + #--yesno "DEV: Experimental Version, STABLE: Stable version" 7 60 +#dialog_status=$? + +# Do something +dialog --menu "The best tortilla is:" 0 0 0 1 "with onions" 2 "without onion" 3 "with piminetos" +echo "answer $?"; +#if [ "$dialo_status" -eq 'DEV' ]; then + # The previous dialog was answered Yes + #git checkout dev; +#else + # The previous dialog was answered No or interrupted with + #git checkout master; +#fi + +#clear; + +#git reset --hard HEAD +#git pull + +#rm ./.gitignore +#rm ./.ftpignore +#rm ./.todo +#rm ./LICENCE +#rm ./README.md +#rm -rf ./_FIRMWARE/* +#rm -rf ./_INSTALATION/* +#rm -rf ./_README_IMG/* + +echo "Done"; diff --git a/manifest.json b/manifest.json index 5aa8274..16775df 100644 --- a/manifest.json +++ b/manifest.json @@ -3,20 +3,20 @@ "short_name": "Home", "description": "Smart Home interface in PWA", "lang": "cs-CZ", - "start_url": "/", - "scope": "/", + "start_url": "/vasek/home/", + "scope": "/vasek/home/", "display": "fullscreen", "orientation": "portrait", "theme_color": "#182239", "icons": [ { - "src": "/app/templates/images/icon-192x192.png", + "src": "/vasek/home/app/templates/images/icon-192x192.png", "sizes": "192x192" }, { - "src": "/app/templates/images/icon-512x512.png", + "src": "/vasek/home/app/templates/images/icon-512x512.png", "sizes": "512x512" } ], "background_color": "#182239" -} +} \ No newline at end of file diff --git a/old.home b/old.home new file mode 100644 index 0000000..6da48ed --- /dev/null +++ b/old.home @@ -0,0 +1,180 @@ +