Ankündigung

Einklappen
Keine Ankündigung bisher.

Run logic for command combination

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Run logic for command combination

    Hello, i would like to run this scene :
    i have a double button for my shutter, one button for up and the other for down,
    i would like to run a logic (close all shutter or open all shutter) when i press the 2 buttons at same time and an other one to determine the direction.
    Do you know how to do this ? the 2 logics for close / open all the shutters are already working, but i don"t know how to interpret my button sequence.
    Thanks a lot for your help

    #2
    There was this thread about "double click" https://knx-user-forum.de/forum/supp...lick-via-logik
    I'm not sure was the current state of this is. Maybe Onkelandy can comment this?

    Kommentar


      #3
      I'm using this logic to use a double click and single click on ONE specific button. But I guess you can adjust it to your needs:
      Code:
      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      logger.info(trigger)
      
      invalue = trigger['value']
      item = sh.return_item(trigger['source'])
      scitem = sh.return_item(trigger['source']+'.singleclick')
      mcitem = sh.return_item(trigger['source']+'.multiclick')  
      scheduletask = 'singleclick-'+str(item)
      logger.debug("Multiclick getriggert durch: {0}".format(item))
      #if item() == 1:
      if 'click_count' in item.conf: 
          count = int(item.conf['click_count'])
          logger.info("Previous Age: {0}".format(item.prev_update_age()))
          if hasattr(logic, 'save_state_' + item.id()):
             if item.prev_update_age() < 0.8:
                val = int(getattr(logic, 'save_state_' + item.id())) + 1
                setattr(logic, 'save_state_' + item.id(), val)
                logger.info("Klickcount: "+str(val))
             else:
                setattr(logic, 'save_state_' + item.id(), 1)  
      
          else:
               setattr(logic, 'save_state_' + item.id(), 1) 
      
          if int(getattr(logic, 'save_state_' + item.id())) > count-1:       
             sh.scheduler.change(scheduletask, active=False)
             setattr(logic, 'save_state_' + item.id(), 0)
             logger.info("Fuehre Multiclickitem aus")
             mcitem(1)
          else:  
             logger.info("Fuehre Singleclickitem aus")  
             next_time = sh.now() + dateutil.relativedelta.relativedelta(seconds=1)
             sh.scheduler.add(scheduletask, scitem, prio=3, cron=None, cycle=None, value=invalue, offset=None, next=next_time)
             #setattr(logic, 'save_state_' + item.id(), 0)
      The item looks like this:
      Code:
              load:
                  type: bool
                  enforce_updates: 'True'
                  visu_acl: rw
                  knx_dpt: 1
                  click_count: 2
      
                  singleclick:
                      type: bool
                      enforce_updates: 'True'
                      visu_acl: rw
                      knx_dpt: 1
      
                  multiclick:
                      type: bool
                      enforce_updates: 'True'
                      visu_acl: rw
                      knx_dpt: 1

      Kommentar


        #4
        Thanks a lot, i will try to make the same with 2 buttons

        Kommentar

        Lädt...
        X