Auf der Seite http://susdesign.com/sunposition/index.php kann man Sich für seinen Standort die aktuellen Daten berechnen lassen. Ich habe mir die Daten alle 15 Minuten berechnen lassen.
Mit einem tcl Script lese ich dann die Daten aus und übergebe sie an an die CCU:
Code: Alles auswählen
#!/bin/tclsh
load tclrega.so
proc readfile {} {
set command ""
#Time
append command "var hmtimeH = system.Date('%H');"
append command "var hmtimeM = system.Date('%M').ToInteger();"
append command "var hmtimemi = (hmtimeM /15)*15;"
append command "if (hmtimemi==0) {var hmtime = hmtimeH+':00';}"
append command "else {var hmtime = hmtimeH+':'+hmtimemi.ToString();}"
append command "var hmdate = system.Date('%D').ToString().Substr(0,5);"
array set result [rega_script $command]
set mytime $result(hmtime)
set mydate $result(hmdate)
set filename "/usr/local/etc/config/addons/rega/Azimut.csv"
set f [open $filename]
while {[gets $f line]>=0} {
set fields [split $line "\t"]
set date_ [lindex $fields 0]
set time_ [lindex $fields 1]
if {($date_ == $mydate) && ($time_ == $mytime)} {
set alt [lindex $fields 2]
set azimute [lindex $fields 3]
set Command ""
append command "var sAltaO = dom.GetObject('SunAltitudeAngle');"
append command "var sAltaV = sAltaO .Value();"
append command "var sAzaO = dom.GetObject('SunAzimuthAngle');"
append command "var sAzaV = sAzaO .Value();"
append command "sAltaO.State('$alt');"
append command "sAzaO.State('$azimute');"
array set result [rega_script $command]
}
}
}
readfile
Code: Alles auswählen
string stdout;
string stderr;
system.Exec("tclsh /usr/local/etc/config/addons/rega/CalcAzimuth.tcl", &stdout, &stderr);
http://susdesign.com/sunposition/index.php