Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Search the Community
Showing results for tags 'sliders'.
-
As has been re-iterated many many times on this forum, there are two methods of updating a slider in a virtual device from a scene or another VD: Using fibaro:call(device, "setProperty", "ui.sliderX,value", value) causes the numerical value of the slider to be updated, but not the length of the slider bar. Neither does it execute the code behind the slider. Using fibaro:call(device, "setSlider", X, value) causes the numerical value and the length of the slider to be updated,, and executes the code behind the slider. In both cases, "device" is the ID number of the VD, "X" is the slider reverence number and "value" is the new slider value (0-100). Generall, option 2 is preferred because everything is updated. However, there seems to be an issue if the VD has more that nine sliders. Executing a few lines of test code for each of the methods illustrates this. First, method 1. Executing this code: local device = fibaro:getSelfId() local sliderString1 local sliderString2 local numSliders = 13 fibaro:debug('-----------------------------------------------------------') fibaro:debug('--Set Sliders----------------------------------------------') for i = 1, numSliders do sliderString1 = ('ui.Slider' .. tostring(i) .. '.value') fibaro:call(device, "setProperty", sliderString1, tostring(i)) fibaro:debug('Slider ' .. tostring(i) .. ' = ' .. tostring(i)) end fibaro:debug('--Read Sliders---------------------------------------------') for i = 1, numSliders do sliderString1 = ('ui.Slider' .. tostring(i) .. '.value') sliderString2 = fibaro:getValue(device, sliderString1) fibaro:debug(device .. ', ' .. sliderString1 .. ' = ' .. sliderString2) end Gives: [DEBUG] 16:21:04: --Set Sliders---------------------------------------------- [DEBUG] 16:21:04: Slider 1 = 1 [DEBUG] 16:21:05: Slider 2 = 2 [DEBUG] 16:21:05: Slider 3 = 3 [DEBUG] 16:21:05: Slider 4 = 4 [DEBUG] 16:21:05: Slider 5 = 5 [DEBUG] 16:21:05: Slider 6 = 6 [DEBUG] 16:21:05: Slider 7 = 7 [DEBUG] 16:21:05: Slider 8 = 8 [DEBUG] 16:21:05: Slider 9 = 9 [DEBUG] 16:21:05: Slider 10 = 10 [DEBUG] 16:21:05: Slider 11 = 11 [DEBUG] 16:21:05: Slider 12 = 12 [DEBUG] 16:21:05: Slider 13 = 13 [DEBUG] 16:21:05: --Read Sliders--------------------------------------------- [DEBUG] 16:21:05: 1044, ui.Slider1.value = 1 [DEBUG] 16:21:05: 1044, ui.Slider2.value = 2 [DEBUG] 16:21:05: 1044, ui.Slider3.value = 3 [DEBUG] 16:21:05: 1044, ui.Slider4.value = 4 [DEBUG] 16:21:05: 1044, ui.Slider5.value = 5 [DEBUG] 16:21:05: 1044, ui.Slider6.value = 6 [DEBUG] 16:21:05: 1044, ui.Slider7.value = 7 [DEBUG] 16:21:05: 1044, ui.Slider8.value = 8 [DEBUG] 16:21:05: 1044, ui.Slider9.value = 9 [DEBUG] 16:21:05: 1044, ui.Slider10.value = 10 [DEBUG] 16:21:05: 1044, ui.Slider11.value = 11 [DEBUG] 16:21:05: 1044, ui.Slider12.value = 12 [DEBUG] 16:21:05: 1044, ui.Slider13.value = 13 As would be expected. However executing a code snippet using method 2, like this: local device = fibaro:getSelfId() local sliderString1 local sliderString2 local numSliders = 13 fibaro:debug('-----------------------------------------------------------') fibaro:debug('--Set Sliders----------------------------------------------') for i = 1, numSliders do fibaro:call(device, "setSlider", tostring(i), tostring(i)) fibaro:debug('Slider ' .. tostring(i) .. ' = ' .. tostring(i)) end fibaro:debug('--Read Sliders---------------------------------------------') for i = 1, numSliders do sliderString1 = ('ui.Slider' .. tostring(i) .. '.value') sliderString2 = fibaro:getValue(device, sliderString1) fibaro:debug(device .. ', ' .. sliderString1 .. ' = ' .. sliderString2) end Give this: [DEBUG] 16:43:02: --Set Sliders---------------------------------------------- [DEBUG] 16:43:02: Slider 1 = 1 [DEBUG] 16:43:02: Slider 2 = 2 [DEBUG] 16:43:02: Slider 3 = 3 [DEBUG] 16:43:02: Slider 4 = 4 [DEBUG] 16:43:02: Slider 5 = 5 [DEBUG] 16:43:02: Slider 6 = 6 [DEBUG] 16:43:02: Slider 7 = 7 [DEBUG] 16:43:02: Slider 8 = 8 [DEBUG] 16:43:02: Slider 9 = 9 [DEBUG] 16:43:03: Slider 10 = 10 [DEBUG] 16:43:03: Slider 11 = 11 [DEBUG] 16:43:04: Slider 12 = 12 [DEBUG] 16:43:04: Slider 13 = 13 [DEBUG] 16:43:04: --Read Sliders--------------------------------------------- [DEBUG] 16:43:04: 1044, ui.Slider1.value = 10 [DEBUG] 16:43:04: 1044, ui.Slider2.value = 11 [DEBUG] 16:43:04: 1044, ui.Slider3.value = 12 [DEBUG] 16:43:04: 1044, ui.Slider4.value = 13 [DEBUG] 16:43:04: 1044, ui.Slider5.value = 5 [DEBUG] 16:43:04: 1044, ui.Slider6.value = 6 [DEBUG] 16:43:04: 1044, ui.Slider7.value = 7 [DEBUG] 16:43:04: 1044, ui.Slider8.value = 8 [DEBUG] 16:43:04: 1044, ui.Slider9.value = 9 [DEBUG] 16:43:04: 1044, ui.Slider10.value = 10 [DEBUG] 16:43:04: 1044, ui.Slider11.value = 11 [DEBUG] 16:43:04: 1044, ui.Slider12.value = 12 [DEBUG] 16:43:04: 1044, ui.Slider13.value = 13 Which is clearly wrong. Is this a bug, or have I done something really dumb (if so please enlighten me). If it is a bug, does a workaround exist? TIA.
- 1 reply
-
- vd
- virtual devices
-
(and 2 more)
Tagged with:
-
So off-topics are here to be fun and i try to be jesty person so lets see if we cna get thread going about fandoms in relationship to smart tech, i am allso science fiction fan BTW (just check tags). My proposed topic is as follows: what was your favourite use of smart technology in what science fiction and why. I will go with existentional thesis presented by Star trek The Next Generation, when their onboard computer got so smart it became self-aware and built itselve some sort of nest for conceousness .) in theme very simillar to other epissode with those smart repair bots that allso gained conceousness. But done more impactfully due to the fact that it was entire ship that was afficted by those growing pains. pretty neat epissode pretty nice mesage.
- 1 reply
-
- star trekstar gate
- star wars
- (and 6 more)