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

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

## Script only for NeoControl EWS!
## This script defines a group of colors for day/night change with several light ports
## Mode: Smooth color transition
##
## Hardware: Neocontrol with NeoControl EWS firmware
## Software:
##
## history: 2019-12-13 V.Dierkes, first version
##          2020-04-07 V.Dierkes, Fix size of 20 instead of ${node_accessory_count} for accessory CV area
##
## how to use:
## A) configure
##    Not needed
## B) load and run this script
##    what will happen?
##    1. the led group will be configured with the given parameters
## C) have fun
##    Switching on/off the SPORT will control the group of light elements accordingly
##

## Makro 0 (Tag)
## Gruppe 0,3,6,... einschalten
## Lichtausgang einschalten
##
## Makro 1 (Tag => Nacht)
## Gruppe 1 ausschalten
## Lichtausgang 1 einschalten
## Warte 10: Gruppe 4 ausschalten
## Lichtausgang 2 einschalten
## ...
## Warte 240-x: Gruppe 2 ausschalten
## Warte 10: Gruppe 5 ausschalten
## ...
## Warte bis zum Ende der letzten Gruppe
##
## Makro 2 (Nacht => Tag)
## Gruppe 2 einschalten
## Lichtausgang 1 einschalten
## Warte 10: Gruppe 5 einschalten
## Lichtausgang 2 einschalten
## ...
## Warte 240-x: Gruppe 1 einschalten
## Warte 10: Gruppe 4 einschalten
## ...
## Warte bis zum Ende der letzten Gruppe

##
## Makro 3 (stop all)
## Lichtausgang 1 ausschalten
## Lichtausgang 2 ausschalten
## Makro 0 anhalten
## Makro 1 anhalten
## Makro 2 anhalten

## Lichtausgänge
## DynFarbe
## Helligkeit Aus 0
## Helligkeit An 255
## Dimmzeit An 255
## Dimmzeit Aus 255

## Gruppe 0 (auf weiß schalten)
## Modus 64
## Erste Farbe: LetzteFarbe (Tag)
## Letzte Farbe: LetzteFarbe (Tag)
## Zeit: 0
## Option: DynFarbe, ohne Schwarz
##
## Gruppe 1 (von blau über rot auf weiß in Schritten von 30s)
## Modus 65
## Erste Farbe: ErsteFarbe
## Letzte Farbe: LetzteFarbe
## Zeit: 209
## Option: DynFarbe, ohne Schwarz
##
## Gruppe 2 (von schwarz auf blau in 60s)
## Modus 65
## Erste Farbe: ErsteFarbe
## Letzte Farbe: ErsteFarbe
## Zeit: 215
## Option: DynFarbe, Anfang Schwarz
##
## Gruppe 2..n wie oben, aber mit DynFarbe+1

## Accessories
## 0 = keine Accessories
## 1 = 1 Accessory (4 Begriffe)
## 2 = 2 Accessories mit je 2 Begriffen (An/Aus)

##require(vid="13", pid="129")

