Author Topic: Clear up commands to dimmable lights  (Read 115 times)

Offline Deeps

  • Sr. Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Clear up commands to dimmable lights
« on: September 18, 2018, 11:59:14 pm »
Hi All

im using following code to set dimmer value from 0 to 100 in 10mins
local room_num=luup.devices[LUL_DEVICE].room_num;
   for k, v in pairs(luup.devices) do
      if(v["room_num"]== room_num and v["device_type"]==SUPPORTED_DEVICE_TYPE) then
         setDimmer(k,intensity);
      end
   end

here I have started timers which runs above for loop and then update dimmer intensity by 1%

My timer runs at around 3secs each. So in loop I send commands to all devices in room. Mean time next timer hits and then next commands gets send to all dimmable lights. This continues till all lights reach to ramp up to intensity.

But I have observed following scenarios
1. As the timers are very fast, many a times light gets next command before completing existing command
2. Due to this many commands gets pending and dimmable light executes commands in LIFO manner... latest first..
3. Therefore after completing last command ie reaching to highest intensisy, bulbs start executing pending commands and then it stops at random intensity.

How can I make it synchronize or how can I clear up pending commands queue, so that even if few commands skipped, they wont get executed later

Offline reneboer

  • Hero Member
  • *****
  • Posts: 1360
  • Karma: +77/-30
Re: Clear up commands to dimmable lights
« Reply #1 on: September 19, 2018, 04:54:38 am »
Hi,

Can't you make the steps bigger than just 1%. I found that I do not notice a difference on a 1% step, and for most lights not even on a five % one. Also LED lights typically do not dim linearly. For 100 - 70 I do not notice a difference. Maybe do some manual experiments and adjust your logic to that for the optimal light effect you are looking for.

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.

Offline Deeps

  • Sr. Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Clear up commands to dimmable lights
« Reply #2 on: September 19, 2018, 05:07:59 am »
Ok..

I am trying to update the logic.. But is their any way to recognize if command execution is completed? so that I can send next command

-Deep

Offline reneboer

  • Hero Member
  • *****
  • Posts: 1360
  • Karma: +77/-30
Re: Clear up commands to dimmable lights
« Reply #3 on: September 20, 2018, 04:48:14 am »
Hi Deep,

Not directly that I am aware of. The ZWave commands can be queued as you noticed. Only reading back the actual value to see if that matches with the expected and only then send the next command is what I can think of. I.e. you send the command to set the LoadLevelTarget, after completion that value should be reflected in LoadLevelStatus. http://wiki.mios.com/index.php/Luup_UPnP_Variables_and_Actions#Dimming1

Success.

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.