-- program: LeoLamp
-- set brighness level for CREED lamps
-- V1.0
-- Karl Wachs
-- June 19, 2013
--
--
-- how to use
-- set variable "lamp"Command to UP or anythinge else, if UP brighten otherwise dim
-- variable "Lamp"Level is set to new current level of brightnet of lamp
-- set variable "Lamp"Debug is used to decied if log should be written
--- set LAMP to name of device to be dimmed/brightened
--
global debug
set debug to false -- if true add logfile entries add info to indigo logfile
set initialize to 0
set action to "UP"
set Lamp to "LeoCeilingLight"
global Lamp
on toLog(xxx) -- must be called outside "tell application indigioserver" … otherwise it does an end tell
global debug
if debug then
tell application "IndigoServer"
log Lamp & " " & xxx
end tell
end if
end toLog
toLog("starting v 1.0")
-- get parameters from indigo, check if everythings is setup properly, if not try to correct
try
tell application "IndigoServer"
set LL to Lamp & "Debug"
set debug to (get value of variable LL) as boolean
set LL to Lamp & "Command"
set action to (get value of variable LL) as text
set LL to Lamp & "Level"
set Lev to (get value of variable LL) as number
end tell
on error
set initialize to 1 -- to be done
return -1
end try
toLog(action)
toLog(Lev)
-- all setup for nornal operations
----------------
---------------- end initializing
----------------
-- now run through the different commands and brightness levels
-- levels used: : 6 10 15 25 50 100
if action = "UP" then ----- other wise down +++++++++++++++++++++++++++++++++++++++++
set NewLevel to 100
if Lev < 5 then
set NewLevel to 6
else
if Lev < 7 then
set NewLevel to 10
else
if Lev < 11 then
set NewLevel to 15
else
if Lev < 16 then
set NewLevel to 25
else
if Lev < 26 then
set NewLevel to 50
else
if Lev < 51 then
set NewLevel to 100
end if
end if
end if
end if
end if
end if
if Lev = NewLevel then
else
tell application "IndigoServer"
brighten Lamp to NewLevel
set value of variable LL to NewLevel
end tell
end if
else
set NewLevel to 0
if Lev > 99 then
set NewLevel to 50
else
if Lev > 49 then
set NewLevel to 25
else
if Lev > 24 then
set NewLevel to 15
else
if Lev > 14 then
set NewLevel to 10
else
if Lev > 9 then
set NewLevel to 6
else
if Lev > 5 then
set NewLevel to 0
end if
end if
end if
end if
end if
end if
if Lev = NewLevel then
else
tell application "IndigoServer"
dim Lamp to NewLevel
set value of variable LL to NewLevel
end tell
end if
end if
kennybroh wrote:Matt or Jay-- does the Cree dim to the same or close to the same low level as an incandescent? The lowest level for my other LEDs is much brighter.
Users browsing this forum: No registered users and 1 guest