]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Jul 2023 19:17:19 +0000 (21:17 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Jul 2023 19:17:19 +0000 (21:17 +0200)
.idea/workspace.xml
scripts/homeassistant.php
scripts/lib/harmony.php
scripts/lib/homeassistant.php

index 7cce9f21da1755be09646335cb19e08f5a4164d3..f8034d5bfaf06eaa2df9166bd9121b33d7f5d168 100644 (file)
@@ -5,19 +5,10 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/scripts/homeassistant.php" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/scripts/homeassistant_device_event.php" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/scripts/lib/homeassistant.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.docker/config/httpd/httpd.conf" beforeDir="false" afterPath="$PROJECT_DIR$/.docker/config/httpd/httpd.conf" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/dnsmasq.conf" beforeDir="false" afterPath="$PROJECT_DIR$/config/dnsmasq.conf" 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_device_event.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/domoticz_device_event.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/homeassistant.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/homeassistant.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/lib/harmony.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/harmony.php" afterDir="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$/scripts/lib/homeassistant.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/homeassistant.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "RunOnceActivity.OpenProjectViewOnStart": "true",
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "WebServerToolWindowFactoryState": "true",
-    "WebServerToolWindowPanel.toolwindow.highlight.mappings": "true",
-    "WebServerToolWindowPanel.toolwindow.highlight.symlinks": "true",
-    "WebServerToolWindowPanel.toolwindow.show.date": "false",
-    "WebServerToolWindowPanel.toolwindow.show.permissions": "false",
-    "WebServerToolWindowPanel.toolwindow.show.size": "false",
-    "deletionFromPopupRequiresConfirmation": "false",
-    "git-widget-placeholder": "master",
-    "ignore.virus.scanning.warn.message": "true",
-    "last_opened_file_path": "D:/Works/tortuga-home/scripts",
-    "node.js.detected.package.eslint": "true",
-    "node.js.detected.package.tslint": "true",
-    "node.js.selected.package.eslint": "(autodetect)",
-    "node.js.selected.package.tslint": "(autodetect)",
-    "nodejs_package_manager_path": "npm",
-    "project.structure.last.edited": "Project",
-    "project.structure.proportion": "0.0",
-    "project.structure.side.proportion": "0.2",
-    "ruby.rails.projectView.checked": "true",
-    "settings.editor.selected.configurable": "editor.preferences.fonts.default",
-    "vue.rearranger.settings.migration": "true"
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;WebServerToolWindowFactoryState&quot;: &quot;true&quot;,
+    &quot;WebServerToolWindowPanel.toolwindow.highlight.mappings&quot;: &quot;true&quot;,
+    &quot;WebServerToolWindowPanel.toolwindow.highlight.symlinks&quot;: &quot;true&quot;,
+    &quot;WebServerToolWindowPanel.toolwindow.show.date&quot;: &quot;false&quot;,
+    &quot;WebServerToolWindowPanel.toolwindow.show.permissions&quot;: &quot;false&quot;,
+    &quot;WebServerToolWindowPanel.toolwindow.show.size&quot;: &quot;false&quot;,
+    &quot;deletionFromPopupRequiresConfirmation&quot;: &quot;false&quot;,
+    &quot;git-widget-placeholder&quot;: &quot;master&quot;,
+    &quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
+    &quot;last_opened_file_path&quot;: &quot;D:/Works/tortuga-home/scripts&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+    &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
+    &quot;project.structure.last.edited&quot;: &quot;Project&quot;,
+    &quot;project.structure.proportion&quot;: &quot;0.0&quot;,
+    &quot;project.structure.side.proportion&quot;: &quot;0.2&quot;,
+    &quot;ruby.rails.projectView.checked&quot;: &quot;true&quot;,
+    &quot;settings.editor.selected.configurable&quot;: &quot;editor.preferences.fonts.default&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
   }
-}]]></component>
+}</component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
       <recent name="D:\Works\tortuga-home\scripts" />
       <workItem from="1687301078170" duration="848000" />
       <workItem from="1687359859243" duration="1495000" />
       <workItem from="1688295154056" duration="11039000" />
-      <workItem from="1688414368761" duration="9903000" />
+      <workItem from="1688414368761" duration="11417000" />
+      <workItem from="1688478993471" duration="3221000" />
     </task>
     <task id="LOCAL-00502" summary=".">
       <created>1641726946298</created>
       <option name="project" value="LOCAL" />
       <updated>1687259667913</updated>
     </task>
-    <option name="localTasksCounter" value="551" />
+    <option name="localTasksCounter" value="552" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 1902707e52991c0fe9a7feb0361fe01b8f649f4b..7ced31d30bca26867b19b9948d2f48edc912edd7 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 require_once "import.php";
 if (!isset($_GET['action']) || $_GET['action'] === 'state') {
-       print_r(haGetState($_GET['id']));
+       print_r(haGetState($_GET['id'],$_GET['attribute']??null));
 } else {
        print_r(haAction($_GET['id'], $_GET['action']));
 }
\ No newline at end of file
index 84138813857b5c42422462ff559eed82fd0c0cfc..63a662262f1c3116a96f2b3fbd6151e34a7e27f4 100644 (file)
@@ -29,7 +29,7 @@ function harmonyActivity($activity) {
                sleep($wait);
        }
        if ($activity == 'tv') {
-               runAtEnd('sleep(15);harmonyDeviceCommand(\'sony-projecteur\', \'power-on\');');
+               runAtEnd('sleep(15);/*harmonyDeviceCommand(\'sony-projecteur\', \'power-on\');*/');
        }
 }
 
@@ -48,6 +48,6 @@ function stopHarmony() {
 }
 
 function harmonyDeviceCommand($device, $command) {
-       haEvent();
-       return harmonyRequest('devices/' . $device . '/commands/' . $command, 'POST');
+//     haEvent();
+//     return harmonyRequest('devices/' . $device . '/commands/' . $command, 'POST');
 }
\ No newline at end of file
index 0833bb4495025471502f2bb4eff829dbfed9bfca..2332fc1453c24f81e23ebcbf465cbc70ac09ef03 100644 (file)
@@ -7,9 +7,9 @@ const HA_SDB_AMPLI = 'switch.0xa4c138168147c1b6';
 const HA_ECO_BASIC = 'switch.ecomode_basic';
 const HA_ECO_SUPER = 'switch.ecomode_super';
 const HA_HOTTE = 'switch.0xa4c138a2685057c8';
-const HA_BAR='switch.bar';
+const HA_BAR = 'switch.bar';
 
-function haGetState($id) { //ID to read - for example sensor.foo
+function haGetState($id, $attribute = null) { //ID to read - for example sensor.foo
 
 
        $opts = [
@@ -22,17 +22,24 @@ function haGetState($id) { //ID to read - for example sensor.foo
        ];
        $ctx = stream_context_create($opts);
        $data = @file_get_contents(HA_URL . 'api/states/' . $id, false, $ctx);
-       if (!$data)
+       if (!$data) {
                return false;
+       }
        $data = json_decode($data);
-       if (!$data)
-               return false;
-       if (!isset($data->state))
-               return false;
-       return $data->state;
+
+       if (null === $attribute) {
+               if (!$data)
+                       return false;
+               if (!isset($data->state))
+                       return false;
+               return $data->state;
+       }
+       return ($data->attributes->$attribute) ?? false;
+
 }
 
-function haAction($id, $action='turn_on', $domain = null) {
+
+function haAction($id, $action = 'turn_on', $domain = null) {
        $opts = [
                "http" => [
                        "method" => "POST",