15.04.2016, 11:25
(15.04.2016, 10:20)AEK Wrote:(15.04.2016, 10:10)buuuudzik Wrote:(15.04.2016, 09:55)AEK Wrote:(15.04.2016, 09:49)buuuudzik Wrote: How Can I connect this scripts with a pushbuttons? Or I must add some .svg image which will be the button? Like in this case:
http://forum.logicmachine.net/showthread...light=long
in new firmware you should add additional class to icon in visualisation and add this code to custom javascript (Scripting -> tools)
Thank you for your answer but can you or somebody else add some 100% working very step-by-step example with all necessary information including how can I choose the GA of short and long pushbutton, how can I connect the specific class to the script. Please, I am very new in js, but I also want to use this functions. If Embedded Systems can prepare some training about using js in LM it will be very helpfull. I can also consider the participation in a such training if this will be paid training.
paste all Erwin's code to costom javascript, then choose function you need
for example
For scene button(s) with custom long push time detection after x seconds:
1) Create a 1 byte unsigned object and create button(s) in your visu with this main object
2) Enter in the additional class of the button(s) these classes: scenebutton normalpressed_0 longpressed_128 longpresstime_20
3) Change the value after normalpressed_xx or longpressed_xx into your wanted value for each different button between 0 and 255
4) Change the value after longpresstime_xx to the wanted long push time (xx (value) * 0.1second) = seconds for long push time
you need to set additional classes to some icon with data type 1 byte unsigned integer to scenebutton normalpressed_0 longpressed_128 longpresstime_20
and change values after "_" if you need
in this example you will recieve 0 for short press and 128 for long pres (2 seconds)
you can create event base script for this object and run some scenes from it
here is example of event
x = event.getvalue()
if x == 0 then
grp.write('1/1/1', true)
elseif x == 128 then
grp.write('1/1/2', 29.5)
else
-- do nothing
end
Thank you very good help. I will try this later, but thank you very much