##application(text:de="NeoEWS: Konfiguration für Tag/Nacht Ablauf", text:en="NeoEWS: Configuration for Day/Night sequence")
##instruction(text:de="Es wird ein Tag/Nacht-Ablauf erstellt der mit einem Accessory mit 4 Begriffen bzw. mit 2 Accessories mit je 2 Begriffen angesteuert werden kann. Als Default-Farben werden Schwarz (unveränderbar), reines Blau (Farbe +0), reines Rot (Farbe +1) und absolutes Weiß (Farbe +2) verwendet. Diese können nachträglich angepasst werden. Zeiten sind über Delays in den Makros und die Gruppeneffekte definiert.
Es können n=1..5 Lightports verwendet werden, die, um einen örtlichen Verlauf zu erhalten, zeitlich nacheinander angesteuert werden.
Verwendete Ressourcen:
n*3 Lichtgruppen, n Lichtausgänge, 4 Makros, 0-2 Accessories, 3 Farben, n Dynamische Farben") ##instruction(text:en="A Day/Night sequence will be created with one accessory with 4 aspects respective 2 accessories with 2 aspects each. The default colors are black (not changeable), pure blue (color +0), pure red (color +1) and pure white (+2). Those can be adapted afterwards. The timing is controlled via delays in the macros and the group effects.
n=1..5 light ports are used which provides a location course by having a time delay between the light ports.
Used ressources:
n*3 light groups, n light outputs, 4 macros, 0-2 accessories, 3 colors, n dynamic colors") ## ##input($my_group:switch, text:de="Nummer der ersten Lichtgruppe
| Es werden 3 mal soviele Lichtgruppen wie Lightports benötigt", text:en="Number of the first light group
| 3 times of the light ports will be needed for the light groups", default=0) ##input($color_w_flag:boolean, text:de="Verwende RGBW Modus", text:en="Use RGBW mode", default=0) ##input($start_color:int, text:de="Nummer der ersten von 3 Farben der Gruppe (0-29)", text:en="Number of the first of 3 colors of the group (0-29)", default=0) ##input($group_dyn_color:int, text:de="Nummer der ersten dynamischen Farbe (32-...)
| Pro Lightport eine dynamische Farbe", text:en="Number of the first dynamic color (32-...)
| One dynamic color per light port", default=32) ##input($my_light:light, text:de="Nummer des Lightports (0-...)", text:en="Number of the light port (0-...)", default=0) ##input($my_light_num:int, text:de="Anzahl der Lightports (n=1-5)
| Vervielfacht die benötigten Lichtgruppen!", text:en="Quantity of light ports (n=1-5)
| Multiplies the needed light groups!", default=1) ##input($led_tabval1:int, text:de="Stripe-Pos der ersten LED
| Zusätzliche Lightports folgen", text:en="Stripe position of the first LED
| Additional light ports are following", default=0) ##input($my_macro:macro, text:de="Nummer des ersten von 4 Makros (0-36)", text:en="Number of the first of 4 Macro (0-36)", default=0) ##input($my_acc_num:int, text:de="Anzahl der Accessories (0-2)
| 0=Keines, 1=1 Acc mit 4 Begriffen, 2=2 Acc mit je 2 Begriffen", text:en="Quantity of accessories (0-2)
| 0=None, 1=1 Acc with 4 aspects, 2=2 Acc with 2 aspects each", default=0) ##input($my_acc:accessory, text:de="Nummer des ersten Accessories (0-18/19)", text:en="Number of the first accessory (0-18/19)", default=0) ## -------------- 1. Select Target #if((${vid} == 13) && (${pid} == 129)) ## Only for Neo_EWS #set($delay_between_LP = 10) #set($Integer = 0) #set($version_major = 0) #set($version_sub = 0) #set($version_run = 0) #set($version_string="${node_firmware_version}") #set($version_array = $version_string.split("\.")) #if($version_array.size() == 3) #set($version_major = $Integer.parseInt($version_array[0])) #set($version_sub = $Integer.parseInt($version_array[1])) #set($version_run = $Integer.parseInt($version_array[2])) #end #if($version_major < 0) $exceptionThrower.throwUserDefined("Für dieses Script ist mindestens die Version 2.0.0 der NeoEWS notwendig!

