If value in Widget

habpanel
Tags: #<Tag:0x00007f0148b8ba50>

(Marcus) #1

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?


(Vincent Regaud) #2

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


(Marcus) #3

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


(Vincent Regaud) #4

Ok, what item have you got?
What binding?


(Marcus) #5

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.


(Vincent Regaud) #6

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?


(Marcus) #7

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?


(Vincent Regaud) #8

What item did you use?


(Vincent Regaud) #9

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

(Marcus) #11

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

(Vincent Regaud) #12

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


(Marcus) #13

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


(Vincent Regaud) #14

You need to link this channel to an item


(Marcus) #15

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

(Vincent Regaud) #16

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?


(Marcus) #17

It is a “String”


(Vincent Regaud) #18

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

(Marcus) #19

Hmmm … So does not work.


(Vincent Regaud) #20
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?


(Marcus) #21

openhab.log (654.3 KB)

Here’s the log