This commit is contained in:
brindosch 2017-04-16 15:25:18 +02:00
parent 203b04d7f4
commit afb26ab978
7 changed files with 134 additions and 187 deletions

View File

@ -597,8 +597,7 @@
"edt_eff_fade_header_title" : "Farbübergang",
"edt_eff_rainbowmood_header_title" : "Regenbogen",
"edt_eff_knightrider_header_title" : "Knight Rider",
"edt_eff_lightclock_header_title" : "Uhr 1",
"edt_eff_clock_header_title" : "Uhr 2",
"edt_eff_lightclock_header_title" : "Lichtuhr",
"edt_eff_pacman_header_title" : "Pac-Man",
"edt_eff_moodblobs_header_title" : "Stimmungskugeln",
"edt_eff_rainbowswirl_header_title" : "Regenbogenwirbel",
@ -661,11 +660,9 @@
"edt_eff_colorHour_title" : "Farbe Stunde",
"edt_eff_colorMinute_title" : "Farbe Minute",
"edt_eff_colorSecond_title" : "Farbe Sekunde",
"edt_eff_hourMargin_title" : "Länge Stunde",
"edt_eff_minuteMargin_title" : "Länge Minute",
"edt_eff_secondMargin_title" : "Länge Sekunde",
"edt_eff_margin_title" : "Abstand",
"edt_eff_colorMarker_title" : "Farbe Markierung",
"edt_eff_colorMarker_title" : "Markierung Farbe",
"edt_eff_markerDepth_title" : "Marker",
"edt_eff_backgroundColor_title" : "Hintergrundfarbe",
"edt_append_ns" : "ns",
"edt_append_ms" : "ms",
"edt_append_s" : "s",

View File

@ -59,7 +59,7 @@
"dashboard_newsbox_visitblog" : "Visit Hyperion-Blog",
"dashboard_newsbox_noconn" : "Can't connect to Hyperion Server to retrieve latest posts, does your internet connection work?",
"dashboard_newsbox_readmore" : "Read more",
"dashboard_alert_message_confedit_t" : "Configuration modified",
"dashboard_alert_message_confedit_t" : "Konfiguration geändert",
"dashboard_alert_message_confedit" : "Your Hyperion configuration has been modified. To apply it, restart Hyperion.",
"dashboard_alert_message_disabled_t" : "Hyperion disabled",
"dashboard_alert_message_disabled" : "Hyperion is currently disabled! To use it again, enable it at the dashboard.",
@ -598,8 +598,7 @@
"edt_eff_fade_header_title" : "Fade",
"edt_eff_rainbowmood_header_title" : "Rainbow Mood",
"edt_eff_knightrider_header_title" : "Knight Rider",
"edt_eff_lightclock_header_title" : "Clock 1",
"edt_eff_clock_header_title" : "Clock 2",
"edt_eff_lightclock_header_title" : "Light Clock",
"edt_eff_pacman_header_title" : "Pac-Man",
"edt_eff_moodblobs_header_title" : "Mood Blobs",
"edt_eff_rainbowswirl_header_title" : "Rainbow Swirl",
@ -662,11 +661,10 @@
"edt_eff_colorHour_title" : "Color hour",
"edt_eff_colorMinute_title" : "Color minute",
"edt_eff_colorSecond_title" : "Color second",
"edt_eff_hourMargin_title" : "Margin hour",
"edt_eff_minuteMargin_title" : "Margin minute",
"edt_eff_secondMargin_title" : "Margin second",
"edt_eff_margin_title" : "Margin",
"edt_eff_colorMarker_title" : "Color marker",
"edt_eff_colorMarker_title" : "Marker color",
"edt_eff_markerWidth_title" : "Marker width",
"edt_eff_markerDepth_title" : "Marker depth",
"edt_eff_backgroundColor_title" : "Background Color",
"edt_append_ns" : "ns",
"edt_append_ms" : "ms",
"edt_append_s" : "s",

View File

@ -1,80 +0,0 @@
import hyperion
import time
from datetime import datetime
def myRange(index, margin):
return [i % hyperion.ledCount for i in range(index-margin, index+margin+1)]
""" Define some variables """
sleepTime = 1
ledCount = hyperion.ledCount
offset = hyperion.args.get('offset', 0)
direction = bool(hyperion.args.get('direction', False))
hourMargin = hyperion.args.get('hour-margin', 2)
minuteMargin = hyperion.args.get('minute-margin', 1)
secondMargin = hyperion.args.get('second-margin', 0)
hourColor = hyperion.args.get('hour-color', (255,0,0))
minuteColor = hyperion.args.get('minute-color', (0,255,0))
secondColor = hyperion.args.get('second-color', (0,0,255))
markerColor = hyperion.args.get('marker-color', (255,255,255))
marker = ledCount/4
markers = (0+offset, int(marker + offset) % ledCount, int(2*marker + offset) % ledCount, int(3*marker + offset) % ledCount)
""" The effect loop """
while not hyperion.abort():
""" The algorithm to calculate the change in color """
led_data = bytearray()
now = datetime.now()
h = now.hour
m = now.minute
s = now.second
hmin = float(h+(1/60*m))
if hmin > 12:
hmin -= 12
hour = float(hmin/12 * ledCount)
led_hour = int(hour + offset) % ledCount
minute = m/60. * ledCount
led_minute = int(minute + offset) % ledCount
second = s/60. * ledCount
led_second = int(second + offset) % ledCount
hourRange = myRange(led_hour, hourMargin)
minuteRange = myRange(led_minute, minuteMargin)
secondRange = myRange(led_second, secondMargin)
for i in range(ledCount):
blend = [0, 0, 0]
if i in markers:
blend = markerColor
if i in hourRange:
blend = hourColor
if i in minuteRange:
blend = minuteColor
if i in secondRange:
blend = secondColor
led_data += bytearray((int(blend[0]), int(blend[1]), int(blend[2])))
""" send the data to hyperion """
hyperion.setColor(led_data)
""" sleep for a while """
timediff = (datetime.now()-now).microseconds/1000000.
time.sleep(sleepTime-timediff)