For this script the version 2.0.0 of the NeoEWS is needed!") #else ## Version check is OK, proceed ## -------------- 2. Define default values #set($macro_delay_factor = 50) #set($group_mode = 65) #set($group_onoff = 0) #set($group_speed_factor1 = 0) #set($group_speed_factor2 = 209) #set($group_speed_factor3 = 215) #set($group_endless = false) #set($Integer = 0) #set($cv_base_lights = 81) #set($cv_base_accessory = $cv_base_lights + ( 5 * ${node_light_count}) ) ## Fix size of 20 instead of ${node_accessory_count} for accessory CV area #set($cv_base_colors = $cv_base_accessory + ( 10 * 20) ) #set($cv_base_groups = $cv_base_colors + ( 3 * 32 ) ) #set($cv_base_mapping = $cv_base_groups + ( 6 * 16 ) ) #set($cv_base_config = $cv_base_mapping + ( 1 * 256 ) ) #set($cv_base_acc_cfg = $cv_base_config + ( 6 ) ) #set($group_color_size = 3) ## -------------- 3. execute part of the script #set($last_color = $start_color + $group_color_size - 1) #if( ($my_group>=0) && ($my_group <= 16 - (3 * $my_light_num) ) ) #if( ($last_color >= $start_color) && ($last_color <= 31) ) #if( ($group_dyn_color >= 32) && ($group_dyn_color <= 48 - $my_light_num) ) #if( ($my_macro >= 0) && ($my_macro <= 36) ) #if( ($my_light + $my_light_num <= 81) ) #if( (($my_acc_num >= 0) && ($my_acc_num <= 2)) && ($my_acc + $my_acc_num <= 20) ) ## do it only in case the group number is in the allowed range ## do it only in case the start and last leds are in the allowed range ## do some naming stuff #set($temp = $my_group) #set($temp_col = $group_dyn_color) #set($bis = $my_light + $my_light_num - 1) #foreach ( $loop_lightport in [$my_light .. $bis] ) set switch $temp name="DayNight_Grp${my_group}_LP${loop_lightport}_Day" #set($temp = $temp + 1) set switch $temp name="DayNight_Grp${my_group}_LP${loop_lightport}_Dark2Day" #set($temp = $temp + 1) set switch $temp name="DayNight_Grp${my_group}_LP${loop_lightport}_Night2Dark" #set($temp = $temp + 1) set light $loop_lightport name="DayNight_Grp${my_group}_LP${loop_lightport}_Col${temp_col}" #set($temp_col = $temp_col + 1) #end set macro $my_macro name="DayNight_Grp${my_group}_Day (On)" #set($temp = $my_macro + 1) set macro $temp name="DayNight_Grp${my_group}_Day/Night" #set($temp = $my_macro + 2) set macro $temp name="DayNight_Grp${my_group}_Night/Day" #set($temp = $my_macro + 3) set macro $temp name="DayNight_Grp${my_group}_Night (Off)" #if ($my_acc_num > 0) ## accessory should be set #if ($my_acc_num == 2) set accessory $my_acc name="DayNight_Grp${my_group}_Acc0" set aspect 0 accessory=$my_acc name="Night/Day" set aspect 1 accessory=$my_acc name="Day/Night" #set($temp = $my_acc + 1) set accessory $temp name="DayNight_Grp${my_group}_Acc1" set aspect 0 accessory=$temp name="Day (On)" set aspect 1 accessory=$temp name="Night (Off)" #else set accessory $my_acc name="DayNight_Grp${my_group}" set aspect 0 accessory=$my_acc name="Day (On)" set aspect 1 accessory=$my_acc name="Day/Night" set aspect 2 accessory=$my_acc name="Night/Day" set aspect 3 accessory=$my_acc name="Night (Off)" #end #end ## Set mode ## Set endless mode in group value #if ($group_endless) #set($group_mode = $group_mode + 128) #end ## Set option value #set($group_option1 = ${group_dyn_color} - 32) #set($group_option2 = ${group_dyn_color} - 32) #set($group_option3 = ${group_dyn_color} - 32 + 16) ## --------------- 4. Write the data to the node #foreach ( $loop_lightport in [$my_light .. $bis] ) #set($cv_base = $cv_base_groups + 3 * 6 * ( $my_group + $loop_lightport - $my_light ) ) #set($cv_addr = $cv_base) # First group, day only set CV ${cv_addr} ${group_mode} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${last_color} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${last_color} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_speed_factor1} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_onoff} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_option1} #set($cv_addr = $cv_addr + 1) # Second group, from dark to day set CV ${cv_addr} ${group_mode} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${start_color} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${last_color} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_speed_factor2} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_onoff} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_option2} #set($cv_addr = $cv_addr + 1) # Third group, from night to dark set CV ${cv_addr} ${group_mode} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${start_color} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${start_color} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_speed_factor3} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_onoff} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_option3} #set($group_option1 = ${group_option1} + 1) #set($group_option2 = ${group_option2} + 1) #set($group_option3 = ${group_option3} + 1) ## LED configuration #set($cv_base = $cv_base_lights) #set($cv_addr = $cv_base + 5 * $loop_lightport) #set($temp = ${group_dyn_color} + ${loop_lightport} - ${my_light} ) set CV ${cv_addr} ${temp} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Stripe position #set($cv_base = $cv_base_mapping) #set($cv_addr = $cv_base + $led_tabval1 + $loop_lightport - $my_light) set CV ${cv_addr} ${loop_lightport} #end ## Set color values #set($cv_base = $cv_base_colors) #set($cv_addr = $cv_base + 3 * $start_color) ## First color blue set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 #set($cv_addr = $cv_addr + 1) ## Second color red set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) #if (${color_w_flag}) ## RGBW colors ## Third color white set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 ## now the white part #set($cv_base = $cv_base_mapping) #set($cv_addr = $cv_base + 224 + $start_color) ## First color blue set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) ## Second color red set CV ${cv_addr} 0 #set($cv_addr = $cv_addr + 1) ## Third color white set CV ${cv_addr} 255 #else ## RGB colors ## Third color white set CV ${cv_addr} 255 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 #set($cv_addr = $cv_addr + 1) #end ## Macro definitions ## Day mode select macro $my_macro config macro repeat=1 #set($temp = $my_group) #foreach ( $loop_lightport in [$my_light .. $bis] ) add step ptype=switch action=on number=$temp add step ptype=light action=on number=$loop_lightport #set($temp = $temp + 3) #end ## Day/Night mode #set($temp = $my_macro + 1) #set($delay = 0) select macro $temp config macro repeat=1 slowdown=$macro_delay_factor #set($temp = $my_group + 1) #foreach ( $loop_lightport in [$my_light .. $bis] ) add step delay=$delay ptype=switch action=off number=$temp add step ptype=light action=on number=$loop_lightport #set($temp = $temp + 3) #set($delay = $delay_between_LP) #end #set($temp = $my_group + 2) #set($delay = 240 - ( ( $my_light_num - 1 ) * $delay_between_LP ) ) #foreach ( $loop_lightport in [$my_light .. $bis] ) add step delay=$delay ptype=switch action=off number=$temp #set($delay=$delay_between_LP) #set($temp = $temp + 3) #end #set($temp = $temp - 3 + 8) add step ptype=input action=query0 number=$temp ## Night/Day mode #set($temp = $my_macro + 2) #set($delay = 0) select macro $temp config macro repeat=1 slowdown=$macro_delay_factor #set($temp = $my_group + 2) #foreach ( $loop_lightport in [$my_light .. $bis] ) add step delay=$delay ptype=switch action=on number=$temp add step ptype=light action=on number=$loop_lightport #set($temp = $temp + 3) #set($delay = $delay_between_LP) #end #set($temp = $my_group + 1) #set($delay = 240 - ( ( $my_light_num - 1 ) * $delay_between_LP ) ) #foreach ( $loop_lightport in [$my_light .. $bis] ) add step delay=$delay ptype=switch action=on number=$temp #set($delay=$delay_between_LP) #set($temp = $temp + 3) #end #set($temp = $temp - 3 + 8) add step ptype=input action=query0 number=$temp ## Night-Off mode #set($temp = $my_macro + 3) select macro $temp config macro repeat=1 #foreach ( $loop_lightport in [$my_light .. $bis] ) add step ptype=light action=off number=$loop_lightport #end add step ptype=macro action=stop number=$my_macro #set($temp = $my_macro + 1) add step ptype=macro action=stop number=$temp #set($temp = $my_macro + 2) add step ptype=macro action=stop number=$temp ## Accessory definition #if ($my_acc_num > 0) ## accessory should be set #if ($my_acc_num == 2) select accessory $my_acc #set($temp = $my_macro + 2) add aspect 0 macronumber=$temp #set($temp = $my_macro + 1) add aspect 1 macronumber=$temp #set($temp = $my_acc + 1) select accessory $temp add aspect 0 macronumber=$my_macro #set($temp = $my_macro + 3) add aspect 1 macronumber=$temp #else select accessory $my_acc add aspect 0 macronumber=$my_macro #set($temp = $my_macro + 1) add aspect 1 macronumber=$temp #set($temp = $my_macro + 2) add aspect 2 macronumber=$temp #set($temp = $my_macro + 3) add aspect 3 macronumber=$temp #end #end ## disable the next part for testing #if (0) ## begin of disable ## end of disable #end ## end of parameter check #else $exceptionThrower.throwUserDefined("Die Anzahl der Accessories (0-2) oder die Nummer des ersten Accessories ist außerhalb des erlaubten Bereichs!

The number of accessories (0-2) or the number of the first accessory is not in the allowed range!") #end #else $exceptionThrower.throwUserDefined("Das ausgewählte Makro ist außerhalb des erlaubten Bereichs (0-36)!

The selected macro is not in the allowed range (0-36)!") #end #else $exceptionThrower.throwUserDefined("Das ausgewählte Makro ist außerhalb des erlaubten Bereichs (0-36)!

The selected macro is not in the allowed range (0-36)!") #end #else $exceptionThrower.throwUserDefined("Die ausgewählte dynamische Farbe ist außerhalb des erlaubten Bereichs (32-47)!

The selected dynamic color is not in allowed range (32-47)!") #end #else $exceptionThrower.throwUserDefined("Die ausgwählte Farbe ist außerhalb des erlaubten Bereichs (0-29)!

The selected color is not in allowed range (0-29)!") #end #else $exceptionThrower.throwUserDefined("Die ausgewählte Lichtgruppe ist außerhalb des erlaubten Bereichs (0-13)!

The selected light group is not in allowed range (0-13)!") #end ## end of check for major version #end #end #######################################




© 2015 - 2024 Weber Informatics LLC | Privacy Policy