My first script momentry swicth

4 replies [Last post]
jprior4
Offline
Joined: 7 Jan 2011

Hi

 

I want to create 2 scripts one that simulates a momentry switch for example when a bsc command to turn hah relay 1 on the script would then wait 500 millisecond and turn hah relay 1 off making it a momenty switch.

Script 2 take a bsc input and then turn another end point on for example hah input 1 turns on the script would read this and turn on hah relay 2 on, hah input 1 turns off the script would then turn hah relay 2 off.

 

Can someone point me in the right direction, I have looked a the LUA page on here but I am not sure where to star I am used to vb asp but this does not see anything like these.

 

Thanks
John

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Check out the demo scripts

John.

Check out the demo scripts already on your HAH. I am sure the examples include scripts to do exactly what you need.

See bindrelaysapplet.lua and relay1autooffapplet.lua

If your still struggling I am sure all of us in here will give you the requested code but as these scripts are so basic I think it would be beneficial for your learning to give these a go yourself.

Scripts in the following folder: /etc_ro_fs/plugboard/samples. Let us know how you get on. Garry

jprior4
Offline
Joined: 7 Jan 2011
Plugboard example V1 syntax??

Hi Garry

Thanks for the pointer in the right direction, I have had a look at the example scripts, but they seem to be in V1 script engine syntax and according to the plugboard page THIS IS DEPRECATED AS OF HAH BUILD 280 USE V2 SCRIPT ENGINE? Do they still work?

Cheers
John

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Double check you're looking in the right place!

On my device the location described above has v2 scripts in it. Note the /etc_ro_fs directory NOT /etc Can you recheck and confirm? Also what version you running? Thanks Garry

jprior4
Offline
Joined: 7 Jan 2011
Hi GaryI am away from the HAH

Hi Gary

I am away from the HAH at the moment but I am sure I looked in /etc not /etc_ro_fs so I bet this is my problem. I think my version is 304 or 300 something.

 

Cheers
John

Hardware Info