Author Topic: Please Take a Critical Look at my Logic.  (Read 1089 times)

Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Please Take a Critical Look at my Logic.
« on: January 09, 2018, 06:50:20 pm »
I'm trying a simple PLEG that will set the House Mode to Away Mode when it is in Home Mode and any of my locks are locked using the Lock Button.

Am I on the right track?

TIA


Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #1 on: January 09, 2018, 07:04:31 pm »
After Reloading the LUA I get this error:

"Program Logic Event Generator (PLEG)[348] : m11 AND ( t1_Laundry_Door_Locked OR t2_Front_Door_Locked OR t3_Back_Door_Locked ): Invalid Value token: M11"

Not sure how M11 got in there and not sure where to go to delete it.

Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #2 on: January 09, 2018, 07:27:28 pm »
Made a few tweaks now this:

"Set to Away[348] : Home AND ( t1_Laundry_Door_Locked OR t2_Front_Door_Locked OR t3_Back_Door_Locked ): Invalid Value token: HOME"

Offline kartcon

  • Full Member
  • ***
  • Posts: 143
  • Karma: +7/-0
Re: Please Take a Critical Look at my Logic.
« Reply #3 on: January 09, 2018, 07:30:29 pm »
Rename the Mode Naming to m_Home with the Mode HOME. This is not necessary, but will help you understand that it is a House Mode setting and helps clarify the condition parameters later on, if you ever need to revisit your code and logic.
Replace
Code: [Select]
m11 AND ( t1_Laundry_Door_Locked OR t2_Front_Door_Locked OR t3_Back_Door_Locked )with
Code: [Select]
m_Home AND ( t1_Laundry_Door_Locked OR t2_Front_Door_Locked OR t3_Back_Door_Locked )
m11 came to be when the Mode was created and either immediately deleted or renamed. It is the second instance of the m1 auto-named mode, so it could have occurred during testing. PLEG is very good at updating naming conventions, but you can not expect perfection, especially if something gets deleted while still used in another area (like a condition). I have seen this occur in my own testing and it is easily fixed. If these simple steps don't fix it, delete BOTH the Mode and Condition and start fresh.

It isn't necessary to increment your trigger names (t1_xxx, t2_xxx and so forth) but it does not hurt either. I find it easier to simply use t_ for triggers, c_ for conditions, m_ for house modes and p_ for properties. Keep it simple and its easier to maintain when your list becomes larger.

Offline kartcon

  • Full Member
  • ***
  • Posts: 143
  • Karma: +7/-0
Re: Please Take a Critical Look at my Logic.
« Reply #4 on: January 09, 2018, 07:32:17 pm »
Maybe HOME is a reserved keyword, and my previous comment about not being necessary was a mistake.  ???

Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #5 on: January 10, 2018, 10:59:44 am »
Maybe HOME is a reserved keyword, and my previous comment about not being necessary was a mistake.  ???

Thanks for your responses. I'll look into it later today and report back.

Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #6 on: January 13, 2018, 11:11:49 am »
So here's what I have now but it isn't changing the House Mode to Away when I trigger a door lock. I clicked "Reload Lua" and I refreshed my browser.

Offline RichardTSchaefer

  • Moderator
  • Master Member
  • *****
  • Posts: 10061
  • Karma: +759/-141
Re: Please Take a Critical Look at my Logic.
« Reply #7 on: January 13, 2018, 11:50:39 am »
People will be able to much more easily help you if you provide the STATUS report.
You see the value of variables and WHEN they were changed.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1258
  • Karma: +31/-32
Re: Please Take a Critical Look at my Logic.
« Reply #8 on: January 13, 2018, 07:42:34 pm »
Attached is an example.
Vera 3, 1.7.1030, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb

Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #9 on: January 14, 2018, 02:15:23 pm »
I was not around yesterday but here's the status report. When I hit the lock button, it doesn't go into Away mode.

Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #10 on: January 14, 2018, 02:24:31 pm »
I am wondering if this is related to Vera's recent issues with Schlage Locks? It seems that the lock state isn't being updated as the date for change in lock state is on January 9, and I just manually pressed the lock button on the lock but the change in house modes seems to be getting reported.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1258
  • Karma: +31/-32
Re: Please Take a Critical Look at my Logic.
« Reply #11 on: January 14, 2018, 03:32:34 pm »
You may be on to something. From what I can see, the last time any of the locks triggers we true were was 1/9. And none were false. If doors are ever unlocked, there should be a last false date.

Regardless, the condition Set Home Away is true so the action should have executed on 1/14 when it became true. I would suggest turning on repeats for the Set Home Mode To Away action, so when the condition changes to false and then back to true, it executes again.

Otherwise I do not see why it would not work.

Vera 3, 1.7.1030, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb

Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #12 on: January 14, 2018, 04:17:13 pm »
You may be on to something. From what I can see, the last time any of the locks triggers we true were was 1/9. And none were false. If doors are ever unlocked, there should be a last false date.

Regardless, the condition Set Home Away is true so the action should have executed on 1/14 when it became true. I would suggest turning on repeats for the Set Home Mode To Away action, so when the condition changes to false and then back to true, it executes again.

Otherwise I do not see why it would not work.
so infinite repeats?

Sent from my SM-G930P using Tapatalk


Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #13 on: January 14, 2018, 05:08:23 pm »
Quote
Subject:Notification
The Lock button was pressed on Back Door Lock in room Garage at 2018-01-14 14:03:52.

I am getting notifications of door lock status but no change in the house mode and the status.log still shows 1/9 as the last time this, or any, door was locked.

Sent from my SM-G930P using Tapatalk


Offline Sammy2

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +4/-4
Re: Please Take a Critical Look at my Logic.
« Reply #14 on: January 14, 2018, 05:11:28 pm »
BTW, I'm wondering if I should use a Device Status instead of Trigger for the locks?

Also, are the repeats done under "Counters" and how?

TIA again.