This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

In the firmware starting from 4.2016 there is Custom JavaScript feature available in LogicMachine --> Scripting --> Tools --> Edit custom JavaScript.
It is possible to create different dynamic tasks, like detect short/long press from visualization using one icon (Erwin, will you please add your example here) or as in this example, we can open specific Floor/Plan when some grp address is triggered - useful e.g. when you want IP Camera page automatically to be opened when Intercom button is pressed:

We can now create buttons with short / long press detection and send a value on press / release by adding some functions into the custom javascript.

Add content of the custom Javascript below into the custom javascript section as showed in the example of Edgars

For scene button(s) with default long push time detection after 3 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
3) Change the value after normalpressed_xx or longpressed_xx into your wanted value for each different button between 0 and 255

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_xxto the wanted long push time (xx (value) * 0.1second) = seconds for long push time

For doorbell button by bit object:
1) Create a 1 bit 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: doorbellbutton_bit released_0 pressed_1
3) Optional flip the value after released_x and pressed_x into your wanted value for each different button between 0 and 1

For doorbell button by byte object:
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: doorbellbutton_byte released_0 pressed_255
3) Optional change the value after released_xxx and pressed_xxx into your wanted value for each different button between 0 and 255

For screen button by 1x bit move object and 1x bit step/stop object:
1) Create 2 1 bit unsigned objects and create button(s) in your visu with move object as mainobject and step/stop object as status-object and use same image on 1 and 0
2) Enter in the additional class of the UP button(s) these classes: screenbuttonup longpresstime_15 the values 0 and 1 are hardcoded and follows the KNX standard.
2) Enter in the additional class of the DOWN button(s) these classes: screenbuttondown longpresstime_15 the values 0 and 1 are hardcoded and follows the KNX standard.
3) Change the value after longpresstime_xxto the wanted long push time (xx (value) * 0.1second) = seconds for long push time

For dimming button by 1x 3 bit dimming object and 1x bit switch object:
1) Create a 3 bit dim/blind (3.007) object and a 1 bit bit unsigned object and create button(s) in your visu with dim object as mainobject and switch object as status-object and use same image on 1 and 0
2) Enter in the additional class of the BRIGHTER button(s) these classes: dimbuttonup longpresstime_15 the values 9/1 and 8/0 are hardcoded and follows the KNX standard.
2) Enter in the additional class of the DARKER button(s) these classes: dimbuttondown longpresstime_15 the values 1/0 and 0/0 are hardcoded and follows the KNX standard.
3) Change the value after longpresstime_xxto the wanted long push time (xx (value) * 0.1second) = seconds for long push time

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.

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_xxto 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

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_xxto 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

I have update the custom Javascipt to support screen control with up/down step/stop buttons by short/long press with adjustable press time and dimming up/down on/off buttons by short/long press with adjustable press time

(15.04.2016, 10:10)buuuudzik Wrote: 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.

Hi,

You don't need to know the js, just paste the code (unchanged) into your custom Javascript (available in new firmware soon / this week).

After that create the buttons as usual only notice the status-object that might be mis-used for second object (;

Then add the additional class lines for each function you want to use on the matching button(s) and change the send or time values.

(15.04.2016, 10:10)buuuudzik Wrote: 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.

Hi,

You don't need to know the js, just paste the code (unchanged) into your custom Javascript (available in new firmware soon / this week).

After that create the buttons as usual only notice the status-object that might be mis-used for second object (;

Then add the additional class lines for each function you want to use on the matching button(s) and change the send or time values.

I changed a couple of timings to make it respond better on iOS.
Also added a remark to set status object to dummy object when not used to
make sure the main object won't update the button when longpress is reached. I will ask developer If and how we can bypass that.

For pc usage you probably won 't notice the difference but I would
advice to use current code to be real multi platform. I haven't test
on Android yet but i think it will run without issues.

I changed a couple of timings to make it respond better on iOS.
Also added a remark to set status object to dummy object when not used to
make sure the main object won't update the button when longpress is reached. I will ask developer If and how we can bypass that.

For pc usage you probably won 't notice the difference but I would
advice to use current code to be real multi platform. I haven't test
on Android yet but i think it will run without issues.

BR,

Erwin van der Zwart

Maybe you can know is it possible to add some tone on every visualisation click or only when the command is sended to the bus?