This page last changed on Jan 06, 2015 by gegy.

Hello.

Can somebody help me in setting the label text of my UI depending on the sensor state?
I have a sensor for my roller shutter which returns a min (0) and a max (255) Value.
I don't want to see the value of the sensor, i want to see three possible states:
OPEN , CLOSED and HALF-CLOSED
How can i do this?

Many Thanks

Which value does correspond to half closed?

Posted by pz1 at Jan 06, 2015 20:25

Any other than 0 or 255.
With "half closed" i want only tell that it is not fully closed or fully open.

Posted by gegy at Jan 06, 2015 20:28

Afaik there is no simple direct solution. I guess you have to use the Drools Rule engine. Also search for some examples in this forum

Posted by pz1 at Jan 06, 2015 20:42

I think i need only the command for setting a label text in the rule editor.
Is it possible to read the sensor value by using?

Event( source == "MySensor", value <> 0 OR value <> 250 )

Posted by gegy at Jan 06, 2015 20:50

Event( source == "MySensor", value <> 0 OR value <> 250 )

This should be

Event( source == "MySensor", value != 0, value != 250 )

in Drools.

Posted by aktur at Jan 07, 2015 13:51

Ok.
And how can i set the lable name depending on the value?

Posted by gegy at Jan 07, 2015 14:06

When you create in-memory virtual command status then you can set it from a rule with this:

  execute.command("Your in-memory command name", "value");
Posted by aktur at Jan 07, 2015 15:13

Many thanks, i will give it a try.

Posted by gegy at Jan 07, 2015 15:38
Document generated by Confluence on Jun 05, 2016 09:34