Oh Yeah, I wasn’t complaining… The way I had it setup prior was it had to be accessed individually in the things list or the room. What I did now was remove the relay and sensor from the Garage Room and added in the virtual device. It is a lot cleaner now.
Same here… misc room with my presence sensors and now the garage stuff and other various things.
Also good to know it works with a tilt sensor as I actually have a regular door ie open close sensor with magnet on the one garage door.
Thank you very much @Lgkahn for your awesome work on this. It works great the user preference for the time out is a nice addition.
Yeah I would agree the resync when manually opening and closing the door was a neat little treat I noticed.
I have created the virtual device and installed the the SmartApp and everything appears to be working great. Thank you. Now the only thing I need to do is to customize the simulated door device type to decrease the run in time to 1 sec. The problem is I have no idea how to do that. Could you provide the steps you took to make that change?
Go into my device types in the ide,
- select new device type
- select from template
- select the simulated garage door device in the list
- make your changes to the code… recommend you also change the name so you can tell the difference from the stock one.
- go to my devices in the ide
- select your virtual or simulated door device
- select edit
- in the device type pulldown change it to your own custom device type you setup earlier with the change ( it will be in the bottom of the list)
- save changes
- retest
Complete 100% green noob here with new ST hub and a few devices.
No smartapps installed at this point. Still trying to wrap my head around all this.
I am particularly interested in this app though since I’m not very pleased with the basic ST functionality of the garage door setup. I have a door sensor installed on the garage door and installed a relay (LFM-20) on the garage door motor assembly. Using the ST app, it works, but I don’t like it. I have to hit the open/close button twice and it’s just…weird otherwise.
The way you’ve written this app pretty much makes it work the way I want it to work too.
So problem.
I got the virtual device created.
Next, I got to step #4 where I’m supposed to “make your changes to the code”. Not sure what that means though. I was assuming that I was to simply delete the existing code for the simulated garage door opener template and replace it with the code for this custom app. However, when I do this and then click ‘create’, it generates an NPE:
“Java.lang.NullPointerException: Cannot get property ‘locationDTO’ on null object”
What am I missing here?
No this code is a smartapp you add under smartapps. the existing code you copy and edit under device type code.
Uhm…yea.
First time adding a smartapp/virtual device here.
I understand that the code you provided is a smartapp and that I need to add it. But, there are three options when I go to add a smartapp (Form, Code, Template).
This time around, instead of Template, I added the code using the “Code” option. This seems to have behaved more like what I expected. I can see where various fields have auto-populated when I go into ‘Edit’ mode on this new custom smartapp. So it looks like maybe that was the correct way to do it. Yes?
So next, I’m lost. I do see the new device I created as a THING on my ST phone app (using the name for the virtual device) but I don’t see a way to edit its code.
The new THING does show that the door is closed. Haven’t tested it yet to see if it works (after hours).
Sorry for the annoying newb questions. Still learning.
Hey @ck42 so after you add the new smart app for the garage door and you publish it so you can add it in your app. The next step is to create the virtual device. There shouldn’t really be anything you need to change in the code itself. Just create the device and don’t forget to give it a unique device id i.e. VGD01.
Once you have that done go into the app. Go to the add button on the bottom right and then select the smart apps at the top.
Then click my smart apps and select the garage door one.
Fill out the form with the required information for the virtual door, then the door sensor and the door controller. Let me know if I’m being too vague with this. Thanks.
Thanks Lgkahn, that got me working.
Thinking that maybe I do NOT have the virtual device created (or created properly).
Looking at these steps here, it instructs me to use the Template option
Go into my device types in the ide,
select new device type
select from template
select the simulated garage door device in the list
make your changes to the code… recommend you also change the name so you can tell the difference from the stock one.
go to my devices in the ide
select your virtual or simulated door device
select edit
in the device type pulldown change it to your own custom device type you setup earlier with the change ( it will be in the bottom of the list)
save changes
retest
But, when I first tried using this option, I got the NPE.
But even after that part, I’m not clear what I do. I select the simulated Garage Door Opener device, but what then? “Make your changes to the code” ???
…man, anyone have a video for this? LOL.
I didn’t make any changes to the code, so I’d just ignore that tidbit for now.
Yeah, just realized that those steps were in regards to changing the Simulatated garage door “Template” (6 sec down to 1 sec value)
So if I’m not mistaken, there’s the simulated door “template” and there’s the actual smartapp ‘code’.
It seems that BOTH are used. The Template just being a framework for the simulated door device…and the code being the actual functional part. Both combined complete the custom smartapp. Sound right?
So I see now in THINGS:
Garage Door sensor (open/close sensor)
Garage Relay (LFM-20 relay)
Virtual Garage Door Opener
The relay and sensor are verified to be working (using original ST garage door app)
In the IDE, I see the smartapp here that I added. and it’s published. But, I don’t see this smartapp listed on my phone in the smartapps section. Shouldn’t I? Tried re-publishing it again. No change.
When I select the Virtual Garage Door opener THING, I see the app icons and I can select to open and close, and icons change color and all. But, the door never actually opens/closes.
In your phone go to the add new button in the lower right hand corner. Click the smart apps tab at the top. Then scroll down to the bottom where it says my smart apps (this is where anything that was published goes) Click the garage door app and fill out the values with your devices.
Got it. Getting closer now. Smartapp now displayed and filled out the different settings.
Now, selecting the Virtual garage door THING, it acts same as before. Pretends to be opening and closing but nothing really happens.
show the logging under the ide when you open the door with the old non virtual door opener…
than show the screenshots in the app where you have configured things… something is not configured right,
also show the logs when you try opening with the virtual device not the physical… you may have to open and close a couple times manually to get them in sync… also show the logs for that.
When using the virtual door opener, NOTHING is logged at all.
Used the old original opening THING to open the door:
19639e1d-12b1-4af3-bb94-e889b84553f7 8:13:03 PM: debug Garage Door Opened Manually syncing with Virtual Garage Door!
19639e1d-12b1-4af3-bb94-e889b84553f7 8:13:03 PM: debug Contact is in open state
19639e1d-12b1-4af3-bb94-e889b84553f7 8:13:03 PM: debug Contact is in open state
8:12:31 PM: info Waiting on events…

Change your “Choose the Virtual Garage Door Device Sensor (same as above device)” to be the Virtual-Garage Door Opener and give that a whirl.
Ok…did that.
Tried opening again, but no movement…but the logs certainly do give more detail now.
8:15:25 AM: debug Contact is in closed state
8:15:19 AM: debug Resetting Virtual Garage Door to Closed as real door didn’t open! (track blocked?)
8:15:19 AM: debug opening virtual door as it didnt open… track blocked?
8:15:08 AM: debug poll is sending [‘85010201’, ‘98810085010101’, ‘850202’, ‘delay 6000’, ‘988100850201’, ‘delay 6000’]
8:15:08 AM: debug setting association
8:14:59 AM: debug Virtual Garage Door Opened syncing with Actual Garage Door!
8:14:59 AM: debug opening real gd to correspond with button press
8:14:59 AM: debug Contact is in open state
I think the issue is with the real/physical relay THING. One of the things I noticed about it that annoys me is that I have to press the button in the app twice (not a fluke) for it to actually open or close the door. It doesn’t act like a momentary switch like the door opener on the garage wall. I think this smartapp is sending the signal equivalent of me just pressing the button once…which won’t work.