RefreshTypes not working with OH 3

Hi,

I updated from 2.5.9 to 3.0 yesterday.
I am using a rule to detect whether my CCU3 is working, which I originally copied from some post here I guess.
Since the update I am receiving:

The name ‘RefreshType’ cannot be resolved to an item or type

Searching for “RefreshType” did not get any results with this problem for me.

So how can I force the refresh of an item in OH 3?

We might want to see that. Are you trying to import the type? Not necessary I think.

Hi,

I thought this was a general issue so I did not include my code, but here you go:

rule "Trigger CCU3 Variable refresh"
when
    Time cron "0 1,16,31,46 * 1/1 * ? *"
then
    CCU3_Connection_Test.sendCommand(RefreshType.REFRESH);

    val lastResetString = CCU3_Connection_Test.state.toString();

    if (lastResetStringPreviousValue != lastResetString) {
        lastResetStringPreviousValue = lastResetString;
        if (Status_CCU3_Available.state != ON) {
            Status_CCU3_Available.sendCommand(ON);
        }
    } else {
        logDebug("ccu3.rules", "No update was made by CCU3 - last update: " + lastResetStringPreviousValue);
        if (Status_CCU3_Available.state != OFF) {
            Status_CCU3_Available.sendCommand(OFF);
        }
    }
end

As I mentioned above I copied from somewhere and it worked before the update.

Hi,

I think I got it sorted out by correcting my import:
import org.eclipse.smarthome.core.types.RefreshType
became
import org.openhab.core.types.RefreshType.
The error does not occur anymore and my state item switched back to ON (which means the CCU 3 is available).

For me the import is shown as an error in the rule
import org.openhab.core.types.RefreshType.
org highlighted in red

Have you tried just
CCU3_Connection_Test.sendCommand(REFRESH)
with no import

3 Likes

Top