From a808d3c5374dc257962b8ea46cb264f3a8feba24 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 30 Mar 2020 09:31:39 +0200 Subject: [PATCH] . --- .idea/workspace.xml | 35 +++++++++++++---------- config/media.php | 3 ++ scripts/cron/cron.php | 10 ++++++- scripts/domoticz_device_event.php | 47 ++++++++++++++++++++++++++++++- scripts/tmdb.php | 12 +++++--- 5 files changed, 86 insertions(+), 21 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 42d5a69..dd09776 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,10 @@ - - + + + + @@ -1218,12 +1223,12 @@ - + - + @@ -1237,12 +1242,12 @@ - + - + diff --git a/config/media.php b/config/media.php index 59b75bb..ed4c691 100644 --- a/config/media.php +++ b/config/media.php @@ -16,6 +16,7 @@ if ($device == 'salon' || $device == 'bureau') { $shortcuts['media'][] = ['label' => 'Vidéo web', 'type' => 'raspberrycast']; } + $tvshows = getTVShows(); if (is_array($tvshows)) { $shortcuts['sub-seriestv'] = $tvshows['shortcuts']; @@ -48,6 +49,8 @@ if (is_array($media)) { } } +$shortcuts['media'][] = ['label' => 'Recharger', 'type' => 'url', 'href' => '/scripts/tmdb.php']; + function getMediaFolderShortcuts($mediagroup, $parentId) { $res['sub-' . $parentId] = array(); diff --git a/scripts/cron/cron.php b/scripts/cron/cron.php index 657fdd3..19b402a 100644 --- a/scripts/cron/cron.php +++ b/scripts/cron/cron.php @@ -94,7 +94,15 @@ function cronFlowerPower($cronmin) $fp = explode("\n", trim(`sudo /usr/local/bin/flowerpower`)); $map = [2 => 1467, 0 => 1468]; foreach ($map as $k => $v) { - domoticzCmd(['param' => 'udevice', 'idx' => $v, 'nvalue' => 0, 'svalue' => $fp[$k]]); + $newValue = $fp[$k]; + if ($v === 1467) { + $newValue = (float)$newValue; + $currentValue = toNumber(getDomoticzDeviceStatus(1467), false); + if (abs($currentValue - $newValue) > 30 || $newValue == 0 || $newValue > 60 || $newValue < -50) { + return; + } + } + domoticzCmd(['param' => 'udevice', 'idx' => $v, 'nvalue' => 0, 'svalue' => $newValue]); } } diff --git a/scripts/domoticz_device_event.php b/scripts/domoticz_device_event.php index 6da91ad..40404fb 100644 --- a/scripts/domoticz_device_event.php +++ b/scripts/domoticz_device_event.php @@ -2,6 +2,9 @@ if ($_GET['device'] == 1033) { $forceConfig = 'salon'; } +if ($_GET['device'] == 1476) { + $forceConfig = 'bureau'; +} require_once "import.php"; @@ -49,7 +52,49 @@ if ($_GET['device'] == 480) { default: break; } -}else if($_GET['device']==1451){ +} else if ($_GET['device'] == 1476) { + // Cube +// switch ($_GET['state']) { +// case 'Shake': +// execScene('home/alert'); +// break; +// case 'Flip_90': +// execScene('bureau/off'); +// break; +// case 'Flip_180': +// execScene('bureau/auto'); +// break; +// case 'Free_Fall': +// execScene('salon/off'); +// off('bureau'); +// break; +// case 'Move': +// if (getCurrentHarmonyActivity() != 'musique-radio') { +// _remoteCmd('pause', 'salon'); +// } +// break; +// case 'Clock_Wise': +// if (getCurrentHarmonyActivity() !== 'poweroff') { +// harmonyRequest('commands/volume-up?repeat=3', 'POST'); +// } +// break; +// case 'Anti_Clock_Wise': +// if (getCurrentHarmonyActivity() !== 'poweroff') { +// harmonyRequest('commands/volume-down?repeat=5', 'POST'); +// } +// break; +// case 'Tap': +// if (getCurrentHarmonyActivity() == 'poweroff') { +// squeezePlayByName('FIP', $squeezeboxPlayers['Salon']); +// } else if (getCurrentHarmonyActivity() == 'musique-radio') { +// stopHarmony(); +// } +// break; +// case 'Alert': +// default: +// break; +// } +} else if ($_GET['device'] == 1451) { domoticzSwitch(1450); } echo '1'; \ No newline at end of file diff --git a/scripts/tmdb.php b/scripts/tmdb.php index 3edcb3e..3e1aa34 100644 --- a/scripts/tmdb.php +++ b/scripts/tmdb.php @@ -1,6 +1,10 @@ del(['shortcuts.' . getCurrentConfig()]); +ob_end_clean(); +header('Location: /#/section/home'); \ No newline at end of file -- 2.39.5