All Downloads are FREE. Search and download functionalities are using the official Maven repository.

data.nodescript.lighteffects.TrafficLightsSingle.nodescript Maven / Gradle / Ivy

## Dieses Script erstellt ein Accessory und Macros um eine einzelne Verkehrsampel mit Lichports zu steuern.
##  
## history: 2020-09-17 A. Kuhtz, erste Version, based on script from Yann
##
##
## -------------- 1. Select Target
##application(text:de="Verkehrsampel (rot, grün, orange)")
##application(text:en="Traffic lights (red, green, orange)")
##application(text:nl="Verkeerslichten (rood, groen, oranje)")
##instruction(text:de="Konfiguration von Lichtausgängen für die Steuerung einer einzelnen Verkehrsampel")
##instruction(text:en="Configuration of lightports for single traffic lights")
##instruction(text:nl="Configuratie van lichtuitgangen voor het aansturen van een single verkeerslicht")
##
##input($AccessoryName:string, text:de="Name des Accessory", text:en="Name of the Accessory", text:nl="Naam van het accessoire", default="Verkehrsampel 1")
##input($selectedAccessory:accessory, text:de="Nummer des verwendeten Accessory", text:en="Number of the used Accessory", text:nl="Nummer van het gebruikte accessoire", default=0)
##input($MacroNumber:macro, text:de="Nummer des ersten Macros (Total: 5)", text:en="Number of the first macro (total: 5)", text:nl="Nummer van de eerste macro (totaal: 5)", default=0)
##input($LightPortBaseNumber:light, text:de="Nummer des ersten Lichtausgang (Total: 3)", text:en="Number of the first light port (total: 3)", text:nl="Nummer van de eerste lichtport (totaal: 3)", default=0)
##input($LightPortPrefix:string, text:de="Prefix des Lichtausgang: ", text:en="Prefix of the lightport: ", tooltip:de="Namensprefix für die Lichtport eingeben. Dieser Prefix wird für alle Lichtports verwendet.", tooltip:en="Nameprefix of the lightports. This Prefix is used for all lightports.", tooltip:nl="Voer het voorvoegsel van de naam in voor de lichtpoort. Dit voorvoegsel wordt gebruikt voor alle lichtpoorten.", default="Ampel 1")

##Enabled for LightControl, LED-IO-24 and NeoControl from Opendcc
##require(vid="13", pid="107,126,127,205,206")

### -------------- 2. configure variables 
#set($macroCount = 5)
#set($macroNumber0 = $MacroNumber)
#set($macroNumber1 = $MacroNumber + 1)
#set($macroNumber2 = $MacroNumber + 2)
#set($macroNumber3 = $MacroNumber + 3)
#set($macroNumber4 = $MacroNumber + 4)
#set($lightPortNumber0 = $LightPortBaseNumber)
#set($lightPortNumber1 = $LightPortBaseNumber + 1)
#set($lightPortNumber2 = $LightPortBaseNumber + 2)

### -------------- 3. execute part of the script

### Set label of Accessories
set accessory ${selectedAccessory} name="${AccessoryName}"

### Set label of Macro
set macro ${macroNumber0} name="${LightPortPrefix} rot"
set macro ${macroNumber1} name="${LightPortPrefix} gruen"
set macro ${macroNumber2} name="${LightPortPrefix} orange"
set macro ${macroNumber3} name="${LightPortPrefix} rot+orange"
set macro ${macroNumber4} name="${LightPortPrefix} blinken"

### Set label of lightPorts
set light ${lightPortNumber0} name="${LightPortPrefix} rot"
set light ${lightPortNumber1} name="${LightPortPrefix} orange"
set light ${lightPortNumber2} name="${LightPortPrefix} gruen"

### Set label of aspect
set aspect 0 accessory=${selectedAccessory} name="${AccessoryName}_rot"
set aspect 1 accessory=${selectedAccessory} name="${AccessoryName}_gruen"
set aspect 2 accessory=${selectedAccessory} name="${AccessoryName}_orange"
set aspect 3 accessory=${selectedAccessory} name="${AccessoryName}_rot+orange"
set aspect 4 accessory=${selectedAccessory} name="${AccessoryName}_blinken"

################################################
### configure macro
###

### macro rot ###
select macro ${macroNumber0}

wait 30

config macro repeat=1 slowdown=1

## stop the blink macro
add step ptype=macro action=stop number=${macroNumber4}

add step ptype=light action=off number=$lightPortNumber1
add step ptype=light action=off number=$lightPortNumber2
add step ptype=light action=on number=$lightPortNumber0

wait 50

### macro gruen ###
select macro ${macroNumber1}

wait 30

config macro repeat=1 slowdown=1

## stop the blink macro
add step ptype=macro action=stop number=${macroNumber4}

add step ptype=light action=off number=$lightPortNumber1
add step ptype=light action=off number=$lightPortNumber0
add step ptype=light action=on number=$lightPortNumber2

wait 50

### macro orange ###
select macro ${macroNumber2}

wait 30

config macro repeat=1 slowdown=1

## stop the blink macro
add step ptype=macro action=stop number=${macroNumber4}

add step ptype=light action=off number=$lightPortNumber2
add step ptype=light action=off number=$lightPortNumber0
add step ptype=light action=on number=$lightPortNumber1

wait 50

### macro rot+orange ###
select macro ${macroNumber3}

wait 30

config macro repeat=1 slowdown=1

## stop the blink macro
add step ptype=macro action=stop number=${macroNumber4}

add step ptype=light action=off number=$lightPortNumber2
add step ptype=light action=on number=$lightPortNumber0
add step ptype=light action=on number=$lightPortNumber1

wait 50

### macro blinken ###
select macro ${macroNumber4}

wait 30

## let this macro run endless until stopped
config macro repeat=0 slowdown=1

## stop the power on macro
## add step ptype=macro action=stop number=${powerOnMacroNumber}

add step ptype=light action=off number=$lightPortNumber0
add step ptype=light action=off number=$lightPortNumber2
add step ptype=light action=on number=$lightPortNumber1
add step ptype=delay delay=50
add step ptype=light action=off number=$lightPortNumber1
add step ptype=delay delay=50

wait 50


################################################
### Define Accessory
###

select accessory ${selectedAccessory}

## make the blink aspect active after power up
config accessory startup aspect=4

#set($maxMacroIndex = $macroCount - 1)
#foreach ($currentMacroIndex in [0..$maxMacroIndex])

#set($currentMacroNum = $currentMacroIndex + $MacroNumber)

add aspect $currentMacroIndex macronumber=$currentMacroNum
#end






© 2015 - 2024 Weber Informatics LLC | Privacy Policy