Hello guys,
I am trying to be friend with google’s blockly.
I am trying to make a script toggling the smart plug with Xiaomi Smart Cube. What is wrong with this script?
Is there a webpage with examples of blockly in OH3?
Thank you,
M.
Hello guys,
I am trying to be friend with google’s blockly.
I am trying to make a script toggling the smart plug with Xiaomi Smart Cube. What is wrong with this script?
Is there a webpage with examples of blockly in OH3?
Thank you,
M.
if item Kocka == SHAKE_AIR
is not really meaningful. The Item is never going to be SHAKE_AIR. The Item’s state probably will be what you want to test (just like you do on the nested if statement).
With a rule like this, you don’t even need Blockly. You can create two rules:
Second rule
No code required.
Thank you for good explanation!
I was experimenting with your reccomendation and now I can control roller blind and a socket in my test room.
If they are 5% and less closed and I shake with cube, they are going down and turning on the socket
In other case they are going up and switching off the light.
There is only a short step to adapt it to group of Ikea blinds and the ceiling light in Living room now!
1st Rule
2nd Rule
I did not add But only if RoletaZadna_Position >= 5
, because it was not working.
M
BTW,
would this be correct then?
why there should be the purple frame around it?
M
Maybe. You’d have to try it to see if it will work. I don’t see anything wrong with it but I don’t have Blockly memorized. The purple block looks like you added a function or something.
I ended up with two rules, one with roller position = 100 and another = 0. the < > signs was not working good.