Is there a manual for Lua?
Posted: Tuesday 05 January 2016 1:15
The manual from February doesn't seem to mention Lua - is there a (concise? complete?) description anywhere of what the Lua subsystem can do etc?
I can see some examples here but its a bit fragmented.
Use case: I'd like Domoticz to manage devices (I bought a Danfoss Z-Wave RS Room Sensor and it seems nice, I might replace my CF-MC/CF-RO based system with these), history, and so on - but I need to interface to some actors, most likely ethernet and/or USB relays.
I'm a little concerned about putting a lot of logic into Lua because:
- I rather prefer a strongly types language
- it seems clunks to run stateless scripts and have to store state in named variables
- I'm uneasy about having a 1-minute granularity on tick events
Anyway - it seems that my options are:
- to RPC against some sort of service
- dump the state to a shared environment (some sort of db, or just a file) and emit a datagram to trigger processing
- emit a datagram and use the JSON API from a helper process
I'm assuming the 'emit datagram' will be backed up with some sort of polled system too, in case of loss.
I see that Lua runs in its own thread - so maybe this whole thing can be executed synchronously from Lua. But what is the synchronisation between changes being actioned from Lua and from one r more JSON HTTP RPCs?
I guess I would have liked a means to start a subprocess that can stick around, and pass it a wakeup from Lua (whether a signal or a message to stdin). But I can't see a way to do such a thing nicely.
The helper/JSON system seems attractive - or it would be if user variables could be tracked and rendered on the dashboard so I can mirrow external actor state and visualise them - but that doesn't seem to be supported. Have I missed something?
Thanks
James
I can see some examples here but its a bit fragmented.
Use case: I'd like Domoticz to manage devices (I bought a Danfoss Z-Wave RS Room Sensor and it seems nice, I might replace my CF-MC/CF-RO based system with these), history, and so on - but I need to interface to some actors, most likely ethernet and/or USB relays.
I'm a little concerned about putting a lot of logic into Lua because:
- I rather prefer a strongly types language
- it seems clunks to run stateless scripts and have to store state in named variables
- I'm uneasy about having a 1-minute granularity on tick events
Anyway - it seems that my options are:
- to RPC against some sort of service
- dump the state to a shared environment (some sort of db, or just a file) and emit a datagram to trigger processing
- emit a datagram and use the JSON API from a helper process
I'm assuming the 'emit datagram' will be backed up with some sort of polled system too, in case of loss.
I see that Lua runs in its own thread - so maybe this whole thing can be executed synchronously from Lua. But what is the synchronisation between changes being actioned from Lua and from one r more JSON HTTP RPCs?
I guess I would have liked a means to start a subprocess that can stick around, and pass it a wakeup from Lua (whether a signal or a message to stdin). But I can't see a way to do such a thing nicely.
The helper/JSON system seems attractive - or it would be if user variables could be tracked and rendered on the dashboard so I can mirrow external actor state and visualise them - but that doesn't seem to be supported. Have I missed something?
Thanks
James