averageSince not working in Influxdb

Hi,
i tried finding something which could help me in the forum but i run out of luck. Hopefully somebody can help me

I try to get the averageSince for the power usage of my dishwasher, but i always get null returned instead of the average.

I do see the values in influxdb and also in grafana.

    Number Dishwasher_Power_Usage "Geschirrspüler Verbrauch" <whitegood> { channel="shelly:shellyplugs:....:meter#currentWatts" }

Here the rule

    val telegramAction = getActions("telegram",".....")
    logInfo("dishwasher", Dishwasher_Power_Usage.state.toString)
    logInfo("dishwasher", Dishwasher_Status.state.toString)
    logInfo("dishwasher", Dishwasher_Power_Usage.averageSince(now.minusMinutes(3,"influxdb")).toString)

    if (Dishwasher_Power_Usage.state == 0.0) {
        Dishwasher_Status.sendCommand("off")
    } else if (Dishwasher_Power_Usage.state > 2) {
        Dishwasher_Status.sendCommand("active")
    } else if (Dishwasher_Status.state.toString == "finished") {

    } else {
        if (Dishwasher_Power_Usage.averageSince(now.minusMinutes(3,"influxdb")) <= 2 && Dishwasher_Status.state.toString == "active") {
            Dishwasher_Status.sendCommand("finished")
            telegramAction.sendTelegram("[Geschirrspüler] Ich bin fertig.")
            TV_Living_Room_Toast.sendCommand("[Geschirrspüler] Ich bin fertig.")
        } else {
            Dishwasher_Status.sendCommand("standby")
        }
    }

Here the persistence settings

Strategies {
    everyMinute : "0 * * * * ?"
    default= everyChange
}

Items {
    Dishwasher_Power_Usage: strategy = everyMinute
}

So i know that averageSince is returning null.

Does somebody know how to fix it or if its is a bug?

Running oh2.5 with influxdb persistence 1.14.0

PS: Also checked for null values in the db, nothing. Only floats

This is your problem. The correct usage is:
Dishwasher_Power_Usage.averageSince(now.minusMinutes(3),"influxdb")

1 Like

Thanks, thats it.

So its an error in the documentation.

“Temperature.averageSince(now.minusMinutes(5,“influxdb”))”

Yes, I’ve already create a pull request to change it

1 Like