Smart Virtual Thermostat (beta version)

Yes, but it’s not your configuration, it’s the fact that the item has no history yet.
A quick (and dirty) hack is to change the lambda at the top of the rule:

val checkFirstS = [SwitchItem itemState, OnOffType itemCommand, int minutes |
        if(now.minusMinutes(minutes).isAfter(new DateTime(itemState.previousState(false, "influxdb")?.timestamp?.time))) {  //changed since to avoid flapping in minutes amount of time   
            if(itemState.state != itemCommand) itemState.sendCommand(itemCommand)
        }
        else {
            val timerItem = itemState
            val timerCommand = itemCommand
            createTimer(now.plusMinutes(minutes), [|
                if (timerItem.state != timerCommand) timerItem.sendCommand(timerCommand)
            ])
        }
    ]

2 question marks are added: "influxdb")?.timestamp?.time)
You’ll get a warning “Null-safe call of primitive-valued feature time, default value 0 will be used”, but this can be ignored.
It’s only needed for a few runs, because eventually there will be a historic value created in the database.

I am just thinking about another Project. WLANThermo for bbq smokers. The idea there: You connect a fan that pumps up some air into the smoker to raise the temperature of the cole.
The Method is, that you work there with a PWM FAN and there are intervals, where the FAN is turned on for X Seconds per Minute.

Homematic works like that:
The Valve is opened and as nearer you move into target temperature, the more the valve closes.
It seems that both mechanisms are using the same Method:
Calculate how many % you are away from your target and perform some action with the help of a multiplier, which becomes as lower, as you move to your target.

I can imagine, that this could work.
What do you think?

I’ve updated my version.
Some thing was bothering my a long time. When openHAB restarts sometimes I got my restored values and sometimes the default values.
I’ve never understand why, until I noticed that the rules engine and the persistent engine run parallel. I’ve tried to delay the System started trigger in version 0.2.15, but that didn’t do the trick (still unexpected behaviour).
Now with the new version, I’ve split the default values into a separate rule.
So when the system started, the values remain as it should be.

This project seems very interesting, will definetly check it out once i install openhab again