]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Mon, 2 Sep 2019 19:47:29 +0000 (21:47 +0200)
committerVincent <vincent@enhydra.fr>
Mon, 2 Sep 2019 19:47:29 +0000 (21:47 +0200)
.idea/workspace.xml
scripts/lib/scenes.php
tools/pop/pop.py [new file with mode: 0644]
tools/pop/scanner.py [new file with mode: 0644]

index a7dc4aca608966ed47925eece06a09d17dfa633b..3987d1aaed67472f6ff049c96952cf81e0ff14fc 100644 (file)
@@ -2,10 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/tools/pop/pop.py" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/tools/pop/scanner.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/ssh.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/ssh.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/servers/insteon.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/insteon.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/servers/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/squeezebox.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -45,8 +45,8 @@
         <option value="Less File" />
         <option value="Setup Script" />
         <option value="HTML File" />
-        <option value="JavaScript File" />
         <option value="Python Script" />
+        <option value="JavaScript File" />
       </list>
     </option>
   </component>
       <workItem from="1566649679962" duration="18000" />
       <workItem from="1566649714025" duration="13165000" />
       <workItem from="1567019099272" duration="183000" />
-      <workItem from="1567019296675" duration="3128000" />
-    </task>
-    <task id="LOCAL-00169" summary=".">
-      <created>1551170528833</created>
-      <option name="number" value="00169" />
-      <option name="presentableId" value="LOCAL-00169" />
-      <option name="project" value="LOCAL" />
-      <updated>1551170528833</updated>
+      <workItem from="1567019296675" duration="5845000" />
+      <workItem from="1567261528772" duration="609000" />
+      <workItem from="1567408023339" duration="2511000" />
+      <workItem from="1567413752073" duration="969000" />
     </task>
     <task id="LOCAL-00170" summary=".">
       <created>1551171910164</created>
       <option name="project" value="LOCAL" />
       <updated>1567019261001</updated>
     </task>
-    <option name="localTasksCounter" value="218" />
+    <task id="LOCAL-00218" summary=".">
+      <created>1567064583593</created>
+      <option name="number" value="00218" />
+      <option name="presentableId" value="LOCAL-00218" />
+      <option name="project" value="LOCAL" />
+      <updated>1567064583593</updated>
+    </task>
+    <option name="localTasksCounter" value="219" />
     <servers />
   </component>
   <component name="TodoView">
