Logic Machine Forum
script for scene change - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: script for scene change (/showthread.php?tid=4018)



script for scene change - Vik - 26.04.2022

Hi,
I need a script for changing scene’s in a sequence ( scene1 … scene10 ) when we do a short “press-up” or “press-down” on a knx keypad.
 Example when we short “press-up”  the first time scene1 is triggered and it progresses to scene10 on the 10th short press. On the 11th short press scene1 is triggered again .
Similarly, when we do a short “press-down” the scene10 to scene9 and so on. In this case when we reach scene1 we jump scene10 after the short “press-down”.


thnx
vik


RE: script for scene change - admin - 26.04.2022

Attach your scenes to 1 byte unsigned object with trigger value from 1 to 10. Create an event script for scene up/down (1 bit). Change scene trigger object (32/1/17) as needed.
Code:
out = '32/1/17'

up = event.getvalue()
nr = grp.getvalue(out)

if up then
  nr = nr + 1
  if nr > 10 then
    nr = 1
  end
else
  nr = nr - 1
  if nr < 1 then
    nr = 10
  end
end

grp.update(out, nr)



RE: script for scene change - Vik - 26.04.2022

(26.04.2022, 11:25)Vik Wrote: Hi,
I need a script for changing scene’s in a sequence ( scene1 … scene10 ) when we do a short “press-up” or “press-down” on a knx keypad.
 Example when we short “press-up”  the first time scene1 is triggered and it progresses to scene10 on the 10th short press. On the 11th short press scene1 is triggered again .
Similarly, when we do a short “press-down” the scene10 to scene9 and so on. In this case when we reach scene1 we jump scene10 after the short “press-down”.


thnx
vik

Thanks I will try this script

Hi,
We need your hrlp on another script.

We would like to disable a ceiling mount motion sensors whenever we do a "long-press" ( relative dimm).

To disable the sensor we need a 1-bit data while the relative dimm is a 4bit data type.

We need a script which can disable the sensor whenever a long press is done.

regards,
vik


RE: script for scene change - Daniel - 26.04.2022

Just create event script on the dim object, change group as needed and if the disable value is 0 then change true to false
Code:
-- write value (e.g. boolean 'true') to object with group address 1/1/1, datatype must be set for this object
grp.write('1/1/1', true)



RE: script for scene change - Vik - 28.04.2022

(26.04.2022, 11:35)admin Wrote: Attach your scenes to 1 byte unsigned object with trigger value from 1 to 10. Create an event script for scene up/down (1 bit). Change scene trigger object (32/1/17) as needed.
Code:
out = '32/1/17'

up = event.getvalue()
nr = grp.getvalue(out)

if up then
  nr = nr + 1
  if nr > 10 then
    nr = 1
  end
else
  nr = nr - 1
  if nr < 1 then
    nr = 10
  end
end

grp.update(out, nr)

Thank you for this. it worked fine.

(26.04.2022, 14:20)Daniel Wrote: Just create event script on the dim object, change group as needed and if the disable value is 0 then change true to false
Code:
-- write value (e.g. boolean 'true') to object with group address 1/1/1, datatype must be set for this object
grp.write('1/1/1', true)


Thanks a lot for this. This worked fine too.