View Full Version : Check variable status when first loading ccf?

June 14th, 2010, 02:37 AM

I have a bunch of variables that I use for light status indicators in NR for Clipsal C-Bus lights. For example, a light icon has the default state icon as on, and then a second state that shows an 'off' icon when the Girder variable is '0' (meaning the light is off) - e.g. CBUS.SCP.Level[254/56/4] = 0

In my NR Lua I have a variable watch set out like the following:

function OnCCFLoad()
NetRemote.RegisterVariableWatch('CBUS.SCP.Level[254/56/0]', NetRemote.GetPlugin('Girder')) ;
NetRemote.RegisterVariableWatch('CBUS.SCP.Level[254/56/1]', NetRemote.GetPlugin('Girder')) ;
NetRemote.RegisterVariableWatch('CBUS.SCP.Level[254/56/2]', NetRemote.GetPlugin('Girder')) ;
NetRemote.RegisterVariableWatch('CBUS.SCP.Level[254/56/3]', NetRemote.GetPlugin('Girder')) ;
NetRemote.RegisterVariableWatch('CBUS.SCP.Level[254/56/4]', NetRemote.GetPlugin('Girder')) ; etc etc

The main issue being is that the light indicators quite often show on when a light is off (normally when NR is first opened) up until the point that a light level is changed (and I assume the variable is changed/checked). What I was hoping for was a way to force NR to check actual variable values on ccf load to see if that fixes up the issue?

Hope this makes sense and thanks in advance for any suggestions.


Rob H
June 14th, 2010, 07:32 AM
The issue is really to make sure that Girder sends the variables to NR when NR connects

June 14th, 2010, 07:54 AM
Wouldn't that be the case with the RegisterVariableWatch commands? Or do I need to sort something else out on the Girder side to ensure the variables are 'pushed' to the client rather than 'pulled'?


Rob H
June 14th, 2010, 08:36 AM
No, RegisterVariableWatch works the other way, ie an event is sent to Girder whenever the NR variable changes.

June 17th, 2010, 03:47 AM
Ok, thanks Rob.

What is the easiest way to send these variables all to NR when the client first logs in if it is to be a push rather than pull?

Rob H
June 17th, 2010, 04:55 AM
Well, if you had a DeviceManager provider that should do it automatically.

How do you currently send the values to NR? Using NetRemote.SetVariable or NetRemote.ClientSetVariable? The first of these should also do it automatically unless something is going badly wrong.

June 18th, 2010, 11:00 PM
Hi Rob,

I'm a bit confused by it all to be honest (and probably explains why it doesn't behave exactly as planned). Basically I have sliders in the format (for example):


Which matches up with my RegisterVariableWatch in NR to basically send the slider value through to Girder (I'm assuming this is how it works - someone here helped me out with it ages ago and I must admit I never really fully understood it - it just worked well enough for me to continue).

NetRemote.RegisterVariableWatch('CBUS.SCP.Level[254/56/0]', NetRemote.GetPlugin('Girder')) ;

Hope this makes sense?

Rob H
June 23rd, 2010, 03:47 AM
I'm not familiar with the CBUS plugin that you're using I'm afraid so I'm not sure whether it uses the DM - if it does then it should be updating the values automatically.

RegisterVariableWatch only affects the NetRemote to Girder transmission path, not vice versa.