• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enhanced lua label action
#1
Because I needed to learn how to create support for my generic_http device,  I decided to first see if I could "port" the enhancements fot the generic_label device: setting background color and blinking.

So I updated the label.lua action and added the options to set and get the additional device values to label.c in libs/pilight/lua/devices/.

And it was working right away Smile .

Although I am quite happy with the result, I must say that having the actions in lua has one significant disadvantage. With the actions written in C, one could create a module and simply put it in the proper folder and you were ready to go. I have always been very happy with that easy way to add modules.
The fact that operators and functions were ported to lua, made that even more easy because you don't even have to compilie the modules anymore.

But now, for any new action and for any option added to a protocol we need to recompile pilight first to include the changes/additions made in libs/pilight/lua/devices/, instead of compling just the action module. This implies also reinstalling the config and the modules I made myself every time.

It is not the end of the world ofc. but I don't see the advantage of having the actions in lua this way.
 
Reply
#2
Quote:But now, for any new action and for any option added to a protocol we need to recompile pilight first to include the changes/additions made in libs/pilight/lua/devices/, instead of compling just the action module. This implies also reinstalling the config and the modules I made myself every time.
Changing the pilight core always implied recompiling. If that's with lua or c actions doesn't matter.
 
Reply
#3
I think it does matter, because for creating actions in c no core changes were required.
 
Reply
#4
If you extend the protocol it does. Developers shouldn't normally have to bother changing the core, because the lua library covers everything. But because the pilight library is under development, you should bother now.

If i understood correctly, you want to add BLINK and BGCOLOR. Both are not supported atm in the generic_label protocol, so you already have to extend that protocol. The only downside is that you have to extend the lua library as well. But that gives enough advantages.
 
Reply
#5
Yes, but I already had that extended label protocol plus action as modules. So no core update was required for it. Now I have to make a core update to be able to control it with the lua action.

I don't know if it would be possible, but what about allowing   these "lua devices" to be added as modules too?
 
Reply
#6
That's ofc very specific to your case Smile

As soon as protocols are lua modules as well, i will try to make those lua device wrappers automatically.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  action arguments not being checked at startup Niek 17 1,745 07-15-2018, 10:51 AM
Last Post: curlymo
  Long label text causes segfault Niek 10 1,330 06-29-2018, 02:18 PM
Last Post: Niek
  IP addresses not accepted as option value for an action Niek 4 664 06-25-2018, 01:59 PM
Last Post: Niek

Forum Jump:


Browsing: 1 Guest(s)