Blockly: Store current dimmer level in user variable?
Moderator: leecollings
-
- Posts: 6
- Joined: Thursday 31 December 2015 2:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Blockly: Store current dimmer level in user variable?
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?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Blockly: Store current dimmer level in user variable?
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.
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?
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:
The result in both case is 0, so it's unable to get the actual value.
Any ideas?
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
Any ideas?
Who is online
Users browsing this forum: No registered users and 1 guest