Hi, I have configured my rules to send me an app notification whenever the rule runs. This notification is configured for a specific email ID registered under the myopenhab.org cloud account. However, this notification is coming to all the registered users under the openhab cloud account irrespective of the email ID mentioned. What is the fix for this?
Which notification action are you using? Please show the code from your rule.
Are the android apps configured with different usernames and passwords for the remote server connection?
Hi,
This is the complete rule file I have.
// ============================================================
// LG WebOS TV - Auto Power Off Rule (with Push Notifications)
// ============================================================
// Rule 1: Power OFF if TV is idle (on Home or Screen Saver)
// for 10 continuous minutes.
// Rule 2: Power OFF if media is PAUSED for 15 continuous minutes.
//
// Items used:
// LG_Power - Switch (ON/OFF)
// LG_webOS_TV_UT90406LB_Application - String (raw app ID from WebOS)
// LG_webOS_TV_UT90406LB_Media_Control - Player (PLAY/PAUSE/STOP)
//
// Notification: Only sent when TV is actually switched OFF automatically.
// ============================================================
// MyOpenHAB account email for push notifications
val String NOTIFY_EMAIL = "nishank.gupta@hotmail.com"
// Raw WebOS app IDs for idle detection
val String APP_HOME = "com.webos.app.home"
val String APP_SCREENSAVER = "com.webos.app.screensaver"
// --- Timers using OpenHAB's native Timer type ---
var org.openhab.core.model.script.actions.Timer idleTimer = null
var org.openhab.core.model.script.actions.Timer pauseTimer = null
// ============================================================
// RULE 1 — Idle Detection (Home / Screen Saver → 10 minutes)
// ============================================================
rule "LG TV - Start idle timer when on Home or Screen Saver"
when
Item LG_webOS_TV_UT90406LB_Application changed
then
val appName = LG_webOS_TV_UT90406LB_Application.state.toString
// Cancel any existing idle timer first
if (idleTimer !== null) {
idleTimer.cancel()
idleTimer = null
logInfo("LG_TV_AutoOff", "Idle timer cancelled (app changed to: " + appName + ")")
}
// Only start the timer if power is ON and app is Home or Screen Saver
if (LG_Power.state == ON &&
(appName == APP_HOME || appName == APP_SCREENSAVER)) {
logInfo("LG_TV_AutoOff", "TV idle on '" + appName + "' — starting 10-min idle timer")
idleTimer = createTimer(now.plusMinutes(10)) [|
val currentApp = LG_webOS_TV_UT90406LB_Application.state.toString
if (LG_Power.state == ON &&
(currentApp == APP_HOME || currentApp == APP_SCREENSAVER)) {
logInfo("LG_TV_AutoOff", "TV idle for 10 mins — switching OFF")
sendNotification(
NOTIFY_EMAIL,
"LG TV: Switched OFF automatically — idle for 10 minutes."
)
LG_Power.sendCommand(OFF)
} else {
logInfo("LG_TV_AutoOff", "Idle timer fired but TV became active — no action taken")
}
idleTimer = null
]
}
end
// ============================================================
// RULE 2 — Pause Detection (PAUSED → 15 minutes)
// ============================================================
rule "LG TV - Start pause timer when media is paused"
when
Item LG_webOS_TV_UT90406LB_Media_Control changed
then
val mediaState = LG_webOS_TV_UT90406LB_Media_Control.state.toString
// Cancel any existing pause timer first
if (pauseTimer !== null) {
pauseTimer.cancel()
pauseTimer = null
logInfo("LG_TV_AutoOff", "Pause timer cancelled (media state changed to: " + mediaState + ")")
}
// Start pause timer only if media is PAUSE and power is ON
if (LG_Power.state == ON && mediaState == "PAUSE") {
logInfo("LG_TV_AutoOff", "Media paused — starting 15-min pause timer")
pauseTimer = createTimer(now.plusMinutes(15)) [|
val currentMedia = LG_webOS_TV_UT90406LB_Media_Control.state.toString
if (LG_Power.state == ON && currentMedia == "PAUSE") {
logInfo("LG_TV_AutoOff", "Media paused for 15 mins — switching OFF")
sendNotification(
NOTIFY_EMAIL,
"LG TV: Switched OFF automatically — media paused for 15 minutes."
)
LG_Power.sendCommand(OFF)
} else {
logInfo("LG_TV_AutoOff", "Pause timer fired but playback resumed — no action taken")
}
pauseTimer = null
]
}
end
// ============================================================
// RULE 3 — Cleanup: Cancel all timers when TV is turned OFF
// ============================================================
rule "LG TV - Cancel all timers when TV powers off"
when
Item LG_Power changed to OFF
then
if (idleTimer !== null) {
idleTimer.cancel()
idleTimer = null
logInfo("LG_TV_AutoOff", "Idle timer cancelled — TV powered off")
}
if (pauseTimer !== null) {
pauseTimer.cancel()
pauseTimer = null
logInfo("LG_TV_AutoOff", "Pause timer cancelled — TV powered off")
}
end
And the answer to the second question?
Oops. Yes. They are all logged in through a different email ID registered on the same myopenhab.org for account.
I don’t have any recommendations. I don’t use notifications too much but I know others do. I don’t know what could be causing this behavior. All I can suggest is filing an issue on the openhab-cloud repo.
wow, i recently moved to the new lg tv with webos, you just gave me the idea to include home and screensaver to my existing rules of killing tv after 10 min (but was monitoring kodi screensaver ![]()
Most welcome.
Please help me if you have any idea about this app notification issue that I am facing.
sorry for your trouble, but I am on self hosted remote access with reverse proxy…I dont use google services on my phone for the last 10 years, so I really don’t know much about push notifications (which are not supported in my setup) or mypenhab.org cloud
Am on OH 5.2.0-SNAPSHOT #5309.
I use notifications. Apply the following rule syntax:
//openHAB Notification
sendNotification("xxx.yyy@zzz.com", "The door has been opened!")
The notification is sent to one email adress only.
Hi,
I am using the same syntax but it is going to all the registered devices on one Openhab cloud account.
NOTIFY_EMAIL is a variable defined in the beginning of the rule. Everything else remains same.
This issue is not just in this rule. It is all across the rules now. The behaviour has changed only since last 1-2 years. Before that it used to work properly.
sendNotification(
NOTIFY_EMAIL,
"LG TV: Switched OFF automatically — idle for 10 minutes."
No worries. Thanks ![]()
I just verified the following: my registered “devices” for OH notifications are 2 different iOS devices with related IDs. The email adresses which i use in rules seem to be linked through these definitions to the appropriate iPhone. Can this be the case?
I actually could troubleshoot and identify what was happening.
My email ID is the primary email ID that I used to register a cloud account on myopenhab.org. All other users registered with their own individual email IDs within the same openhab cloud account. When I am sending a notification on the primary email ID, then it is getting delivered (rather broadcasted) to all the users irrespective of they logged in the Openhab mobile app with their own email IDs. But when I send a notification to an email ID any specific child account, then it gets delivered only on that device.
This means, if a notification is sent to the primary email ID, it will get delivered to everyone.
I changed it to my another email ID which I registered as a user in the same Openhab cloud account and configured all my rules to use that e-mail ID only. My problem is resolved.
Sharing this here for everyone else who could be facing the similar issue.
Thanks guys for responding to my posts.
I don’t think you’ve mentioned which version of OH your are running. That might make a difference.
Sure, if that helps. I am on 5.1.4 version