Example: Control music volume with Busch-priOn

Task

priOn is setup on group address 10/0/100 (data type 03.007 dimming control). How to make increase music volume by turning the central button clokwise.
Assuming that KNX group address 10/0/101 (data type 05.5byte unsigned integer) range is from 1 – 21 (5% volume increase on each number).

Event-based script

Add the following program which will trigger each time when the group address 10/0/100 on the priOn is activated with central button.

Note! Make sure that the object 10/0/100 is set to data type 3.007 and 10/0/101 to 5.001 in Logic Machine’s Objects tab.

Source code    
  1. step = event.getvalue()
  2. curvol = grp.getvalue('10/0/101')
  3. newvol = curvol
  4.  
  5. -- volume up
  6. if step == 0x0E then
  7. newvol = math.min(100, curvol + 5)
  8. -- volume down
  9. elseif step == 0x06 then
  10. newvol = math.max(0, curvol - 5)
  11. end
  12.  
  13. -- set new value
  14. if newvol ~= curvol then
  15. grp.write('10/0/101', newvol)
  16. end