Hey there, I’m using OpenHAB 3 and this rule from a previous thread isn’t working anymore:
rule “Update door lock status”
when
Item Door_Lock_Alarm_Raw received update
then
if (Door_Lock_Alarm_Raw.state != “”)
{
switch (transform(“JSONPATH”, “$.event”, triggeringItem.state.toString)) {
case “1”, case “3”, case “5” :
{
Door_Lock.postUpdate(ON)
// logInfo(“Rules”, “Lock updated to ON (locked)”)
}
case “2”, case “4”, case “6” :
{
Door_Lock.postUpdate(OFF)
// logInfo(“Rules”, “Lock updated to OFF (unlocked)”)
}
case “11” :
{
Door_Lock.postUpdate(OFF)
logInfo(“Rules”, “Lock is jammed, so setting lock to OFF (unlocked)”)
}
}
}
end
There’s an issue with the triggeringItem part, but I don’t know what the issue is. I read that it’s now outdated but don’t know how to fix it? Could someone please send an updated version of it with the latest method? Thanks!
I’m curious now, how do I connect it to google home? Once I do, will the rule work and switch states on the google home app as well? Or is there anything else I have to do in order to make that happen?
Not that I know of, but I think some folks have tried to set codes using rules. It’s not straightforward, and
in my opinion it’s not worth the effort. You should find something if you search.
Yes, sort of. You need to make a REST API call from your rule. The REST call will set the Z-Wave config parameter associated with the specific code you want to set. If you search for posts here in the forum you’ll find some examples (e.g. search for “set zwave config parameter from rule”). Similarly, you can make a REST call to clear the code.
If you run Main UI and enable Developer Tools in your browser, when you set a code through Main UI you’ll be able to see the REST call it makes to set the code.