[code]<?php
// CHANGE HERE
$veraUsr = ‘USER’;
$veraPwd = ‘PASS’;
$veraId = ‘UNIT_ID’;
$recherche = array (‘“10”’); // This is an array because we can search multiple strings (‘“11”’, ‘12’, ‘luup.call_action(’, [etc etc etc])
// DO NOT MODIFY BELOW
function veraConnect($usr, $pwd, $id) {
// Find the active fwd server on sta1.mios.com
$units = json_decode(file_get_contents(‘https://sta1.mios.com/locator_json.php?username=’ . $usr));
if (!empty ($units)) {
foreach ($units->units as $unit) {
if ($unit->serialNumber == $id) {
$data = json_decode(file_get_contents(‘https://’ . $unit->active_server . ‘/’ . $usr . ‘/’ . $pwd . ‘/’ . $id . ‘/data_request?id=user_data2’));
if (empty($data)) {
$data = veraConnect($usr, $pwd, $id);
}
}
}
}
return $data;
}
print ‘Recherche de mots-clef’;
// Connection
$veraData = veraConnect($veraUsr, $veraPwd, $veraId);
foreach ($recherche as $variable) {
print(‘
RECHERCHE DE ’ . $variable . ‘
’);
if (!empty($veraData)) {
if (strpos($veraData->StartupCode, $variable) !== false) {
$sceneDisplay = $veraData->StartupCode;
$sceneDisplay = str_replace($variable, ‘
’ . $variable . ‘’, $sceneDisplay);
$sceneDisplay = nl2br($sceneDisplay);
print(’
Startup Code
’ . $sceneDisplay . ‘
’);
}
foreach ($veraData->scenes as $scene) {
if ($scene->triggers != ‘’) {
foreach ($scene->triggers as $trigger) {
if ($trigger->lua != ‘’) {
if (strpos($trigger->lua, $variable) !== false) {
$sceneDisplay = $trigger->lua;
$sceneDisplay = str_replace($variable, ‘
’ . $variable . ‘’, $sceneDisplay);
$sceneDisplay = nl2br($sceneDisplay);
print(‘
Trigger ’ . $trigger->name . ‘
’ . $sceneDisplay . ‘
’);
}
}
}
}
if ($scene->lua != ‘’) {
if (strpos($scene->lua, $variable) !== false) {
$sceneDisplay = $scene->lua;
$sceneDisplay = str_replace($variable, ‘
’ . $variable . ‘’, $sceneDisplay);
$sceneDisplay = nl2br($sceneDisplay);
print(’
’ . $scene->name . ‘
’ . $sceneDisplay . ‘
’);
}
}
print(‘
’);
}
}
}
print ‘’;
?>[/code]
Hi,
Here is a php code to display every luup code (luup event, startup, lua code, etc etc etc) where there is the searched keyword. Just put it on a webserver and change the key variables (user, password, vera unit ID, keyword).