This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

easy way to search trough scenes?
#1
Is there an easy way to search for a GA in all scenes?

I use "print script listings" to search trough all the scripts for a specific text a lot - and I would love to have a similar "dump" of all the scenes.

Thanks.
Reply
#2
Create scenes.lp file and upload it via FTP to user directory using apps login. FTP can be enabled in System config > Services.
Then you can access it via http://LM_IP/user/scenes.lp

Code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="/apps/css/bootstrap.css.gz"> <style>body { padding: 20px 20px 0 20px; }</style> <title>Scenes</title> </head> <body> <table class="table"> <? require('apps') function isdefined(val)   return toboolean(val) end function numtoga(addr)   return isdefined(addr) and buslib.decodega(addr) or '' end scenes = db:getall([[   SELECT s.id, s.name, s.trig_object, s.trig_value, o.name AS trig_name   FROM scenes s   LEFT JOIN objects o ON s.trig_object=o.id   ORDER BY s.name ]]) for _, scene in ipairs(scenes) do ?>   <tr class="bg-primary">     <td colspan="3"><b><?=escape(scene.name)?></b></td>   </tr> <?   if isdefined(scene.trig_object) then ?>   <tr class="bg-info">     <td><?=numtoga(scene.trig_object)?></td>     <td><?=escape(scene.trig_name or '')?></td>     <td><?=escape(scene.trig_value)?></td>   </tr> <?   end   sequence = db:getall([[     SELECT s.object, s.value, o.name     FROM scene_sequence s     LEFT JOIN objects o ON s.object=o.id     WHERE s.scene=?     ORDER BY s.sortorder   ]], scene.id)   for _, item in ipairs(sequence) do   ?>     <tr>       <td><?=numtoga(item.object)?></td>       <td><?=escape(item.name or '')?></td>       <td><?=escape(item.value)?></td>     </tr>   <?   end end ?> </table> </body> </html>
Reply
#3
Super - it works perfect.
Thanks for your fantastic support (as always).
Reply
#4
Hi Admin

is it possible to do the same/similar for the Homekit-app?
Reply
#5
Try this:
Code:
1234567891011121314151617181920212223242526272829303132333435363738
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="/apps/css/bootstrap.css.gz"> <style>body { padding: 20px 20px 0 20px; }</style> <title>Homekit</title> </head> <body> <table class="table"> <? require('apps') devices = storage.exec('hgetall', 'app:homekit:devices') for _, device in pairs(devices) do   props = json.pdecode(device) or {} ?>   <tr class="bg-primary">     <td colspan="2"><b><?=escape(props.name)?></b> (<?=escape(props.type)?>)</td>   </tr> <?   for key, val in pairs(props) do     if (key:find('_status') or key:find('_control')) and type(val) == 'string' and #val > 0 then     ?>       <tr>         <td><?=escape(key)?></td>         <td><?=escape(val)?></td>       </tr>     <?     end   end end ?> </table> </body> </html>
Reply
#6
(21.02.2025, 09:53)admin Wrote: Try this:

Works perfectly  :-)

Thanks again (and again and ...)
Reply


Forum Jump: