Mode Change Alerts - RM system variables?

@bravenel, @patrick
I would like to setup notifications for mode changes and HSM status changes.

Are there system variables I can use such [mode] or similar to pass on to the notifications?

If not, can these be implemented in a later update.

Thanks in advance for your consideration.

1 Like

This is essentially what I'm trying to replicate from webCore. Is this possible with RM?

1 Like

@bravenel, @Patrick
Sorry to keep pestering you two but I don’t know who else to reach out to for these types of questions. If I need to contact support, I’ll be happy to go that route, just let me know.
I can write a smartApp to accomplish this but would rather learn the capabilities of RM and not write a new smartApp for these simple alerts.

If you go the route of writing your own app, you can subscribe to “location”, like this:

subscribe(location, handler)

That handler will get all of the location events, which include mode and HSM events. See this post for details on HSM events: Hubitat Safety Monitor API

RM has the ability to catch mode and HSM events also, in a trigger. The trigger can then do whatever notification you want.

Thanks Bruce. I guess this means that access to these types of variables are not available to RM…correct?
The problem is that I would have to write a separate rule for every mode…unless there is a variable I can use that represents the current mode and insert that into the message.

I was hoping I could make my message be something like:
"${currentMode} is now active"
Which would be sent on any Mode change.

In any case, I went ahead and wrote a smartApp but I hope adding this functionality is on the roadmap. I’m not one to beg, but :pray: :smile:

For anyone interested here’s the App I wrote that sends notifications to Pushover using @ogiewon’s driver.

/**
 *  Mode Alert
 *
 *  Copyright 2018 Stephan Hackett
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
 
definition(
    name: "Mode Alert",
    namespace: "stephack",
    author: "Stephan Hackett",
    description: "Send notifications when Mode changes",
    category: "My Apps",
    iconUrl: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png",
    iconX2Url: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png",
    iconX3Url: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png"
)

preferences {
	section("") {
		//input("phone", "phone", title: "Enter phone # to receive SMS notification:", description: "Phone Number", required: false)
        input("myDevice", "capability.speechSynthesis", title: "Send push notification to:", description: "Choose notification device:", required: false)
        //input("message", "text", title: "Enter message to send:")
	}
}

def installed() {
	log.debug "Installed with settings: ${settings}"

	initialize()
}

def updated() {
	log.debug "Updated with settings: ${settings}"

	unsubscribe()
	initialize()
}

def initialize() {
	subscribe(location, "mode", modeChangeHandler)
}


def modeChangeHandler(evt){
	myDevice.speak("${evt.value} Mode is now active")
}
1 Like

I've just come across the same problem. There's no way to have RM send a notification regarding current Mode without it being a new event... apparently.... :frowning:

But one can have RM set a variable to the current mode based on mode changes events.

Depends on how you try to do it. Please explain the situation more thoroughly. You can test for the current mode in a rule, so you should be able to send the current mode using a strung out IF-THEN, ELSE-IF, ... sequence, even without a mode event trigger.

Oh, ok then I'll have to look into it more thoroughly. For now my "workaround" is doing the job and I'm facing another issue with Echo Speaks not detecting TTS capability in all my devices (identical devices).

Thank you @bravenel!

Here's a simple way to do it: Create a simple trigger rule, fired by mode changed. Then the action in the rule is to put %value% into a String Global Variable, say, "Current Mode". Then any other rule can access that GV to get the current mode.

@bravenel...related but unrelated...are we able to access GV in custom apps (read and/or write)? I have been unable to keep up with the recent changes since RM 4 and I'm hoping this is an option now. My searches haven't led to anything concrete.

Indirectly, yes. You can use a GV Connector to do so. When a GV Connector is created it creates a virtual device that is kept synched to the GV value. Changing the device value updates the GV and vice versa.

See this:

1 Like

I was hoping for a more direct method but that is more than adequate enough. I appreciate the way you guys have really expanded RM/GV functionality and wish I started playing earlier.

I assume I would be simply doing a sendEvent(name:variable,value:string)...correct?

Which is what I meant when I wrote:

:slight_smile:

Download the Hubitat app