index a8c0d314fb23efdc9b527e146054184af7767b1c..4994cc0113ce1348ad522174653681ca69a086c2 100644 (file)
@@ -40,10 +40,16 @@ $scenes = [
         ['type' => 'ifttt', 'event' => 'coffee_on'],
     ],
     'chambre/deshumidificateur/on' => [
-        // ['type' => 'insteon', 'command' => '0?1138=I=0=0'],
+
     ],
     'chambre/deshumidificateur/off' => [
-        // ['type' => 'insteon', 'command' => '0?1338=I=0=0'],
+
+    ],
+    'chambre/rapberry/on' => [
+        ['type' => 'insteon', 'command' => '0?1138=I=0=0'],
+    ],
+    'chambre/raspberry/off' => [
+        ['type' => 'insteon', 'command' => '0?1338=I=0=0'],
     ],
     'chambre/auto' => [
         ['type' => 'function', 'function' => 'chambreAuto', 'args' => [true]],
@@ -467,6 +473,7 @@ $scenes = [
         ['type' => 'phonetask', 'phone' => 'vincent', 'task' => 'Stop All Sounds'],
         ['type' => 'scene', 'scene' => 'salon/freebox/off'],
         ['type' => 'scene', 'scene' => 'sdb/ampli/off'],
+        ['type' => 'scene', 'scene' => 'chambre/planetarium/off'],
         ['type' => 'ifttt', 'event' => 'coffee_off'],
         ['type' => 'ifttt', 'event' => 'oven_off'],
     ],
@@ -542,14 +549,15 @@ $scenes = [
         ['type' => 'hue', 'light' => $freebox, 'scene' => ['on' => false]],
     ],
     'ecomode/basic' => [
-        //['type' => 'scene', 'scene' => 'bureau/media/off'],// Media bureau
+        ['type' => 'scene', 'scene' => 'bureau/media/off'],// Media bureau
         ['type' => 'scene', 'scene' => 'salon/freebox/off'],
         ['type' => 'scene', 'scene' => 'sdb/ampli/off'],
-        // ['type' => 'domoticz', 'device' => '2', 'switchtype' => 'scene', 'command' => false],
+        ['type' => 'scene', 'scene' => 'chambre/raspberry/off'],
+        ['type' => 'domoticz', 'device' => '2', 'switchtype' => 'scene', 'command' => false],
     ],
     'ecomode/super' => [
         ['type' => 'scene', 'scene' => 'ecomode/basic'],
-        //['type' => 'domoticz', 'device' => '1', 'switchtype' => 'scene', 'command' => false],
+        ['type' => 'domoticz', 'device' => '1', 'switchtype' => 'scene', 'command' => false],
     ],
     'ecomode/notsuper' => [
         ['type' => 'domoticz', 'device' => '1', 'switchtype' => 'scene', 'command' => true, 'priority' => false],
@@ -560,6 +568,7 @@ $scenes = [
     ],
     'ecomode/off' => [
         ['type' => 'scene', 'scene' => 'ecomode/notsuper'],
+        ['type' => 'scene', 'scene' => 'chambre/raspberry/on'],
         ['type' => 'scene', 'scene' => 'bureau/media/on'],// Media bureau
         ['type' => 'domoticz', 'device' => '2', 'switchtype' => 'scene', 'command' => true, 'priority' => false],
     ],
diff --git a/tools/pop/pop.py b/tools/pop/pop.py
new file mode 100644 (file)
index 0000000..9f8ea29
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+from bluepy import btle
+
+class MyDelegate(btle.DefaultDelegate):
+    def __init__(self):
+        btle.DefaultDelegate.__init__(self)
+
+    def handleNotification(self, cHandle, data):
+        print("A notification was received: %s" %data)
+
+# Initialisation  -------
+#p = btle.Peripheral("a0:e6:f8:dc:01:d7", btle.ADDR_TYPE_RANDOM)
+p = btle.Peripheral("a0:e6:f8:db:ff:2f", btle.ADDR_TYPE_PUBLIC)
+p.setDelegate( MyDelegate() )
+
+# Setup to turn notifications on, e.g.
+svc = p.getServiceByUUID("0000fe61-0000-1000-8000-00805f9b34fb")
+ch = svc.getCharacteristics()[0]
+print(ch.valHandle)
+
+# Main loop --------
+
+p.writeCharacteristic(ch.valHandle+1, "\x02\x00")
+
+while True:
+    if p.waitForNotifications(1.0):
+        # handleNotification() was called
+        continue
+
+    print("Waiting...")
+    # Perhaps do something else here
\ No newline at end of file
diff --git a/tools/pop/scanner.py b/tools/pop/scanner.py
new file mode 100644 (file)
index 0000000..83bdb50
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+from bluepy.btle import Scanner, DefaultDelegate
+
+class ScanDelegate(DefaultDelegate):
+    def __init__(self):
+        DefaultDelegate.__init__(self)
+
+    def handleDiscovery(self, dev, isNewDev, isNewData):
+        if isNewDev:
+            print "Discovered device", dev.addr
+        elif isNewData:
+            print "Received new data from", dev.addr
+
+scanner = Scanner().withDelegate(ScanDelegate())
+devices = scanner.scan(1)
+
+for dev in devices:
+    print "Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi)
+    for (adtype, desc, value) in dev.getScanData():
+        print "  %s = %s" % (desc, value)