]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 24 Apr 2024 07:32:13 +0000 (09:32 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 24 Apr 2024 07:32:13 +0000 (09:32 +0200)
14 files changed:
.idea/workspace.xml
config/coffee.php
config/global.php
js/home.js
scripts/cron/cron.php
scripts/domoticz_status.php [deleted file]
scripts/ifttt.php [deleted file]
scripts/lib/domoticz.php [deleted file]
scripts/lib/flowerpower.php [deleted file]
scripts/lib/ifttt.php [deleted file]
scripts/lib/lib.php
scripts/lib/scenes.php
scripts/lib/weatherstation.php
tools/flowerpower.js [deleted file]

index 3bdac88cbc96bf37e43590ebac0266d54b7d203f..99c8e25ac9f7a12b46444fbb1bafdf0a01239b4d 100644 (file)
@@ -6,9 +6,18 @@
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/homeassistant.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/homeassistant.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/homeconnect.php" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/coffee.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/coffee.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/cron/cron.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cron/cron.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/domoticz_status.php" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/domoticz.php" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/flowerpower.php" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/ifttt.php" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/weatherstation.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/weatherstation.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/tools/flowerpower.js" beforeDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1713376517416" duration="792000" />
       <workItem from="1713440657070" duration="147000" />
       <workItem from="1713531985684" duration="2444000" />
-      <workItem from="1713941353441" duration="532000" />
+      <workItem from="1713941353441" duration="2332000" />
     </task>
     <task id="LOCAL-00502" summary=".">
       <created>1641726946298</created>
       <option name="project" value="LOCAL" />
       <updated>1687259667913</updated>
     </task>
-    <option name="localTasksCounter" value="614" />
+    <option name="localTasksCounter" value="615" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 31feaef6517bc5efe8e204aafb66e0beb1c4878f..bd3545d06195d81840bb816a68b3ee54cff8842a 100644 (file)
@@ -7,10 +7,4 @@ $shortcuts['coffee'] = [
     ['type' => 'separator', 'label' => 'Hotte'],
     ['type' => 'light', 'scene' => 'cuisine/hotte/on', 'label' => 'Allumer'],
     ['type' => 'light', 'scene' => 'cuisine/hotte/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
index 7c348bd87b346eecc0cd383ee44924be8b82da5d..020c0b624febeb82d8f9ca0b8a2f45ad2fa35515 100644 (file)
@@ -10,11 +10,6 @@ define("SQUEEZEBOX_SPOTIFY_PASSWORD", '?Z8}#HK+SZrQ');
 define('HUE_BRIDGE', '192.168.13.85');
 define('HUE_USER', 'zZigF7nPQq9nTZ3GTB1zkntn98trOJVFHWAwFiqQ');
 
-define('HOMECONNECT_CLIENT_ID', '97C087A66769555561D14306F34336C5D05AD97B56ED813E6BD44ECCFA980CE5');
-define('HOMECONNECT_CLIENT_SECRET', '540F102E39E86F7F92C3A534C31017264A47458589E9E66D27427F35DD4F7BFC');
-define('HOMECONNECT_USERNAME', 'vincent@enhydra.fr');
-define('HOMECONNECT_PASSWORD', 'YcR%vNmYnu%e$3dx2idM');
-
 define('LATITUDE', 48.8758392);
 define('LONGITUDE', 2.3422104);
 
index 8607a6aa9cabdce17b89ccbea24186f84be81ecc..bf7d3543c2c1de0e0c9425895e11c2e484eab3cb 100644 (file)
@@ -150,11 +150,6 @@ $(function () {
         return true;
     });
 
-    $(document).on(clickevent, '.ifttt', function () {
-        $.get('scripts/ifttt.php?event=' + $(this).data('event'));
-        return false;
-    });
-
     $(document).on(clicktouchevent, '[data-menu]', function () {
         $("#iframeHolder").hide();
         window.location.hash = "#/section/" + $(this).data('menu');
index 0430033732b7f85a10506906c4871fe6e68f4332..f39138c2265f6fe0db482bc4e5c5d28b2fa5f272 100644 (file)
@@ -253,7 +253,6 @@ function cronHarmony($cronmin) {
 function cronHeartbeat($cronmin, $devices = false) {
        _logSection('Heartbeat');
        setState('cron_heartbeat', time());
-       domoticzCmd(null);
        squeezeRequest(null);
        hueCommand(null);
 
diff --git a/scripts/domoticz_status.php b/scripts/domoticz_status.php
deleted file mode 100644 (file)
index 8e59944..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-require_once "import.php";
-
-ob_end_clean();
-echo ":::".getDomoticzDeviceStatus($_GET['device']);
\ No newline at end of file
diff --git a/scripts/ifttt.php b/scripts/ifttt.php
deleted file mode 100644 (file)
index 5aceb41..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-require_once "import.php";
-ifttt($_GET['event']);
\ No newline at end of file
diff --git a/scripts/lib/domoticz.php b/scripts/lib/domoticz.php
deleted file mode 100644 (file)
index 1a88a3b..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-function runDomoticzCommand($params)
-{
-    $default = ['type' => 'command', 'passcode' => ''];
-    $params = array_merge($default, $params);
-
-    unset($params['delay']);
-
-    $ip = 'domoticz.home.tortuga.enhydra.fr';
-    return httpRequest('http://' . $ip . ':8084/json.htm', 'GET', $params);
-}
-
-function domoticzGroup($group, $command)
-{
-    foreach ($group as $device => $delays) {
-        $delay = $command ? $delays[0] : $delays[1];
-        domoticzSwitch($device, $command, 'light', false, $delay);
-    }
-}
-
-function domoticzSwitch($device, $cmd, $type = 'light', $priority = false, $delay = 0)
-{
-    if ($cmd === 'Toogle' || $cmd === 'toogle' || $cmd === 'Toggle' || $cmd === 'toggle') {
-        $cmd = 'Toggle';
-    }
-    if (is_bool($cmd)) {
-        $cmd = $cmd ? 'On' : 'Off';
-    }
-    return domoticzCmd(['idx' => $device, 'switchcmd' => $cmd, 'param' => 'switch' . $type, 'level' => '0', 'delay' => $delay], $priority);
-}
-
-function domoticzSetLevel($device, $level, $priority = false)
-{
-    return domoticzCmd(['idx' => $device, 'switchcmd' => 'Set Level', 'param' => 'switchlight', 'level' => max(0, min(100, $level))], $priority);
-}
-
-function domoticzGetLevel($device)
-{
-    return getDomoticzDeviceStatus($device, true, 'LevelInt');
-}
-
-function domoticzCmd($command, $priority = false)
-{
-
-    $redis = connectRedis();
-    $queue_name = 'domoticz_queue';
-
-    $queue = $redis->igbget($queue_name);
-    if (!is_array($queue)) {
-        $queue = [];
-    }
-    if (null !== $command) {
-        if ($priority) {
-            array_unshift($queue, $command);
-        } else {
-            array_push($queue, $command);
-        }
-    }
-    $redis->igbset($queue_name, $queue);
-    $redis->publish('domoticz_event', 'handle_queue');
-    return true;
-}
-
-function getDomoticzDeviceStatus($device, $force = false, $key = 'Data')
-{
-    //echo ':)';
-    $res = runDomoticzCommand(['type' => 'devices', 'rid' => $device]);
-    $res = json_decode($res->getBody(), true);
-    if (null === $res || !isset($res['result']) || !count($res['result'])) {
-        echo 'Error getting status of device ' . $device . "\n" . print_r($res, true);
-        return null;
-    }
-
-    try {
-
-        $update = new DateTime($res['result'][0]['LastUpdate']);
-        $now = new DateTime();
-        if (!$force && $update->diff($now)->days > 0) {
-            return false;
-        }
-    } catch (Exception $e) {
-    }
-    return $res['result'][0][$key];
-}
diff --git a/scripts/lib/flowerpower.php b/scripts/lib/flowerpower.php
deleted file mode 100644 (file)
index ce59013..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-function updateFlowerPower()
-{
-    $devices = ['bureausun'];
-    shuffle($devices);
-    $device = array_pop($devices);
-    $res = sshRunCommand('/docker/flowerpower/run', $device, true, true);
-    $fp = explode("\n", $res['output']);
-    $map = [1 => 1467, 0 => 1468];
-    foreach ($map as $k => $v) {
-        $newValue = $fp[$k];
-        if ($v === 1467) {
-            $newValue = (float)$newValue;
-            $currentValue = toNumber(getDomoticzDeviceStatus(1467, true), false);
-            if (abs($currentValue - $newValue) > 30 || $newValue == 0 || $newValue > 60 || $newValue < -50) {
-                echo 'Out of bounds';
-                return;
-            }
-        }
-        domoticzCmd(['param' => 'udevice', 'idx' => $v, 'nvalue' => 0, 'svalue' => $newValue]);
-    }
-}
\ No newline at end of file
diff --git a/scripts/lib/ifttt.php b/scripts/lib/ifttt.php
deleted file mode 100644 (file)
index 9117f9f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-function ifttt($event)
-{
-    httpRequest('https://maker.ifttt.com/trigger/' . $event . '/with/key/5KxVqNj_tXibHw27u7uja');
-}
\ No newline at end of file
index ed4f5a08f49cff25354d174d213231eaffecf051..cabf00199ab1c86d1bfc4eae9f641a176b9d0421 100644 (file)
@@ -26,7 +26,6 @@ require_once ROOT . '/scripts/lib/tmdb.php';
 require_once ROOT . '/scripts/lib/http.php';
 require_once ROOT . '/scripts/lib/pc.php';
 require_once ROOT . '/scripts/lib/time.php';
-require_once ROOT . '/scripts/lib/domoticz.php';
 require_once ROOT . '/scripts/lib/db.php';
 require_once ROOT . '/scripts/lib/ecomode.php';
 require_once ROOT . '/scripts/lib/off.php';
@@ -42,15 +41,12 @@ require_once ROOT . '/scripts/lib/medialibrary.php';
 require_once ROOT . '/scripts/lib/heartbeats.php';
 require_once ROOT . '/scripts/lib/ssh.php';
 require_once ROOT . '/scripts/lib/cachemedia.php';
-require_once ROOT . '/scripts/lib/ifttt.php';
 require_once ROOT . '/scripts/lib/router.php';
-require_once ROOT . '/scripts/lib/flowerpower.php';
 require_once ROOT . '/scripts/lib/denon.php';
 require_once ROOT . '/scripts/lib/proc.php';
 require_once ROOT . '/scripts/lib/shield.php';
 require_once ROOT . '/scripts/lib/kodi.php';
 require_once ROOT . '/scripts/lib/climacell.php';
-require_once ROOT . '/scripts/lib/homeconnect.php';
 require_once ROOT . '/scripts/lib/wol.php';
 require_once ROOT . '/scripts/lib/switchbot.php';
 require_once ROOT . '/scripts/lib/ical.php';
@@ -351,9 +347,6 @@ function shortcut($s, $hash)
     } else if ($s['type'] == 'harmonyactivity') {
         $attrs['class'] = 'harmonyactivity';
         $attrs['data-activity'] = $s['activity'];
-    } else if ($s['type'] == 'ifttt') {
-        $attrs['class'] = 'ifttt';
-        $attrs['data-event'] = $s['event'];
     } else if ($s['type'] == 'switch' || $s['type'] === 'switchshare') {
         $attrs['href'] = '//' . $s['room'] . '.home.tortuga.enhydra.fr/';
         if ($s['type'] == 'share') {
index 52e3cb2154e5ebbf647645fdbe7ea7f1e4337bc8..89cbeb054eafa6b46b3d8a75f247cc376867663f 100644 (file)
@@ -38,19 +38,17 @@ $scenes = [
         ['type' => 'scene', 'scene' => 'cuisine/coffee/on'],
     ],
     'chambre/deshumidificateur/on' => [
-        //['type' => 'domoticz', 'device' => $chambrefan, 'command' => true],
     ],
     'chambre/deshumidificateur/off' => [
-        //['type' => 'domoticz', 'device' => $chambrefan, 'command' => false],
+
     ],
     'chambre/fan/on' => [
-        ['type' => 'domoticz', 'device' => $chambrefan, 'command' => true],
+
     ],
     'chambre/fan/off' => [
-        ['type' => 'domoticz', 'device' => $chambrefan, 'command' => false],
+
     ],
     'chambre/fan/toggle' => [
-        ['type' => 'domoticz', 'device' => $chambrefan, 'command' => 'Toggle'],
     ],
     'chambre/auto' => [
         ['type' => 'nightmode', 'mode' => '0'],
@@ -266,7 +264,6 @@ $scenes = [
         ['type' => 'function', 'function' => 'alert',],
     ],
     'home/doalert' => [
-        ['type' => 'domoticz', 'device' => '4207', 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $alert, 'scene' => ['alert' => 'lselect']],
         ['type' => 'hue', 'group' => $alert, 'delay' => 3, 'scene' => ['alert' => 'none']],
         ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Tortuga Alerte'],
@@ -331,7 +328,6 @@ $scenes = [
     ],
     'salon/day' => [
         ['type' => 'ha', 'device' => 'scene.salon_on'],
-        ['type' => 'domoticz', 'scene' => 45, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => '9ay5VtNcjvUZIFF', 'repeat' => 2],
         ['type' => 'state', 'key' => 'salon', 'value' => 'on'],
         ['type' => 'scene', 'scene' => 'cuisine/on', 'delay' => 1],
@@ -349,7 +345,6 @@ $scenes = [
     'salon/off' => [
         ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
         ['type' => 'ha', 'device' => 'scene.salon_off'],
-        ['type' => 'domoticz', 'scene' => 45, 'command' => false, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false)],
         ['type' => 'state', 'key' => 'salon', 'value' => 'off'],
         //['type' => 'insteon', 'command' => '0?133=I=0=0'],
@@ -368,10 +363,8 @@ $scenes = [
         ['type' => 'scene', 'scene' => 'salon/bar/off'],
         ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
         ['type' => 'ha', 'device' => 'scene.salon_cineclub'],
-        ['type' => 'domoticz', 'scene' => 46, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'xpCjXtV3u7O1kYu', 'repeat' => 2],
         ['type' => 'scene', 'scene' => 'salon/cinemabase'],
-        ['type' => 'domoticz', 'scene' => 46, 'command' => true, 'priority' => true],
         ['type' => 'state', 'key' => 'salon', 'value' => 'cinema'],
         ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
     ],
@@ -379,27 +372,22 @@ $scenes = [
         ['type' => 'scene', 'scene' => 'salon/bar/off'],
         ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
         ['type' => 'ha', 'device' => 'scene.salon_cinema'],
-        ['type' => 'domoticz', 'scene' => 47, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35', 'repeat' => 2],
         ['type' => 'scene', 'scene' => 'salon/cinemabase'],
         ['type' => 'state', 'key' => 'salon', 'value' => 'cinema'],
-        ['type' => 'domoticz', 'scene' => 47, 'command' => true, 'priority' => true],
         ['type' => 'scene', 'scene' => 'cuisine/tamise', 'repeat' => 2],
     ],
     'salon/tamise' => [
         ['type' => 'ecomode', 'mode' => '0'],
         ['type' => 'ha', 'device' => 'scene.salon_tamise'],
-        ['type' => 'domoticz', 'scene' => 48, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU', 'repeat' => 2],
         ['type' => 'state', 'key' => 'salon', 'value' => 'tamise'],
-        // ['type' => 'insteon', 'command' => '0?1130=I=0=0'],
         ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]],
         ['type' => 'scene', 'scene' => 'cuisine/on', 'repeat' => 2],
         ['type' => 'scene', 'scene' => 'salon/bar/on'],
     ],
     'salon/theatre' => [
         ['type' => 'ecomode', 'mode' => '0'],
-        ['type' => 'domoticz', 'scene' => 53, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'xWNIeznSzek8dKS', 'repeat' => 2],
         ['type' => 'state', 'key' => 'salon', 'value' => 'theatre'],
         // ['type' => 'insteon', 'command' => '0?1130=I=0=0'],
@@ -409,7 +397,6 @@ $scenes = [
     'salon/lecturenocture' => [
         ['type' => 'function', 'function' => 'salonAuto', 'args' => [false]],
         ['type' => 'ha', 'device' => 'scene.salon_lecturenocturne'],
-        ['type' => 'domoticz', 'scene' => 49, 'command' => true, 'priority' => true],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'HZiYyM6hMUMkmiY'],
         ['type' => 'state', 'key' => 'salon', 'value' => 'tamise'],
         // ['type' => 'insteon', 'command' => '0?1113=I=0=0'],
@@ -430,13 +417,12 @@ $scenes = [
 
     ],
     'salon/fan/on' => [
-        ['type' => 'domoticz', 'device' => '478', 'command' => true],
+
     ],
     'salon/fan/off' => [
-        ['type' => 'domoticz', 'device' => '478', 'command' => false],
+
     ],
     'salon/fan/toggle' => [
-        ['type' => 'domoticz', 'device' => '478', 'command' => 'Toggle', 'priority' => true],
     ],
     'bureau/pc/wakeup' => [
         ['type' => 'function', 'function' => 'wakeupPC', 'args' => ['avion']],
@@ -454,10 +440,10 @@ $scenes = [
         ['type' => 'function', 'function' => 'pcScreensProfile', 'args' => ['Tortuga', 'avion']]
     ],
     'bureau/fan/on' => [
-        ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
+
     ],
     'bureau/fan/off' => [
-        ['type' => 'domoticz', 'device' => '3529', 'command' => true, 'priority' => true],
+
     ],
     'bureau/fan/toggle' => [
         ['type' => 'ha', 'device' => 'script.klarstein_fan_toggle'],
@@ -782,13 +768,12 @@ $scenes = [
     ],
     'sdb/off' => [
         ['type' => 'state', 'key' => 'sdb', 'value' => 0],
-        ['type' => 'domoticz', 'scene' => 20, 'command' => false, 'priority' => true],
         ['type' => 'function', 'function' => 'stopSqueezeboxPlayer', 'args' => [$squeezeboxPlayers['Salle de bains'], false]],
     ],
     'sdb/on' => [
         ['type' => 'state', 'key' => 'sdb', 'value' => 1],
         ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-        ['type' => 'domoticz', 'scene' => 20, 'command' => true, 'priority' => true],
+
     ],
     'sdb/morning' => [
         ['type' => 'state', 'key' => 'sdb', 'value' => 1],
@@ -797,11 +782,11 @@ $scenes = [
     ],
     'sdb/nuit' => [
         ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-        ['type' => 'domoticz', 'scene' => 21, 'command' => true, 'priority' => true],
+
     ],
     'sdb/spa' => [
         ['type' => 'state', 'key' => 'sdb', 'value' => 1],
-        ['type' => 'domoticz', 'scene' => 22, 'command' => true, 'priority' => true],
+
         ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Nature sounds', $squeezeboxPlayers['Salle de bains'], 65]],
     ],
     'cuisine/hotte/on' => [
@@ -960,12 +945,6 @@ function execScene($name, $fromUserAction = false, $transitionTime = null)
             phoneTask($action['task'], $action['phone'], true);
         } else if ($action['type'] == 'ecomode') {
             ecoMode($action['mode'], $fromUserAction);
-        } else if ($action['type'] == 'domoticz') {
-            if (isset($action['scene'])) {
-                $action['device'] = $action['scene'];
-                $action['switchtype'] = 'scene';
-            }
-            domoticzSwitch($action['device'], $action['command'], isset($action['switchtype']) ? $action['switchtype'] : 'light', $action['priority'] ?? false);
         } else if ($action['type'] === 'ha') {
             if (isset($action['action']) && !isset($action['command'])) {
                 $action['command'] = $action['action'];
@@ -974,8 +953,6 @@ function execScene($name, $fromUserAction = false, $transitionTime = null)
             haAction($action['device'], $action['command'] ?? null);
         } else if ($action['type'] == 'ir') {
             irsend($action['room'], $action['device'], $action['command']);
-        } else if ($action['type'] == 'ifttt') {
-            ifttt($action['event']);
         } else if ($action['type'] == 'nightmode') {
             nightmode($action['mode']);
         }
@@ -1169,7 +1146,6 @@ function wcVMCOn()
     setState('lastVMCOn', time());
     // Start VMC
     haAction(HA_WC_VMC);
-    //domoticzSwitch(6449, true, 'light', true);
 }
 
 function wcVMCOff($timeout = 'auto')
@@ -1230,18 +1206,6 @@ function alert()
     execScene('home/doalert');
 
     $rep = 1 * 2;
-    $domoticzDevices = [4016, 4017, 4033, 4201, 4202, 4203, 4204, 4205, 4614, 4622];
-    $domoticzStates = [];
-
-    foreach ($domoticzDevices as $domoticzDevice) {
-        $domoticzStates[$domoticzDevice] = getDomoticzDeviceStatus($domoticzDevice);
-    }
-
-    for ($i = 0; $i < $rep; $i++) {
-        foreach ($domoticzDevices as $device) {
-            domoticzSwitch($device, 'Toggle', 'light', true);
-        }
-    }
 
     $hue = getHueInstance();
     $group = $hue->getGroups()[18];
@@ -1265,8 +1229,4 @@ function alert()
         hueCommand(['light' => $lightId, 'scene' => ['on' => $state]]);
     }
 
-    foreach ($domoticzStates as $domoticzDevice => $domoticzState) {
-        domoticzSwitch($domoticzDevice, $domoticzState);
-    }
-
 }
index 4488b71a7c14019cca6e7f6e9cc035a6d99c2ddf..40adcea75436830d9c085e3e94b8770cc452f713 100644 (file)
@@ -35,8 +35,6 @@ function getWeather()
     $res['wc_humidity'] = toNumber(haGetState('sensor.0x00158d00046574da_humidity'), true);
     $res['office_temp'] = toNumber(haGetState(['sensor.meter_c7c3_temperature', 'sensor.thx1_w230150x_tempc']), 1);
     $res['office_humidity'] = toNumber(haGetState(['sensor.meter_c7c3_humidite', 'sensor.thx1_w230150x_hum']), true);
-    // $res['cellar_humidity'] = toNumber(getDomoticzDeviceStatus(4818), true);
-    // $res['cellar_temp'] = toNumber(getDomoticzDeviceStatus(4817), 1);
     $res['cellar_humidity'] = 0;
     $res['cellar_temp'] = 0;
     $res['pressure'] = round($weather['Pressure']['Metric']['Value']);
diff --git a/tools/flowerpower.js b/tools/flowerpower.js
deleted file mode 100644 (file)
index 7d194e7..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-const fs = require('fs');
-const {Console} = require('console');
-const async = require('async');
-const FlowerPower = require('flower-power');
-const querystring = require('querystring');
-const http = require('http');
-
-
-var res = {};
-var id;
-
-var output = fs.createWriteStream('./stdout.log');
-//var logconsole = new Console(output, output);
-var logconsole = console;
-
-logconsole.log('Begin discover');
-FlowerPower.discover(function (flowerPower) {
-    logconsole.log('Discovered one');
-    async.series([
-        function (callback) {
-            flowerPower.on('disconnect', function () {
-                logconsole.log('disconnected!');
-                sendtoserver(JSON.stringify(res));
-            });
-
-            logconsole.log('connectAndSetup');
-            flowerPower.connectAndSetup(callback);
-        },
-        function (callback) {
-            logconsole.log('readSystemId');
-            flowerPower.readSystemId(function (error, systemId) {
-                id = systemId;
-                res[id] = {};
-                callback();
-            });
-        },
-
-        function (callback) {
-            logconsole.log('readBatteryLevel');
-            flowerPower.readBatteryLevel(function (error, batteryLevel) {
-                res[id].batteryLevel = batteryLevel;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readSoilMoisture');
-            flowerPower.readSoilMoisture(function (error, soilMoisture) {
-                res[id].soilMoisture = soilMoisture;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readCalibratedSoilMoisture');
-            flowerPower.readCalibratedSoilMoisture(function (error, soilMoisture) {
-                res[id].calibratedSoilMoisture = soilMoisture;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readAirTemperature');
-            flowerPower.readAirTemperature(function (error, temperature) {
-                res[id].AirTemperature = temperature;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readCalibratedAirTemperature');
-            flowerPower.readCalibratedAirTemperature(function (error, temperature) {
-                res[id].calibratedAirTemperature = temperature;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readSoilTemperature');
-            flowerPower.readSoilTemperature(function (error, soilTemperature) {
-                res[id].soilTemperature = soilTemperature;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readSunlight');
-            flowerPower.readSunlight(function (error, sunlight) {
-                res[id].sunlight = sunlight;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readCalibratedSunlight');
-            flowerPower.readCalibratedSunlight(function (error, sunlight) {
-                res[id].calibratedSunlight = sunlight;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readCalibratedEa');
-            flowerPower.readCalibratedEa(function (error, ea) {
-                res[id].ea = ea;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readCalibratedEcb');
-            flowerPower.readCalibratedEcb(function (error, ecb) {
-                res[id].ecb = ecb;
-                callback();
-            });
-        },
-        function (callback) {
-            logconsole.log('readCalibratedEcPorous');
-            flowerPower.readCalibratedEcPorous(function (error, ecPorous) {
-                res[id].ecPorous = ecPorous;
-                callback();
-            });
-        },
-
-        function (callback) {
-            logconsole.log('disconnect');
-            flowerPower.disconnect(callback);
-        }
-    ]);
-});
-
-function sendtoserver(data) {
-    // Build the post string from an object
-    var post_data = querystring.stringify({
-        'data' :data
-    });
-
-    // An object of options to indicate where to post to
-    var post_options = {
-        host: 'home.tortuga.enhydra.fr',
-        port: '443',
-        path: '/scripts/flowerpower.php',
-        method: 'POST',
-        headers: {
-            'Content-Type': 'application/x-www-form-urlencoded',
-            'Content-Length': Buffer.byteLength(post_data)
-        }
-    };
-
-    // Set up the request
-    var post_req = http.request(post_options, function(res) {
-        res.setEncoding('utf8');
-        res.on('data', function (chunk) {
-            console.log('Response: ' + chunk);
-            process.exit(0);
-        });
-    });
-
-    // post the data
-    post_req.write(post_data);
-    post_req.end();
-}
-