From c2b07859964e323476343b63a86e9b9cfbd3a219 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 11 Aug 2023 12:33:16 +0200 Subject: [PATCH] . --- .idea/workspace.xml | 17 ++++++++++------- scripts/lib/ecomode.php | 11 +++-------- scripts/lib/homeassistant.php | 3 +++ scripts/lib/scenes.php | 10 +++++----- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ad7cf6f..feeb202 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,10 +5,10 @@ - - - + + + @@ -279,7 +279,7 @@ - + diff --git a/scripts/lib/ecomode.php b/scripts/lib/ecomode.php index 74f3773..b05b6e0 100644 --- a/scripts/lib/ecomode.php +++ b/scripts/lib/ecomode.php @@ -49,17 +49,12 @@ function getNightMode($device = null) return false; } } else if ($device === 'bureau' || $device === 'bureausun') { - if (getState('bureauOff') == '1') { + if (haGetState(HA_OFFICE_CURTAIN) === 'closed') { return true; } - if (getDomoticzDeviceStatus(391) === 'Closed') { - return true; - } - if (getState('bureau_gradient') !== 'off') { - return false; - } + return getState('bureauOff') == '1'; } else if ($device === 'wc') { - if (getState('bureau_gradient') !== 'off') { + if (!getState('bureauOff')) { return false; } } else if ($device === 'entree' || $device === 'cuisine') { diff --git a/scripts/lib/homeassistant.php b/scripts/lib/homeassistant.php index 847b448..f5269a4 100644 --- a/scripts/lib/homeassistant.php +++ b/scripts/lib/homeassistant.php @@ -10,6 +10,9 @@ const HA_HOTTE = 'switch.hotte'; const HA_BAR = 'switch.bar'; const HA_PLANETARIUM = 'switch.0xa4c138788071821e'; +const HA_OFFICE_CURTAIN='cover.office_curtain'; +const HA_OFFICE_SCREEN='cover.office_screen'; + const HA_OFFICE_MAIN_SCREEN = 'switch.0xa4c138787633f01d'; const HA_OFFICE_PLANE_SCREENS = 'switch.0xa4c138ba535d2cc5'; diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 976529b..c35a455 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -628,19 +628,19 @@ $scenes = [ ['type' => 'scene', 'scene' => 'bureau/auto'], ], 'bureau/screen/down' => [ - ['type' => 'ha', 'device' => 'cover.office_screen', 'command' => 'close_cover'], + ['type' => 'ha', 'device' => HA_OFFICE_SCREEN, 'command' => 'close_cover'], ], 'bureau/screen/up' => [ - ['type' => 'ha', 'device' => 'cover.office_screen', 'command' => 'open_cover'], + ['type' => 'ha', 'device' => HA_OFFICE_SCREEN, 'command' => 'open_cover'], ], 'bureau/rideaux/close' => [ - ['type' => 'ha', 'device' => 'cover.office_curtain', 'command' => 'close_cover'], + ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'close_cover'], ], 'bureau/rideaux/open' => [ - ['type' => 'ha', 'device' => 'cover.office_curtain', 'command' => 'open_cover'], + ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'open_cover'], ], 'bureau/rideaux/toggle' => [ - ['type' => 'ha', 'device' => 'cover.office_curtain', 'command' => 'toggle'], + ['type' => 'ha', 'device' => HA_OFFICE_CURTAIN, 'command' => 'toggle'], ], 'insteon/off' => [ // ['type' => 'insteon', 'command' => '0?135=I=0=0'], -- 2.39.5