If value in Widget

Hello,

I am new. I am looking for a solution that if a value is 0 or 100, that in the panel then Off or On is displayed.

The reason is the evaluation of a valve on the gas heater

With the normal widget I found no solution there. The Dummy Widget shows me only 0 or 100. There I found no way.

Can someone tell me how I can realize that?

This is an international forum and the common language is English
For help in German try: https://knx-user-forum.de/forum/supportforen/openhab

Hello,
I have the text in English now. Thanks for the information.

Ok, what item have you got?
What binding?

Hello,
binding is an eBus for a Vaillant heater. The item is of type “String”.
The value is given by the valve actually from 0 - 100.

Ok, you will need

  • a proxy Switch item
  • a rule
  • a transformation (Maybe…)

What values correspond to ON and OFF?

What is the name of the item linked to this channel?

100% equals heating makes hot water
0% equals heating makes warm (underfloor heating)

“What is the name of the item linked to this channel?”
What do you mean by that?
How do I find that out for you?

What item did you use?

New item:
Create an items file in the items folder:
heating.items
Put that in it:

Switch HeatingValveSwitch

Create a rules file in the rules folder:
heating.rules
Put that in it: (replace yourItem with the item you used)

rule "Heating Valve changed"
when
    Item yourItem changed
then
    val valve = Integer::parseInt(yourItem.state)
    if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
    if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end

Hello, is that right?
I get in the HABPanel as a result “NULL”.

rule "Heating Valve changed"
when
    Item ebus:bai:5d51fcb4:08:bai_boiler_state-diverter-valve changed
then
    val valve = Integer::parseInt(ebus:bai:5d51fcb4:08:bai_boiler_state-diverter-valve.state)
    if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
    if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end

The item that you put in the rule is a thing not an item
You also need to change the widget to the item HeatingVallveSwitch

Thanks for the great help. Where do I find the right Item?

You need to link this channel to an item

I’m using Item Linking = Simple Mode set to on.
It would have to work that way?

rule "Heating Valve changed"
when
    Item ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve changed
then
    val valve = Integer::parseInt(ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve.state)
    if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
    if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end

Don’t
The system create items with names that are really difficult to remember and use

I don’t know, is ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve a Number item?

It is a “String”

Then do this:

rule "Heating Valve changed"
when
    Item ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve changed
then
    val valve = Integer::parseInt(ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve.state.toString)
    if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
    if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end

Hmmm … So does not work.

rule "Heating Valve changed"
when
    Item ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve changed
then
    logInfo("VALVE STATE", ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve.state.toString)
    val valve = Integer::parseInt(ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve.state.toString)
    if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
    if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end

What does the logs say?

openhab.log (654.3 KB)

Here’s the log