Using PLEG to sync light levels across different circuits in kitchen

I like the spraying air and load noise approach myself.

I installed a Moen Motionsense faucet in our kitchen remodel. It’s funny when the cat goes near the sink ;D

Bringing the conversation back from the diversion, I have now tested from home.
I can see that when I change the Kitchen lights from the switch, the change in power shows almost instantly in the UI, but nothing happens to the 2 counter circuits. If I open Grasshopper on my phone and open the kitchen light adjustment, it triggers Vera to see the state of the light and the counter lights dim. Seems like I need to detect the state change in the kitchen light state.

Roger

it sounds like your Kitchen light switch is not capable of instant status.

because it requires a poll, vera doesn’t know it has switched until it polls the switch. that may take a while.

Your app works because Vera is immediately aware of the change to Kitchen light, because it instructed it to do that.

So, I would recommend that you shelve the project or upgrade the switch.

But what about this" I can see that when I change the Kitchen lights from the switch, the change in power shows almost instantly in the UI"

Attach your status report … after changing a switch AT the switch.

Indicate which switch you change and what you expected … I will be happy to review it.
I have not read the details of this entire thread.

I prefer to review the details outside the forum format.

Here is the report and the status files. Jest of the automation is that if I change the Kitchen dimmer level the 2 counter curcuits should dim. If afterwards I change the counter level nothing should happen. Works within the UI but not when I manually change the dimmer level of the Kitchen switch.

Thanks,
Roger

You have feedback … probably because the dimmers do not change in one step but via a ramp.
Not sure if LoadLevelTargets are reported instantly.

Change the device properties to LoadLevelStatus.
Remove the repeat.

Thanks for your help. That was the solution.

Roger

A programming question related to this script.
I am using this to set the dimmer to the of the right under cabinet lights

Right Counter SetLoadLevelTarget newLoadlevelTarget={(KitchenDim)}

Does PLEG read the load level target as a numeric value and can I perform numeric operations against the {(KitchenDim)} value such as multiplying it by .9 for example? If so can you suggest the formatting?

Thanks,
Roger

you can instruct the change with Lua by adding code in the Luup tab in the action corresponding with the condition

assuming your counter dimmer is device no. 99:

– gets KitchenDim level and instructs counter dimmer to be set at 90percent of KitchenDim
local kitchdimlvl = math.floor(KITCHENDIM.state * 0.9) –sorry, forgot to round the returned math.
luup.call_action(“urn:upnp-org:serviceId:Dimming1”,“SetLoadLevelTarget”,{ newLoadlevelTarget=kitchdimlvl },99)

Note to verify your service ID by hovering over the LoadLevelTarget variable in the advanced settings for the device.

Don’t forget to remove the other action in the advanced tab corresponding with the counter dimmer