defining primary trigger vs existing conditions

Hi,

Just getting into PLEG and have a question

How do I define a primary trigger vs existing conditions?

What I’m trying to do is, have the lights go on 30% when I pause a movie, but only if the lights were off to begin with

I have the XBMCState plugin showing the paused state whenever playback is paused, so that part is easy.

For simplicity let’s consider one light.

If I create a condition that goes

XBMCState_Pause and Light_Off

It fires the action when the light is off and when I pause the movie, that’s great. However it would also fire the action if I turn the light off while the movie is paused.

How do I go about setting the XBMC Pause state as the primary trigger, and the light as just an existing condition so that the action is fired only when the XBMC pause state changes?

Thanks

[quote=“aptalca, post:1, topic:186823”]Hi,

Just getting into PLEG and have a question

How do I define a primary trigger vs existing conditions?

What I’m trying to do is, have the lights go on 30% when I pause a movie, but only if the lights were off to begin with

I have the XBMCState plugin showing the paused state whenever playback is paused, so that part is easy.

For simplicity let’s consider one light.

If I create a condition that goes

XBMCState_Pause and Light_Off

It fires the action when the light is off and when I pause the movie, that’s great. However it would also fire the action if I turn the light off while the movie is paused.

How do I go about setting the XBMC Pause state as the primary trigger, and the light as just an existing condition so that the action is fired only when the XBMC pause state changes?

Thanks[/quote]

You need to use an order.

XBMCState_Pause and Light_Off and (Light_Off; XBMCState_Pause)

So only if it’s light was off before it was paused.

EDIT: have you read “PLEG BASICS” Pdf?
http://forum.micasaverde.com/index.php/topic,21603.0.html

Thanks so much

Yes, I was reading that but it is a lot of info and takes a while to digest :slight_smile:

I did see the ordered vs unordered section but wasn’t sure it would work. Thanks for the confirmation. I now understand the timestamps.

So if I incorporate multiple lights I would build it the following way, is that correct?

XBMCState_Pause and Light1_Off and Light2_Off and ((Light1_Off, Light2_Off); XBMCState_Pause))

Thanks

[quote=“aptalca, post:3, topic:186823”]Thanks so much

Yes, I was reading that but it is a lot of info and takes a while to digest :slight_smile:

I did see the ordered vs unordered section but wasn’t sure it would work. Thanks for the confirmation. I now understand the timestamps.

So if I incorporate multiple lights I would build it the following way, is that correct?

XBMCState_Pause and Light1_Off and Light2_Off and ((Light1_Off, Light2_Off); XBMCState_Pause))

Thanks[/quote]

I don’t think you can group two timestamps then say before. I’m no expert but I would say that wont work.
You probley have to do it like this.

XBMCState_Pause and Light1_Off and Light2_Off and (Light1_Off; XBMCState_Pause) and (Light2_Off; XBMCState_Pause)

Great,

I did it as you suggested but with 4 lights plus the night time trigger and it works like a charm.

Thanks, so much

I don't think you can group two timestamps then say before. I'm no expert but I would say that wont work.

You are right. Sequence expressions operate on Timestamps. Inputs and Conditions have a timestamp.
An expression does not have a timestamp, so it can’t be grouped as an argument to a condition expression.