View File

@ -3,6 +3,13 @@
"script" : "light-clock.py",
"args" :
{
"show_seconds" : true
"show_seconds" : true,
"hour-color" : [0,0,255],
"minute-color" : [0,255,0],
"second-color" : [255,0,0],
"background-color" : [0,0,0],
"marker-depth" : 0,
"marker-width" : 5,
"marker-color" : [255,255,255]
}
}

View File

@ -1,90 +0,0 @@
{
"type": "object",
"script": "clock.py",
"title": "edt_eff_clock_header_title",
"required": true,
"properties": {
"offset": {
"type": "integer",
"title": "edt_eff_offset_title",
"default": 0,
"append": "edt_append_leds",
"propertyOrder": 1
},
"hour-color": {
"type": "array",
"title": "edt_eff_colorHour_title",
"format": "colorpicker",
"default": [255, 0, 0],
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder": 2
},
"minute-color": {
"type": "array",
"title": "edt_eff_colorMinute_title",
"format": "colorpicker",
"default": [0, 255, 0],
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder": 3
},
"second-color": {
"type": "array",
"title": "edt_eff_colorSecond_title",
"format": "colorpicker",
"default": [0, 0, 255],
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder": 4
},
"hour-margin": {
"type": "integer",
"title": "edt_eff_hourMargin_title",
"default": 2,
"propertyOrder" : 5
},
"minute-margin": {
"type": "integer",
"title": "edt_eff_minuteMargin_title",
"default": 1,
"propertyOrder" : 6
},
"second-margin": {
"type": "integer",
"title": "edt_eff_secondMargin_title",
"default": 0,
"propertyOrder" : 7
},
"marker-color": {
"type": "array",
"title":"edt_eff_colorMarker_title",
"format":"colorpicker",
"default": [255,255,255],
"items" : {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder" : 8
}
},
"additionalProperties": false
}

View File

@ -0,0 +1,27 @@
{
"type":"object",
"script" : "flag.py",
"title":"edt_eff_flag_header_title",
"required":true,
"properties":{
"flags": {
"type": "array",
"format": "select",
"title" : "edt_eff_flags_title",
"uniqueItems": true,
"items": {
"type": "string",
"enum": ["de","lt","fr","se","nl"]
},
"propertyOrder" : 1
}
"switch-time": {
"type": "integer",
"title":"edt_eff_switchtime_title",
"default": 5000,
"append" : "edt_append_ms",
"propertyOrder" : 2
}
},
"additionalProperties": false
}

View File

@ -4,11 +4,99 @@
"title":"edt_eff_lightclock_header_title",
"required":true,
"properties":{
"hour-color": {
"type": "array",
"title": "edt_eff_colorHour_title",
"format": "colorpicker",
"default": [0, 0, 255],
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder": 1
},
"minute-color": {
"type": "array",
"title": "edt_eff_colorMinute_title",
"format": "colorpicker",
"default": [0, 255, 0],
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder": 2
},
"second-color": {
"type": "array",
"title": "edt_eff_colorSecond_title",
"format": "colorpicker",
"default": [255, 0, 0],
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder": 3
},
"background-color": {
"type": "array",
"title": "edt_eff_backgroundColor_title",
"format": "colorpicker",
"default": [255, 255, 255],
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder": 4
},
"marker-depth": {
"type": "integer",
"title": "edt_eff_markerDepth_title",
"default": 5,
"minmum" : 0,
"maximum" : 100,
"append" : "edt_append_percent",
"propertyOrder" : 5
},
"marker-width": {
"type": "integer",
"title": "edt_eff_markerWidth_title",
"default": 5,
"minmum" : 0,
"maximum" : 100,
"append" : "edt_append_percent",
"propertyOrder" : 6
},
"marker-color": {
"type": "array",
"title":"edt_eff_colorMarker_title",
"format":"colorpicker",
"default": [255,255,255],
"items" : {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder" : 7
},
"show_seconds": {
"type": "boolean",
"title":"edt_eff_showseconds_title",
"default": true,
"propertyOrder" : 1
"propertyOrder" : 8
}
},
"additionalProperties": false