openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.57k forks source link

[Telegram] sendTelegramQuery: Query not sent after "long pause" #12753

Open SHU-red opened 2 years ago

SHU-red commented 2 years ago

Expected Behavior

Current Behavior

I hope there is no error on my side, but the fact that exactly this code is working after i re-set the time value for testing purposes tells me that i did not make errors in coding ... hopefully

Possible Solution

Steps to Reproduce (for Bugs)

  1. Do nothing and wait for the rule to execute in 3 days at 9am

Context

rule "Check for cleaning request"
when
Time cron "0 0 9 * * ?"
then
logInfo("VACUUM", "CHECK FOR CLEANING REQUEST")

// if exactly three days are gone
if (dVac1_last_clean_days.state == 3){

    // notification
    val telegramAction = getActions("telegram","telegram:telegramBot:mybot)
    telegramAction.sendTelegramQuery("<b> &#129529; Shall i clean up? &#129529; </b>\n\nLast time was " + dVac1_last_clean_days.state.toString + " days ago!","oh_esme_sweep","Sweep","No Action")

    // Specified with chatID but same result as without
    // telegramAction.sendTelegramQuery(-123456789L,"<b> &#129529; Shall i clean up? &#129529; </b>\n\nLast time was " + dVac1_last_clean_days.state.toString + " days ago!","oh_esme_sweep","Sweep","No Action"

    // Other code getting executed properly

    logInfo("VACUUM", "CLEANING REQUEST ADDED TO LOGLIST")
}

end

Your Environment

runtimeInfo: version: 3.2.0 buildString: Release Build locale: en-US systemInfo: configFolder: /openhab/conf userdataFolder: /openhab/userdata logFolder: /openhab/userdata/logs javaVersion: 11.0.13 javaVendor: Alpine osName: Linux osVersion: 5.10.109+truenas osArchitecture: amd64 availableProcessors: 4 freeMemory: 98751320 totalMemory: 310378496 bindings:

openhab-bot commented 2 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/telegram-sendtelegramquery-not-working-after-long-inactive-time/136353/1

lsiepel commented 3 weeks ago

Can you confirm this problem still exists on openHAB 4.2.0 ?

If so, can you provide a log with the rules, slightly adapted with extra logging:

rule "Check for cleaning request"
when
Time cron "0 0 9 * * ?"
then
logInfo("VACUUM", "CHECK FOR CLEANING REQUEST")

// if exactly three days are gone
if (dVac1_last_clean_days.state == 3){
    logInfo("VACUUM", "SENDING CLEANING REQUEST")

    val telegramAction = getActions("telegram","telegram:telegramBot:mybot)
    telegramAction.sendTelegramQuery("<b> &#129529; Shall i clean up? &#129529; </b>\n\nLast time was " + dVac1_last_clean_days.state.toString + " days ago!","oh_esme_sweep","Sweep","No Action")

    logInfo("VACUUM", "CLEANING REQUEST ADDED TO LOGLIST")
} else {
    logInfo("VACUUM", "NO SENDING A REQUEST DAYS SINCE LAST CLEAN :" + dVac1_last_clean_days.state)
}

end