Scripts not working

I want to get started with the more intelligent stuff. So, I started with sample script to switch off the relay1 after its on for 30 secs., but I get this error:-

 

# cd /etc

# cd plugboard

# ls

relay1AutoOffApplet.lua

# lua relay1AutoOffApplet.lua

lua: relay1AutoOffApplet.lua:7: bad argument #1 to 'module' (string expected, got nil)

stack traceback:

        [C]: in function 'module'

        relay1AutoOffApplet.lua:7: in main chunk

        [C]: ?

Member for

15 years 1 month

allanayr

15 years ago

Have you rebooted the box with the Applet in the /etc/plugboard directory. I don't think you can run it using the command line (lua  relay1AutoOffApplet.lua) the plugboard script needs to pick it up when the box starts up.

Member for

16 years 4 months

Alanmh

15 years ago

It might be just that I am not reading the docs thouroughly enough, but I rebooted and the script didnt work until I manually ran xap-plugboard from the command line.

Surely it should pick it up automatically. Could this be because I have an old chip (new one on order)

Member for

16 years 10 months

brett

15 years ago

The LUA engine is not dependant on any AVR firmware version.

Rebooting will load the applet but if you want to see what is going on its best to stop the plugboard daemon and run it manually from the command line.

# /etc/init.d/xap stop plugboard
# xap-plugboard -i br0

The applet should fire after 30sec of detecting an ON event for relay 1.

I might add that anytime the plugboard engine crashes, when started automatically it will log into /var/log a stack trace for diagnosis.  Rebooting erases this area so if you want to find out why it broke, do so BEFORE rebooting.

Member for

16 years 4 months

Alanmh

15 years ago

I was just a bit too quick after the reboot. A look at xfx viewer showed two responses, which suggests to me that I had two instances of plugboard running - the automatic one and the one I started manually.

 

Doh!

 

Still - I learnt something!