[SOLVED] Refresh interval only during the day

Hi folks,

is there a way to set the refresh interval and ask a binding to send the http GET only during the day (means from 8 AM to 8 PM)?

or a way to activate the binding only during that period of time?

Any follow up from https://github.com/home-assistant/home-assistant/issues/19931 ?

thanks
Andrea

You can disable and enable the openHAB Things used by a v2.x binding under the control of rules.

how? I’m trying to find a way to do so.

via sendHttpPutRequest is the only way?

Andrea

As you say, it uses sendHttpPutRequest

1 Like

question. I’ve tried with this rule:

rule "OpenUV Timeslot"
when
    Time cron "0 0 0/1 1/1 * ? *"
then
    val currHour = now.getHourOfDay
    if (currHour > 8 || currHour < 19) {
        sendHttpPutRequest("http://192.168.10.1:8080/rest/things/openuv:uvreport:local:home/enable", "application/json", 'true')
        logInfo("OpenUV Rule", "OpenUV is enabled")
    }
    else {
        sendHttpPutRequest("http://192.168.10.1:8080/rest/things/openuv:uvreport:local:home/enable", "application/json", 'false')
        logInfo("OpenUV Rule", "OpenUV is disabled")
    }
end

But even at 1 AM I see “openUV is enabled” in my logs.

What I’m missing?

Andrea

1 is less than 19

Wouldn’t you want > 7 && < 20 for 08:00 to 19:59 ?

1 Like

I need to enable from 9 (>7) to 18.59 (<19).

So 1 should be disabled. But this is matching the the rule (and I don’t know why)

Andrea

ahahaha right, I got the point :smiley:

Sorry for that :smiley: Just changed a bit

rule "OpenUV Timeslot"
when
    Time cron "0 0 0/1 1/1 * ? *"
then
    val currHour = now.getHourOfDay
    if (currHour <= 7 || currHour >= 19) {
        sendHttpPutRequest("http://192.168.10.1:8080/rest/things/openuv:uvreport:local:home/enable", "application/json", 'false')
        logInfo("OpenUV Rule", "OpenUV is disabled")
    }
    else {
        sendHttpPutRequest("http://192.168.10.1:8080/rest/things/openuv:uvreport:local:home/enable", "application/json", 'true')
        logInfo("OpenUV Rule", "OpenUV is enabled")
    }
end

@rossko57 it seems I have an issue. In facts when I disable the binding, in PaperUI I lose also the link between item and thing … and when the binding is back online, I don’t have my items populated.

I will try manually, to see if this is an issue with PaperUI.

Andrea