Author Topic: How find a device number in all lua code  (Read 156 times)

Offline michelhamelin

  • Jr. Member
  • **
  • Posts: 91
  • Karma: +0/-0
How find a device number in all lua code
« on: March 25, 2017, 10:49:32 am »
I need to find and replace a device number in lua code trigger in many scenes (like searching and replace in a microsoft word),
is this possible? If so how i can do it? i am using Ui7 and Altui.

Thanks for your help


Offline akbooer

  • Master Member
  • *******
  • Posts: 4843
  • Karma: +207/-67
  • "Less is more"
Re: How find a device number in all lua code
« Reply #1 on: March 25, 2017, 11:05:07 am »
Well, this, of course, is why it's a good idea to use global variable, defined once at startup, in your Lua code.  But this is no help after the fact.

The scene definitions are all in the user_data, but perhaps more easily you can use the HTTP request to return them sequentially. For example, for scene 5:

Code: [Select]
<VeraIP>:3480/data_request?id=scene&action=list&scene=5

Similarly, the returned code can be searched and substituted, although perhaps a simple search and replace is too naive.  Having doctored the code the scene may be re- written with another HTTP request, as documented here http://wiki.micasaverde.com/index.php/Luup_Requests#scene
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P.
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay.