Page 1 of 1

Blockly: Store current dimmer level in user variable?

Posted: Tuesday 12 January 2016 3:56
by david81
So, I'm just getting my feet wet with Blockly (coming from a coding background, it seems pretty straightforward). One thing that I'm hoping I'm missing is the ability to store the current level of a dimmer in a user variable. Basically, I'm trying to create a dimmer preset dummy switch that allows me to easily set a light to a certain level with a single click but to store the "previous" value is a user variable for when the preset is then turned off. Using the dimmer switch block as the "value" for the Blockly Set block just seems to write "device[3]" to the variable, instead of the actual value. Is this expected behavior?

Re: Blockly: Store current dimmer level in user variable?

Posted: Tuesday 12 January 2016 7:52
by Egregius
If you have a coding background, why use blockly then?
Try lua/bash/php, endless possibilities.
In php I would store that value in a memcache variable.

Re: Blockly: Store current dimmer level in user variable?

Posted: Wednesday 05 October 2016 21:37
by madrian
Is there any way to store Dimmer status before it turns off / or get current value if turned on?

I wrote this code to test it:

Code: Select all

commandArray = {}
if devicechanged['hello'] then
    print (otherdevices_svalues['hello']);
  end
if(devicechanged['hello']=='Off') then 
        print (otherdevices_svalues['hello']);
    elseif(devicechanged['hello']=='On') then  
         print (otherdevices_svalues['hello']);
end        
 
return commandArray
The result in both case is 0, so it's unable to get the actual value.

Any ideas?

Re: Blockly: Store current dimmer level in user variable?

Posted: Friday 07 October 2016 14:27
by madrian
Any ideas? :-)