From db5b8d8e161892c680420daf9f8b9984f01b0fde Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 15 Aug 2019 18:06:29 +0200 Subject: [PATCH] . --- .idea/workspace.xml | 34 +++++++++++++++++++++------------- config/coffee.php | 10 ++++++++++ config/cuisine.php | 19 ++++++++++--------- config/default.php | 1 + config/entree.php | 1 + config/salon.php | 1 + config/sdb.php | 1 + js/home.js | 7 ++++++- scripts/ifttt.php | 3 +++ scripts/lib/ifttt.php | 5 +++++ scripts/lib/lib.php | 4 ++++ scripts/lib/scenes.php | 5 +++++ style/style.css | 6 ++++++ style/style.less | 8 ++++++++ 14 files changed, 82 insertions(+), 23 deletions(-) create mode 100644 config/coffee.php create mode 100644 scripts/ifttt.php create mode 100644 scripts/lib/ifttt.php diff --git a/.idea/workspace.xml b/.idea/workspace.xml index f80dce1..697054a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,12 +2,20 @@ + + + - - - + + + + + + + - + + diff --git a/config/coffee.php b/config/coffee.php new file mode 100644 index 0000000..4965ce9 --- /dev/null +++ b/config/coffee.php @@ -0,0 +1,10 @@ + 'ifttt', 'event' => 'coffee_on', 'label' => 'Allumer'], + ['type' => 'ifttt', 'event' => 'coffee_off', 'label' => 'éteindre'], + ['type' => 'separator', 'label' => 'Cafés'], + ['type' => 'ifttt', 'event' => 'coffee_vincent', 'label' => 'Vincent'], + ['type' => 'ifttt', 'event' => 'coffee_jerome', 'label' => 'Jérôme'], + ['type' => 'ifttt', 'event' => 'coffee_expresso', 'label' => 'Expresso'], + ['type' => 'ifttt', 'event' => 'coffee_americano', 'label' => 'Americano'], +]; \ No newline at end of file diff --git a/config/cuisine.php b/config/cuisine.php index ae72175..3f29093 100644 --- a/config/cuisine.php +++ b/config/cuisine.php @@ -2,23 +2,24 @@ config('ROOM_NAME', 'Cuisine'); config('ROOM', 'cuisine'); config('SQUEEZEBOX_PLAYER', 'Cuisine'); -config('HIDEMASK_TIMEOUT',250); +config('HIDEMASK_TIMEOUT', 250); if (DISPLAYINTERFACE) { - $c = cuisine(); + $c = cuisine(); - $favoriteslights = [ - ['type' => 'volume', 'volume' => '5%', 'increase' => '+', 'label' => ''], - ['type' => 'volume', 'volume' => '5%', 'increase' => '-', 'label' => ''], - ]; - $favoriteslights = array_merge($favoriteslights, $c['favorites']); + $favoriteslights = [ + ['type' => 'volume', 'volume' => '5%', 'increase' => '+', 'label' => ''], + ['type' => 'volume', 'volume' => '5%', 'increase' => '-', 'label' => ''], + ]; + $favoriteslights = array_merge($favoriteslights, $c['favorites']); - include "default.php"; + include "default.php"; - $nav = ' + $nav = ' + '; diff --git a/config/default.php b/config/default.php index 3345396..859ac41 100644 --- a/config/default.php +++ b/config/default.php @@ -24,6 +24,7 @@ $shortcuts['home'] = array_merge([ ], $favoriteslights, $roomshome); include ROOT . '/config/settings.php'; +include ROOT . '/config/coffee.php'; profile('Set settings', __FILE__, __LINE__); if (hasConfig('SQUEEZEBOX_PLAYER')) { diff --git a/config/entree.php b/config/entree.php index 1c5959e..d29cfd0 100644 --- a/config/entree.php +++ b/config/entree.php @@ -22,6 +22,7 @@ if (DISPLAYINTERFACE) { $nav = ' + '; diff --git a/config/salon.php b/config/salon.php index 6940993..b08a8bf 100644 --- a/config/salon.php +++ b/config/salon.php @@ -26,6 +26,7 @@ if (DISPLAYINTERFACE) { + '; diff --git a/config/sdb.php b/config/sdb.php index e21e0fb..431ed3d 100644 --- a/config/sdb.php +++ b/config/sdb.php @@ -20,6 +20,7 @@ if (DISPLAYINTERFACE) { + '; diff --git a/js/home.js b/js/home.js index 96f7d04..9dfa37e 100644 --- a/js/home.js +++ b/js/home.js @@ -4,7 +4,7 @@ if (!raspberry && !iOS) { CONFIG.SLEEPTYPE = 'off'; } var defaultSleepTime = CONFIG.SLEEPSCREEN; -var hideMaskTimeout=parseInt(CONFIG.HIDEMASK_TIMEOUT); +var hideMaskTimeout = parseInt(CONFIG.HIDEMASK_TIMEOUT); var defaultVolume = parseInt(CONFIG.VOLUME); if (isNaN(defaultVolume)) { defaultVolume = 0; @@ -97,6 +97,11 @@ $(function () { return true; }); + $(document).on(clickevent, '.ifttt', function () { + $.get('scripts/ifttt.php?event=' + $(this).data('event')); + return false; + }); + $(document).on(clicktouchevent, 'a[data-menu]', function () { $("#iframeHolder").hide(); window.location.hash = "#/section/" + $(this).data('menu'); diff --git a/scripts/ifttt.php b/scripts/ifttt.php new file mode 100644 index 0000000..5aceb41 --- /dev/null +++ b/scripts/ifttt.php @@ -0,0 +1,3 @@ + 'scene', 'scene' => 'chambre/planetarium/off'], ['type' => 'function', 'function' => 'bedbrightness', 'args' => [255]], ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Matin'], + ['type' => 'ifttt', 'event' => 'coffee_on'], ], 'chambre/deshumidificateur/on' => [ // ['type' => 'insteon', 'command' => '0?1138=I=0=0'], @@ -466,6 +467,8 @@ $scenes = [ ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Stop All Sounds'], ['type' => 'scene', 'scene' => 'salon/freebox/off'], ['type' => 'scene', 'scene' => 'sdb/ampli/off'], + ['type' => 'ifttt', 'event' => 'coffee_off'], + ['type' => 'ifttt', 'event' => 'oven_off'], ], 'home/welcome' => [ ['type' => 'ecomode', 'mode' => '0'], @@ -628,6 +631,8 @@ function execScene($name, $fromUserAction = false, $transitionTime = null) domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', isset($action['priority']) && $action['priority']); } else if ($action['type'] == 'ir') { irsend($action['room'], $action['device'], $action['command']); + } else if ($action['type'] == 'ifttt') { + ifttt($action['event']); } } } diff --git a/style/style.css b/style/style.css index 88e475a..c3768fe 100644 --- a/style/style.css +++ b/style/style.css @@ -63,6 +63,12 @@ header a .fa-tv { -webkit-transform-origin: 0 0; transform-origin: 0 0; } +header a .fa-coffee { + -webkit-transform: scaleX(0.85); + transform: scaleX(0.85); + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} .fit { transform-origin: 0 0; -webkit-transform-origin: 0 0; diff --git a/style/style.less b/style/style.less index 7fff694..5039b2d 100644 --- a/style/style.less +++ b/style/style.less @@ -74,6 +74,14 @@ header { -webkit-transform-origin: 0 0; transform-origin: 0 0; } + + .fa-coffee { + -webkit-transform: scaleX(0.85); + transform: scaleX(0.85); + + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + } } } -- 2.39.5