I have a problem changing String values and displaying them in BasicUI

oh, sorry, forgot to change it. I copied an old textblock in.

Still nothing happens. I switched the dishwasher on, Leistung goes from 0 to 3.7W (a change) and the String is still empty :frowning:

In order to really if a rule was running use a logInfo line after the then like:
logInfo ( "MyRulename", " My rule triggered")
This should print a line in the logs.

Additionally please check the log after you made a change to the .items file, it could be that there is a problem in the above the definition in question and the parser stopped reading it.

This caused the next Problem. I don’t get any Logs.
I changed the environment and logging path (works for persistence and database). And there are no Logs in the Log Folder. Also the standard folder /var/log… is empty.

I’ll build my own “log”. I’l define a switch, which changes from off to on, when Leistung changes. Worked in my previous Dishwasher setup

I guess, the “when” does not work.
I built a Switch and a Rule, but the Switch does not move, when “Leistung” changes.

rule "Spuelmaschine_Betriebszustand"

when
    Item Kueche_Spuelmaschine_Leistung changed
then
    if (Kontrollschalter.state == OFF) {
            Kontrollschalter.sendCommand(ON)
    }
    else if (Kontrollschalter.state == ON) {
            Kontrollschalter.sendCommand(OFF)
    }

end

You’d better get the logging problem solved, otherwise you will not be able to resolve the posted problem nor the problem of the other items not showing desired values/ strings.

1 Like

I have an Idea, what the Problem is. The folder is on a RAMFS, and I remounted it. Maybe I should reboot the Server and let fstab automaticly mount it.

Logging on a RAMFileSystem, have fun reading the logs after a restart.

No Problem. They get copied every hour on my SSD by a cron job, also at every shutdown. At the startup the files get copied back into the RAMFS
I may be an OpenHAB noob, but not at Linux :smiley:

by the way: the controll switch started moving, when i changed the “When” to:

Item Kueche_Spuelmaschine_Leistung received update

Now the Rule looks like this:

rule "Spuelmaschine_Betriebszustand"

when
        Item Kueche_Spuelmaschine_Leistung received update
then
        if (Kontrollschalter.state == OFF) {
                Kontrollschalter.sendCommand(ON)
        }
        else if (Kontrollschalter.state == ON) {
            Kontrollschalter.sendCommand(OFF)
        }

    if (Kueche_Spuelmaschine_Leistung.state <= 0.5 ) {
        Kueche_Spuelmaschine_Betrieb.sendCommand.toString("Aus")
}
end

the String still does not show any thing in BasicUI

1 Like

Stop doing that, again.

To everyone with the same Problem:

I guess i solved it. When you want to write a predefined value into a String item, " toString("…") " seems to be wrong syntax. What worked:

rule "Spuelmaschine_Betriebszustand"

when
        Item Kueche_Spuelmaschine_Leistung received update
then

        if (Kueche_Spuelmaschine_Leistung.state == 0)
        {
                Kueche_Spuelmaschine_Betrieb.sendCommand("Aus")
        }

        else if (Kueche_Spuelmaschine_Leistung.state > 4.5)
        {
                Kueche_Spuelmaschine_Betrieb.sendCommand("Läuft")
        }

        else if (Kueche_Spuelmaschine_Leistung.state > 0 && Kueche_Spuelmaschine_Leistung.state <= 4.5)
        {
                Kueche_Spuelmaschine_Betrieb.sendCommand("Fertig")
        }
end

Tip - VSCode with openHAB extension can be used for editing rules, and will highlight syntax errors for you.

2 Likes

Oh, thanks. I have Visual studio already and should try that.
I wrote the rules via SSH in nano … Admin Style :rofl:

Which has been pointed out to you several times in this thread AND which is clearly written in the Documentation.

Yes, sorry, I musunderstood something. I thougt state should be changed into sendCommand and the Rest stays the same. I read the Documentation, but because of the other errors, the test without this expression did not work either. In all of the examples I found “toString” was used, guess because in all of them someone wanted to convert something into a String, add Number and so on.