PLEG newbie question



  • So, I have a question about setting up a condition in PLEG. Here is the simple scenario:
    At 11:00 PM every night I want the system to check the state of the garage door and if it is open, then close the door. If the door is already closed, do nothing.

    So for the state of my garage door, my garage door controller node sends an S_LIGHT command where ON = door open, and OFF = door closed. If I use a trigger event type to say "If a device is turned on or off", and the mode "Whenever the device is turned on". Does that act like an event where it reacts ONLY when the node sends an on or off command, or does it check the current ON/OFF state? Or do I need to use a device property to check that?

    I hope I phrased that question well enough. If you are confused let me know.



  • Set up a schedule called sDoorCheck that starts every day at 23:00:00 with an end type interval, 00:00:01 secs.

    You need a trigger for the doors (eg tGarage_Door_Open - whenever device is opened).

    Now have a condition that basically says:

    sDoorCheck AND tGarage_Door_Open

    That condition should only be true at 11:00pm every night if the door is open. Set the appropriate action on the condition to close the door/send alerts or whatever.



  • @spanners said in PLEG newbie question:

    You need a trigger for the doors (eg tGarage_Door_Open - whenever device is opened).

    After some testing, I don't think it is a trigger that I need. I created a device property called pGarageDoorPosition. This property is tied to my device called "Garage door position" which reports 1 for open and 0 for closed. I opened and closed the door and checked the device property after opening and closing and it looks to report the value properly. I think that the rest of your logic is correct though. I will be testing this tonight.

    Out of curiosity, I read that there may be a cost to the plugin. Does anyone know what the cost is if any? I don't see anything indicating that it is in a trial period or anything.



  • @dbemowsk PLEG registration is less than $10 US. It's the best money you can spend on your Vera.

    Using a property is fundamentally no different. PLEG works on TRUE/FALSE comparisons. So you're comparing a value of 0 and 1 (pGarageDoorPosition == 1). Perform an AND with the schedule and you're looking for TRUE and TRUE. The trigger will read the same TRUE if it's open, but it also has an associated timestamp when it became TRUE. This can then be used in a time comparison say if the garage door is open, and has been open for more than 10 minutes - tGarage_Door_Open AND (tGarage_Door_Open; NOW > 00:10:00)

    Properties are best used for numerical value (say dimmer value or light level) or text comparisons. For open/close/on /off triggers are the usual choice..



  • @spanners that i guess was part of my question in my OP. My assumption on triggers was that a trigger acted like an event to where it was only true at the moment the event wss triggered (e.g. the moment the garage door registered to vera that it had opened) that was the reason i figured i needed too get the devices current state/ value.



  • @dbemowsk - nope, a trigger maintains state until it changes state again. So tGarage_Door_Open will be TRUE until it closes, when it then reads as FALSE.



  • @spanners Perfect, that was the exact answer I wanted. And if the registration for PLEG is less than $10 US, then I would agree that it is the best money spent on my Vera. The more I play with it, the more I see how it blows scenes out of the water as far as options. It is also a lot more user friendly than trying to write LUA code to do the same things.

    Thanks for your help


  • Hero Member

    About the Licensing of PLEG:

    You get 30 days free unlimited access from time of your first install.
    After 30 days, unlicensed users are allowed a total of 3 PLEG and/or PLTS devices each with a max of 5 inputs and 5 conditions.

    You can obtain a license that will allow you to create 4 PLEG/PLTS devices with no limitation to the amount of inputs or conditions. (You can obtain as many licenses as you need).
    A license is $5.50+tax



  • @korttoma said in PLEG newbie question:

    After 30 days, unlicensed users are allowed a total of 3 PLEG and/or PLTS devices each with a max of 5 inputs and 5 conditions.
    You can obtain a license that will allow you to create 4 PLEG/PLTS devices with no limitation to the amount of inputs or conditions. (You can obtain as many licenses as you need).

    Does this mean that if I pay the $5.50, I then get 3+4=7 devices? And if I paid another $5.50 that I would get 11 devices? If that is the case, I would then count the number of devices that I have set up on my Vera and divide that out to get the total cost.

    Does this mean too that I can have unlimited conditions on any of the devices that I buy licenses for? And where do I purchase these licenses?


  • Hero Member

    I'm not sure how exactly it works but I bet you could run all the conditions you need on just one PLEG device but it is nice to create another for different purpose. I have for example one PLEG for LIGHT controll, one for notifications and one for other automation.



  • @korttoma So it's per PLEG device, not per device that I would have controlled by Vera?



  • @dbemowsk - Yes it's per instance of PLEG. You can do everything in a single instance. Or as @korttoma says you can have multiple to separate things into logical groupings.

    The downside of multiple instances is Vera memory use - whether that is an issue will depend on which Vera you have and how much 'stuff' you have running on it.

    To register, just go into the PLEG editor and there's a "Register" entry on the Editor Options menu. Then hit the button for Registration Portal. Registration is online, pay by paypal.



  • @spanners Awesome... This community is the best.



  • So getting back to my original question on this, I am trying to get a PLEG action to work, but I am failing. Here are some screenshots. Keep in mind that I am on UI7 and not UI5.

    Here is my garage door trigger:
    0_1513559913334_98798849-6f2a-4271-b9a0-172d062df80b-image.png

    Here is a test schedule that I set up to figure this out:
    0_1513559974979_e03d81b8-1f85-46a8-813e-929ea05ea821-image.png

    Here is my condition. This is partially where I think I am going wrong. Not sure if I am doing the logical operators correctly:
    0_1513560042082_85ed1095-a56a-461a-bc92-238534ecda62-image.png

    And last, here is my logic action:
    0_1513560090387_a87f2696-fa31-41c9-8c70-373a00a19d01-image.png

    Let me know if the images are not clear enough, or if you have other questions.



  • @dbemowsk On PLEG's editor menu there's a logic report/status report option that gives you debug information. Use those instead of screenshots.

    But anyway, my recommendation is change the Off Type for your schedule to Interval 00:00:01.

    Your condition should be boolean, as you're using a trigger not a property. Try: sTimerTest AND tGarageDoorOpen



  • @spanners SO it appears that the schedules are not triggering correctly. This is from the status report a few minutes ago. If you look at sTimerTest, I had it set for 20:22:00, and it shows the last trigger to true at 20:17:18.325, which was me manually triggering it because the state was set to true and I wanted it at false. I don't see that it triggered at 20:22:00.
    0_1513564196418_8a016425-90a4-48e9-b278-ae432077310f-image.png



  • @dbemowsk did you reload Lua after making the changes? On the PLEG menu as well. ๐Ÿ™‚

    They donโ€™t take effect until a restart.



  • @spanners I bet that's it, I did not do that. I will test again.

    Many thanks for the help.



  • @spanners Just tested again after a LUA reload, and all is good.


Log in to reply
 

Suggested Topics

381
Online

7.4k
Users

8.2k
Topics

89.0k
Posts

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.