my first program, how do i use it?

I want to use this plugin to make my scenes more programmable but i simply do not get it how it works.

Maybe somene could explain to me how to set this, i maybe see then the logic of it and can go from there.

What i want to achieve is the following:

I want that my lights and thermostat are turned on only when it is dark (night) and when someone is at home.

I have a motion sensor build in my foscam camera which can detects motion, i allready got the sensor to work in a normal scene as trigger.

My question is if the following is possible and how to set this?
How do i use this plugin to set it up that some lights are turned on DIMMED (20%)(others left off), the thermostat set to ‘comfort’ mode about a half hour BEFORE sunset.
On sunset the light should be scalled up to around 50% or turned on.
This should only be done when motion is detected.

After sunset (when lights are on ) the lights should be dimmed again when for at least 1 hour no motion is detected anymore.

Later i want to refine this more, i want that the thermostat is only switched on when the outside temp is <> as ? etc

Who can advise if this can be done and how to do this?

Have you seen PLEG Basics?

yep but it is complete chinese for me…
Tried it but can’t get the logic of it…