From: Vincent Date: Thu, 19 Sep 2019 08:19:26 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3091b2dd8f3138f481cc830f19c2176ce3497985;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d2d68de..658c410 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,10 @@ - - + + + + diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 8bc786d..c1f2402 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -528,17 +528,27 @@ $scenes = [ ['type' => 'hue', 'light' => $sdb_ampli, 'scene' => ['on' => false]], ], 'sdb/off' => [ + ['type' => 'state', 'key' => 'sdb', 'value' => 0], ['type' => 'hue', 'group' => $sdb, 'scene' => ['on' => false, 'brightness' => 0, 'effect' => 'none']], + ['type' => 'function', 'function' => 'stopSqueezeboxPlayer', 'args' => [$squeezeboxPlayers['WC'], false]], ], 'sdb/on' => [ + ['type' => 'state', 'key' => 'sdb', 'value' => 1], ['type' => 'hue', 'group' => $sdb, 'scene' => ['effect' => 'none']], ['type' => 'hue', 'group' => $sdb, 'scene' => '0L4cGh7y29uBBez'], ], + 'sdb/morning' => [ + ['type' => 'state', 'key' => 'sdb', 'value' => 1], + ['type' => 'scene', 'scene' => 'sdb/on'], + ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['France Info', $squeezeboxPlayers['Salle de bains'], 30]], + ], 'sdb/nuit' => [ + ['type' => 'state', 'key' => 'sdb', 'value' => 1], ['type' => 'hue', 'group' => $sdb, 'scene' => ['effect' => 'none']], ['type' => 'hue', 'group' => $sdb, 'scene' => 'ZTZBNRk6VZMlYvB'], ], 'sdb/spa' => [ + ['type' => 'state', 'key' => 'sdb', 'value' => 1], ['type' => 'hue', 'group' => $sdb, 'scene' => ['effect' => 'colorloop', 'on' => true, 'brightness' => 128]], ['type' => 'function', 'function' => 'squeezePlayByName', 'args' => ['Rivière', $squeezeboxPlayers['Salle de bains'], 65]], ], @@ -664,6 +674,20 @@ function wcToggle() } } +function sdbToggle() +{ + if (getState('sdb') == 1) { + execScene('sdb/off'); + } else { + execScene('sdb/on'); + } +} + +function sdbMorning() +{ + execScene('sdb/on'); +} + function wcOn($vmc = true) { $hour = getHour(); diff --git a/scripts/pop.php b/scripts/pop.php index 7a57f68..738dce5 100644 --- a/scripts/pop.php +++ b/scripts/pop.php @@ -5,12 +5,20 @@ $_GET['im'] = '5'; include "import.php"; if ($_GET['button'] == 'wc') { - if ($_GET['action'] == 'tap') { - wcToggle(); - } else if ($_GET['action'] == 'double') { - execScene('wc/spa'); - setState('wc', 1); - } else if ($_GET['action'] == 'long') { - execScene('home/alert'); - } + if ($_GET['action'] == 'tap') { + wcToggle(); + } else if ($_GET['action'] == 'double') { + execScene('wc/spa'); + setState('wc', 1); + } else if ($_GET['action'] == 'long') { + execScene('home/alert'); + } +} elseif ($_GET['button'] == 'sdb') { + if ($_GET['action'] == 'tap') { + sdbToggle(); + } else if ($_GET['action'] == 'double') { + execScene('sdb/morning'); + } else if ($_GET['action'] == 'long') { + execScene('home/alert'); + } } \ No newline at end of file diff --git a/tools/pop/pop.py b/tools/pop/pop.py index 0a11e78..37f190c 100644 --- a/tools/pop/pop.py +++ b/tools/pop/pop.py @@ -7,8 +7,8 @@ import sys device = sys.argv[1] map = ['', '', 'tap', 'long', 'double'] -rooms = {'wc': 'wc'} -macs = {'wc': 'a0:e6:f8:db:ff:2f'} +rooms = {'wc': 'wc','sdb':'sdb'} +macs = {'wc': 'a0:e6:f8:db:ff:2f','sdb':'a0:e6:f8:dc:01:d7'} mac = macs[device] room = rooms[device] diff --git a/tools/pop/scanner.py b/tools/pop/scanner.py index 83bdb50..a780293 100644 --- a/tools/pop/scanner.py +++ b/tools/pop/scanner.py @@ -13,7 +13,7 @@ class ScanDelegate(DefaultDelegate): print "Received new data from", dev.addr scanner = Scanner().withDelegate(ScanDelegate()) -devices = scanner.scan(1) +devices = scanner.scan(10) for dev in devices: print "Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi)