0
Завершен

Multiple feedbacks on 1 button

Kenny Stoepel 8 лет назад в Общий обновлен Ekaterina (head of support) 8 лет назад 3

When a button has multiple feedbacks set behaviour accordingly "AND" condition, "OR" condition to its state example: if button has 5 FB then i would like the following. if there is only 1 on I want state 2, ALL off sets state 1. I would expect that people would want this the other way around too (ALL on = state 2 else state 1). the behaviour now is the last feedback sets the state of the button.

Завершен

For the moment it is not possible to use several feedbacks on single item with native tools. But please use the attached JS sample. It makes you able to compare the list of feedbacks by OR and AND condition

Compare-Feedbacks-By-Or-Or-And-Condition.irpz


// compare feedbacks by logic OR

function Check_OR(_name, _buff, _token) {
   IR.AddListener(IR.EVENT_TAG_CHANGE , IR.GetDevice(_name), function(name,value) {
      var device = IR.GetDevice(_name);
      var summ = 0;
      for (var i = 0; i <= _buff.length - 1; i++) 
      {
         if(device.GetFeedback(_buff[i]) > 0)   IR.SetVariable("Global." + _token, 1);
         summ += device.GetFeedback(_buff[i])
         if (summ == 0) IR.SetVariable("Global." + _token, 0)
      }
   });
}

Check_OR("KNX", // Driver Name
        ["Dimmer", "Relay 2/30:Channel 11", "f32", "u32", "s32", "u16", "s16"], // List of Fb
        "Token_OR"); // Driver token where the result will be written

// compare feedbacks by logic AND

function Check_AND(_name, _buff, _token) {
   IR.AddListener(IR.EVENT_TAG_CHANGE , IR.GetDevice(_name), function(name,value) {
      var device = IR.GetDevice(_name);
      var summ = 0;
      for (var i = 0; i <= _buff.length - 1; i++) 
      {
         if(device.GetFeedback(_buff[i]) != 0)              summ += 1;
         if (summ == _buff.length)                          IR.SetVariable("Global." + _token, 1);
         if (i == _buff.length - 1 && summ != _buff.length) IR.SetVariable("Global." + _token, 0);
      }
   });
}

Check_AND("KNX", // Driver Name
         ["Dimmer", "Relay 2/30:Channel 11", "f32", "u32", "s32", "u16", "s16"], // List of Fb
         "Token_AND"); // Driver token where the result will be written

could/will this behaviour be added to native tool set?

you'll be able to use the logic blocks to do such sings. It is planned for release this year

Сервис поддержки клиентов работает на платформе UserEcho