Floorplan Scripts5

From XAP Automation
Revision as of 13:14, 16 October 2006 by Lehane (Talk | contribs)

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

This is based upon Scripts4 but ramps the lights up. It is linked to the Squeezebox xPL device and relies upon a global flag to indicate whether we are in 'night' mode which is set by a Timer in xAP Florplan.

Sub Main()

'----xAP Name of device(s) to ramp (you may be able to use wildcards)
DeviceName1="mmwave.dmx512.g8kmh_hapc1:House.Upperfloor.Bedroom1.Ceiling.Window"
DeviceName2="mmwave.dmx512.g8kmh_hapc1:House.Upperfloor.Bedroom1.Ceiling.Main"
'----Number of steps
RampFinished=50
'----Delay Between Steps in seconds
Delay=10
'----Settings for start level and final levels
RampLevelStart=5
RampLevelMax=55



'----Check Squeezebox is on and we aren't in daylight
Power=xap.getfromraw(rawmessage, "stat.basic,power")
if ((GetGlobal("DuskDawnState") <> "night") OR (Power="0")) then exit sub

'----If either device is on then exit, as there is no point in ramping (up early?)
x=xap.getstate(DeviceName1)
y=xap.getstate(DeviceName2)

if ((x="on") OR (y="on")) then exit sub

'Turn on at minimum level
xap.sendbsc DeviceName1,"on",RampLevelStart & "%", ""
xap.sendbsc DeviceName2,"on",RampLevelStart & "%", ""