Accessing state of input variable in lua

Hi,

I’m looking to calculate the setpoint value of a dimmer switch based on the value of two other switches. I’m trying to do something like this for the action:

cKitchenLightOffSet No (pCornerLightLevel>20 or pKitchenLightLevel>20) and pTableLightLevel==0

Kitchen Table SetLoadLevelTarget newLoadlevelTarget={(PKITCHENLIGHTLEVEL.state)}

pCornerLightLevel Corner Light LoadLevelStatus
pKitchenLightLevel Kitchen Lights LoadLevelStatus
pTableLightLevel Corner Light LoadLevelStatus

But it just sets the device to the string value “{(PKITCHENLIGHTLEVEL.state)}” rather than the state variable. Any ideas?

You are mixing up LUA access and the template access of of Inputs in the Advanced Tab of Actions.

You just want:
{(InputOrConditionVariableNameOrExpression)}

I could’ve sworn I tried that first…anyway, it is working now!

Thanks

---------This problem was solved by checking ‘repeats’------------
So now that that works, I’ve reached another problem. I assume that changing of a device property doesn’t trigger a condition. Is there a way to run the condition every time any of the device properties in the condition change? Not only if the light is turned on/off but if the dim level changes.

E.g. Evaluate this following condition if either pCornerLightLevel, pKitchenLightLevel or pTableLightLevel are changed and satisfy the logic

cKitchenLightOffSet No (pCornerLightLevel>20 or pKitchenLightLevel>20) and pTableLightLevel==0

And in the same example, I’m also looking to only run the condition if the light levels were all related to each other as such:
(pTableLightLevel-(pCornerLightLevel+pKitchenLightLevel)/2)==0

But I need a way to call up the value of pCornerLightLevel or pKitchenLightLevel BEFORE the value was changed to trigger the condition (as after it has changed this condition will no longer be true)

I assume that changing of a device property doesn't trigger a condition.

You assume wrong.
PLEG conditions are evaluated when ANY input (Triggers, Device Properties, or Schedules) fire/change value.

[quote=“RichardTSchaefer, post:5, topic:182108”]

I assume that changing of a device property doesn’t trigger a condition.

You assume wrong.
PLEG conditions are evaluated when ANY input (Triggers, Device Properties, or Schedules) fire/change value.[/quote]

I’m confused what the difference between ‘repeats’ and no ‘repeats’ is. I thought the condition is evaluated for any change only if ‘repeats’ is checked - otherwise it will only fire if the value was FALSE and becomes TRUE (not is TRUE and remains TRUE while one input changed); this is what I pulled out of the manual:

A normal Condition will fire when the value of its expression changes from false (0) to true (not 0). If a Condition?s Repeats check-box is checked, it will fire every time the value of its expression

Sorry if I’m missing something obvious…