OpenHab2 and Linear NGD00Z-4 Garage Door Controller

:vulcan_salute:

@chris, I haven’t gotten a reply from @ashgupta. Should I just clean these out of the db?

http://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-list/devicesummary/11

1 Like

Yep - I think it’s best. Thanks.

I’ll update your access in the database to demi-god so you can delete stuff (be careful! :wink: ).

That made me nervous… but the alarm CC is now removed from the db entry for the NGD00Z. TY!

@5iver - you mentioned in the other thread (Security ZWave Binding thread) about using Lambdas now for this device. Care to elaborate or share some of what you have going on? I’m working on re-tooling some rules and simplifying some things. I have a feeling this may be useful to do with this one since I have a bunch of rules to handle things like syncing the state of the switch vs a virtual switch and the barrier position numbers.

Sure thing! The door is controlled through the Switch item, which gets updated if the garage door is manually opened or closed.

ITEMS

Group    gGarageDoorOpener    "Garge Door Openers"    <garagedoor>
Switch    GarageAttached_Door    "Garage Door (Attached) [MAP(garagedoor.map):%s]"    <garagedoor>    (gGarageDoorOpener)
Number    GarageAttached_Door_Position    "Garage Door (Attached) [MAP(garagedoor.map):%s]"    <garagedoor>    (gGarageDoorOpener)    {channel="zwave:device:55555:node5:barrier_state"}
Switch    GarageDetached_Door    "Garage Door (Detached) [MAP(garagedoor.map):%s]"    <garagedoor>    (gGarageDoorOpener)|
Number    GarageDetached_Door_Position    "Garage Door (Detached) [MAP(garagedoor.map):%s]"    <garagedoor>    (gGarageDoorOpener)    {channel="zwave:device:55555:node55:barrier_state"}

DSL RULE

// put this import at the top of your rule file
import org.eclipse.smarthome.model.script.ScriptServiceUtil

rule "Update garage door state"
when
    Member of gGarageDoorOpener received update
then
    val actionItem = ScriptServiceUtil.getItemRegistry.getItem(if (triggeringItem.name.contains("_Position")) triggeringItem.name.replace("_Position","") else (triggeringItem.name + "_Position"))
    logDebug("Rules", "Garage door event: [{}] was updated to {} ({}): action item [{}], current state {} ({})", triggeringItem.name, triggeringItem.state, transform("MAP", "garagedoor.map", triggeringItem.state.toString), actionItem.name, actionItem.state, transform("MAP", "garagedoor.map", actionItem.state.toString))
    switch (triggeringItem.state.toString) {
        case "255",//open
        case "254",//opening
        case "253",//stopped
        case "252" : {//closing
            if (actionItem.state != OFF) {
                actionItem.postUpdate(OFF)
                logDebug("Rules", "Garage door event: updated switch [{}] to OFF (OPEN) after barrier_state update", actionItem.name)
            }
        }
        case "0" : {//closed
            if (actionItem.state != ON) {
                actionItem.postUpdate(ON)
                logDebug("Rules", "Garage door event: updated switch [{}] to ON (CLOSED) after barrier_state update", actionItem.name)
            }
        }
        case "ON" : {
            if (actionItem.state != 0) {
                actionItem.sendCommand(0)
                logDebug("Rules", "Garage door event: updated barrier_state [{}] to 0 (CLOSED) after switch state update", actionItem.name)
            }
        }
        case "OFF" : {
            if (actionItem.state != 255) {
                actionItem.sendCommand(255)
                logDebug("Rules", "Garage door event: updated barrier_state [{}] to 255 (OPEN) after switch state update", actionItem.name)
            }
        }
    }

MAP

0=CLOSED
ON=CLOSED
252=CLOSING
253=STOPPED
254=OPENING
255=OPEN
OFF=OPEN
-=Unknown
NULL=Unknown

EDIT: added handling of OPENING, STOPPED, and CLOSING states.
EDIT: removed lambda and change to ‘Member of’ trigger

Here is a similar example that I use for my door locks:

2 Likes

Nice!! Ok I think I recall seeing you share the one for the YRD lock that I have too. :wink: This looks quite similar.

I made a few untested updates :roll_eyes:

@chris, @5iver

I have recently done a clean install on a pi3…

My NGD-00Z is now securely included, but the only channel that is showing is the barrier-state. No other channels are available. Has this been seen anywhere else?

That is the only channel currently available. The other channels shouldn’t have been there… mostly ALARM CC, which is not supported by the opener.

Didnt realize it changed, my bad…i see you have added a lamda, do you use oh2? does the lamda go in a rules file?

Yes, currently 2.3.0 snapshot 1181.

Yes. There are plenty of posts with details on the use of lambdas, if you need it, but basically put it after any global variables.

thanks scott

i have no clue why i have such issues with this darn thing. cannot communicate, but it is securely included.

Is it not reporting or not taking commands, or both? I think the association will get set after discovery, but you could manually set it to be sure. What do you see in the log?

im getting nothing. ill check association, but cant until this eve. thanks scott.

@5iver

i have finally gotten around to figuring out why i have issues. log says it cant find transformations from the garagedoor.map file. i copied and pasted exactly what you have. any clue what i should be checking for?

Three things come to mind. Do you have the MAP transformation service installed? If so, did you create the file in Windows and save it to a Linux OH server? It may have incorrect EOLs in it… run dos2unix on the file or copy a working MAP file and then paste the contents into it. It could be a permissions issue too.

map service is installed. i created in notebook++. maybe now i should create is vscode…ill try it out and let you know.

just a curious sidenote question about oh in general…

can have multiple sitemaps, this i understand.

can one have multiple items files? that all get pulled into the sitemap, same with rules.

for restoreOnStartup does the persist file have to me named mapdb?

been using oh for a couple of years, but naming is something i have never fully undersyood.

Yes, you can have multiple rules, items, map, etc. files. Name them anything you want, but keep them in the right folders and use the appropriate file extensions.

I use mySQL and have a jdbc.persist file. The documentation reads that you’d use mapdb.persist file if using MapDB.

If you’re using OH in Linux, then it is likely the EOL. Notepad++ has a setting for this, and you can set a default. You can just change the EOL for the file in Notepad++ and save the file to change it.