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

Offline michelhamelin

  • Full Member
  • ***
  • Posts: 150
  • Karma: +2/-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: 5873
  • Karma: +251/-69
  • "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]

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
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.