<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">
['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
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);
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');
function cronHeartbeat($cronmin, $devices = false) {
_logSection('Heartbeat');
setState('cron_heartbeat', time());
- domoticzCmd(null);
squeezeRequest(null);
hueCommand(null);
+++ /dev/null
-<?php
-require_once "import.php";
-
-ob_end_clean();
-echo ":::".getDomoticzDeviceStatus($_GET['device']);
\ No newline at end of file
+++ /dev/null
-<?php
-require_once "import.php";
-ifttt($_GET['event']);
\ No newline at end of file
+++ /dev/null
-<?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];
-}
+++ /dev/null
-<?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
+++ /dev/null
-<?php
-function ifttt($event)
-{
- httpRequest('https://maker.ifttt.com/trigger/' . $event . '/with/key/5KxVqNj_tXibHw27u7uja');
-}
\ No newline at end of file
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';
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';
} 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') {
['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'],
['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'],
],
'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],
'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'],
['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],
],
['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'],
'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'],
],
'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']],
['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'],
],
'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],
],
'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' => [
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'];
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']);
}
setState('lastVMCOn', time());
// Start VMC
haAction(HA_WC_VMC);
- //domoticzSwitch(6449, true, 'light', true);
}
function wcVMCOff($timeout = 'auto')
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];
hueCommand(['light' => $lightId, 'scene' => ['on' => $state]]);
}
- foreach ($domoticzStates as $domoticzDevice => $domoticzState) {
- domoticzSwitch($domoticzDevice, $domoticzState);
- }
-
}
$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']);
+++ /dev/null
-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();
-}
-