PLEG and house modes - using timestamp of modechange

Hi All,

I have been searching the forum for some time but did not find a specific answer to my question. I hope you can help.
I have a VeraEdge and have been using PLEG for some time, it is great. I have been using the House Modes Plugin to set triggers for moving to a specific house mode, eg. going Home or going Away.

What I have recently found is that these triggers behave exactly the same as the built in house modes - they are True until I am in a specific mode and become False when I leave the specific mode. So there is no value in using the House Mode Plugin in PLEG as I see. My issue is that in this case my condition will become True even if there is no house mode change but another trigger becomes True.

As an example, I have a condition to turn on the lights when I move to Home mode and it is dark outside (based on sunset/sunrise). This will become true in two cases:

  • It is dark outside and I move to Home (this is what I want)
  • I am home and it becomes dark outside (I don’t want this to become true)

What would be the best way to have a house mode trigger that is False, moves to True for a short time when there is a change and back to False? Should I look at the timestamp of the last True?

Related question: how do I differentiate between the FROM states of the house mode changes? Eg. have different behaviour if I move from Night to Home and Away to Home? My trial again is to use a timestamp like this:

((#Now - #!m3Night) > 50)

My assumption is that this would become True if I am NOT coming from Night mode. Probably not the best way and does not seem to work for me. (m3Night is the house mode Night in PLEG)

I’d be grateful for any ideas here. Thanks!

Now that I started to think about it and investigate more, I have found that my timestamp between the evaluation of the condition and the moving out of night mode has been more than 50 seconds, it was about 90. So now I have changed the limit to 200 seconds. Still I’d like to understand if this is an efficient way of checking which mode I am coming from and to evaluate if I had a mode change or just was in a house mode. Thanks.