Page 1 of 1

Dimmer level as condition in Blocky

Posted: Sunday 02 June 2019 21:37
by gryzli133
Hi there, I have 20 Blinds running using MySensors program, that is counting time running up and down, giving me percentage as result. Now I have blocky script controlling the blinds. I would like to dimmer the blinds every evening to 50%, but if there are already below that value it should not run. I didn't find an option to do it with blocky. If I do like:
DomoticzBlindsCondition.PNG
DomoticzBlindsCondition.PNG (10.21 KiB) Viewed 4042 times
the condition is always true, means it does not metter if I;m already below 50% or not.

How to get the actual level into the Blocky If condition?

Re: Dimmer level as condition in Blocky

Posted: Tuesday 04 June 2019 7:42
by StanHD
The nested blockly wont work and also you cannot use the "if do" statement with the blue gear icon without an "else if".

Try using the plain "if do" block alone with the 2 conditions in an "and " block:-

If x=on and y > level 50%
Do Set y = level 50%

Re: Dimmer level as condition in Blocky

Posted: Saturday 23 May 2020 0:26
by ggorzki
I am trying to implement something similar, but it looks that Level % as a condition in IF does not work, it throws an error "attempt to compare string with number". I found a few threads confirming this, but I did not find any signs of workaround.
@gryzli133, did you solve it somehow in blockly?

Re: Dimmer level as condition in Blocky

Posted: Thursday 03 December 2020 22:12
by Fox27
hallo, I have the same problem.
i used a blocky with a dimmer:
"if dimmer in room > 10% then switch lamp outside = on" It does not work. :x
If I uses a regular switch:
"if switch in room2 = on then switch lamp outside = on" works :?

Re: Dimmer level as condition in Blocky

Posted: Tuesday 20 December 2022 23:35
by Louk
OK, this is an old thread, but it still has an open end: No solution or workaround... :cry:

As I ran into the same issue with the latest beta version today, I wonder what the status of this issue is???

Is there a workaround (like some kind of conversion between numbers and strings)?

Re: Dimmer level as condition in Blocky

Posted: Wednesday 21 December 2022 1:45
by solarboy
Blockly is great for simple events, and also for learning but do yourself a favour and learn dzvents, so so much more powerful and once you get past the initial learning curve it is actually easier (cut and paste, scrolling vs zooming etc etc).

Also, when a device changes idx you can still use the same script if the device name is the same, unlike blockly.

The dzvents wiki isn't great, it has all the details but not the supposedly obvious things but there are lots of example scripts and solutions in the forums

Re: Dimmer level as condition in Blocky

Posted: Wednesday 21 December 2022 2:38
by Louk
Thanks, and maybe I do this when I need too...

However, I was not only replying for my own benefit; I suppose I'm not the only one having this problem (wanting to test on a dimmer level) and not every Domoticz user has programming skills. For those users, Blocky is there only way out.

So my suggestion is to add a class dimmer that will return or set the dim level. Or even better to add two sub classes to this dimmer class (e.g. Dimmer.State and Dimmer.Level) where every class is a puzzle piece in Blocky of course.

The reason I want to check a dimmer's level is probably also very common: The LED lights behind this dimmer only start lightning when the level is above 15%, but that is too much light for the room most of the time, so we lower it to about 5%. When the lights are switched off and on again, it stays dark. So I designed a script that would test if the dimmer is ON and if the level is below 15%. In that case it should set the level 15% and, after a little delay, back to the original level. Quite simple, but not possible in Blocky because of this issue :( ...