From: Vincent Vanwaelscappel Date: Wed, 19 Jul 2023 10:50:50 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f8c8a34e0e4cc9a2f2cd2e1364a77068641fc577;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a67e675..afd6f7d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,7 +6,6 @@ - @@ -1258,7 +1257,7 @@ - + 1641726946298 @@ -1603,7 +1602,7 @@ - diff --git a/scripts/lib/homeassistant.php b/scripts/lib/homeassistant.php index c3b4d17..847b448 100644 --- a/scripts/lib/homeassistant.php +++ b/scripts/lib/homeassistant.php @@ -12,6 +12,7 @@ const HA_PLANETARIUM = 'switch.0xa4c138788071821e'; const HA_OFFICE_MAIN_SCREEN = 'switch.0xa4c138787633f01d'; const HA_OFFICE_PLANE_SCREENS = 'switch.0xa4c138ba535d2cc5'; + function haGetState($id, $attribute = null) { //ID to read - for example sensor.foo diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index d2c01b8..976529b 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -321,7 +321,7 @@ $scenes = [ ['type' => 'function', 'function' => 'salonAuto', 'args' => [true]], ], 'salon/bar/on' => [ - ['type' => 'ha', 'device' => HA_BAR, 'command' => 'turn_on', 'priority' => true], + ['type' => 'ha', 'device' => HA_BAR, 'priority' => true], ], 'salon/bar/off' => [ ['type' => 'ha', 'device' => HA_BAR, 'command' => 'turn_off', 'priority' => true], @@ -678,8 +678,6 @@ $scenes = [ ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'], ['type' => 'scene', 'scene' => 'bureau/off'], ['type' => 'scene', 'scene' => 'chambre/off'], - ['type'=>'ha','device'=>HA_OFFICE_PLANE_SCREENS,'action'=>'turn_off'], - ['type'=>'ha','device'=>HA_OFFICE_MAIN_SCREEN,'action'=>'turn_off'], ], 'home/welcome/eco/homeoffice' => [ @@ -689,14 +687,14 @@ $scenes = [ ['type' => 'scene', 'scene' => 'sdb/hotwater/auto'], ['type' => 'scene', 'scene' => 'salon/off'], ['type' => 'scene', 'scene' => 'chambre/off'], - ['type'=>'ha','device'=>HA_OFFICE_PLANE_SCREENS,'action'=>'turn_off'], + ['type' => 'ha', 'device' => HA_OFFICE_PLANE_SCREENS, 'action' => 'turn_off'], ], 'home/welcome' => [ ['type' => 'scene', 'scene' => 'cuisine/on'], ['type' => 'scene', 'scene' => 'salon/auto'], ['type' => 'scene', 'scene' => 'bureau/auto'], - ['type'=>'ha','device'=>HA_OFFICE_PLANE_SCREENS,'action'=>'turn_on'], + ['type' => 'ha', 'device' => HA_OFFICE_PLANE_SCREENS], ['type' => 'scene', 'scene' => 'chambre/auto'], ['type' => 'scene', 'scene' => 'sdb/on'], ['type' => 'scene', 'scene' => 'cour/auto'], @@ -751,7 +749,7 @@ $scenes = [ ['type' => 'ha', 'device' => HA_WC_VMC, 'command' => 'turn_off', 'priority' => true], ], 'sdb/ampli/on' => [ - ['type' => 'ha', 'device' => HA_SDB_AMPLI, 'command' => 'turn_on', 'priority' => true], + ['type' => 'ha', 'device' => HA_SDB_AMPLI, 'priority' => true], //['type' => 'domoticz', 'device' => $amplisdb, 'command' => true, 'priority' => true], ], 'sdb/ampli/off' => [ @@ -975,6 +973,10 @@ function execScene($name, $fromUserAction = false, $transitionTime = null) { } 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']; + unset($action['action']); + } haAction($action['device'], $action['command'] ?? null); } else if ($action['type'] == 'ir') { irsend($action['room'], $action['device'], $action['command']); @@ -1153,11 +1155,10 @@ function bedbrightness($brightness) { } - function wcVMCOn() { setState('lastVMCOn', time()); // Start VMC - haAction(HA_WC_VMC, 'turn_on'); + haAction(HA_WC_VMC); //domoticzSwitch(6449, true, 'light', true); }