If I wanted to change mode in a driver on say an event , would it be something like this, ? It doesnt seem to work.
sendLocationEvent(name: "Mode", value: "Night")
sendEvent(name: "Mode", value: "Night")
If I wanted to change mode in a driver on say an event , would it be something like this, ? It doesnt seem to work.
sendLocationEvent(name: "Mode", value: "Night")
sendEvent(name: "Mode", value: "Night")
I use
setLocationMode(mode)
Thanks, do I need to put anything else in the driver, say attributes or commands, as it's not working. Something simple, no doubt.
I actually use the command in my ABC app and haven't done it in a driver. I don't know exactly how you want your driver to work but I assume you would want to have an input where the user would enter the mode you would want to set. That input would be stored in that input setting and used as "mode" in the command I shared above.
Here is the method I use
def changeMode(mode) {
log.info "Changing Mode to: $mode"
if (location.mode != mode && location.modes?.find { it.name == mode}) setLocationMode(mode)
}
I have an alarm connected to HE. I would like the alarm status (Armed, Home, Partially Armed) to set my HE Mode (Home, Away, Night (sleeping)).
In the driver, there are commands that set the alarm status to Armed, Home, Partially Armed, based on when the alarm is turned off by our remotes etc. I'd like to just add in a section that also sets the HE Mode for each of the three alarm status'.
In the method for each command you should be able to add the line of code I shared.
Eg
Assuming setArmed is the name of the command to set your alarm to armed
def setArmed() {
Code to set alarm status....
setLocationMode("name of mode here")
}
Thanks, yes. That works. Perfect. Saves me much effort with Virtual Switches.
Although, for posterity, it's SetLocationmode. I had it as SetLocationMode and it changed the Mode, not mode. The system didnt change the mode from "Day", according to the Mode page, and the dashboards.
I believe case is important here...but for me setLocationMode is what works and what was documented.
By the way, according to previous posts from @bravenel, this should also work. The issue may have been that you have
name: "Mode"
Instead of
name: "mode"
Actually, it's not working. It is changing the mode to "Night" according to the dashboard , but it is not changing the actual mode according to the mode page, and the Location events page.
This is a call from a driver, and this is the code I'm using.
sendLocationEvent(name: "mode", value: "Night")
Edit: uploaded wrong image.
Who is the rule manager for me to tag.
I don't know if this is a bug, or not supposed to work.
I think mode changes have to be done in an app, not in a driver. Devices can't talk to each other, that takes an app. So it would be logically for mode changes to follow the same rule since technically it's one device controlling the attributes of another.