Sonnenaufgang und Sonnenuntergang im Panel anzeigen
Gestern gab es eine Anfrage im Github zur Anzeige des Sonnenuntergangs und des Sonnenaufgangs im NSPanel-Screensaver, statt des Windes oder sonstiger Infos...
Das ist grundsätzlich schon mal über die Datenpunkte der Wetteradapter möglich:
accuweather:
accuweather.0.Daily.Day1.Sunrise
accuweather.0.Daily.Day1.Sunset
daswetter:
daswetter.0.NextDaysDetailed.Location_1.Day_1.sun_in
daswetter.0.NextDaysDetailed.Location_1.Day_1.sun_out
In z.B. Blockly über Astrofunktionen ermitteln
Ihr werdet aber schnell feststellen, dass alle 3 Varianten nur über den gleichen Tag gelten. D.h. wenn Ihr nur wissen wollt, wann ist oder wann war denn heute der Sonnenaufgang und wann ist oder wann war denn der Sonnenuntergang, dann seit ihr bereits am Ziel.
Dann nur den Wert zusammen mit 2 Symbolen, z.B.:
weather-sunset-up
und
weather-sunset-up
in zwei der 4 möglichen Parameter unter firstScreensaverEntity - fourthScreensaverEntity eintragen und schon sieht man die Sonnenparameter...
Wenn ihr allerdings sagt, "was interessiert mich der Sonnenaufgang von vor 6 Stunden", dann wird es etwas kniffeliger, da alle 3 Varianten diese Infos zum nächsten Sonnenaufgang (d.h. in der Zeitspanne ab Sonnenuntergang bis 00:00 Uhr) nicht hergeben.
Über einen Trick kann das nächste auftretende Event mit der korrekten Zeit dennoch ermittelt werden:
Spoiler
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="lGekM1LmQ*+O~ztvyTc:">weatherAdapter</variable>
<variable id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</variable>
<variable id="ovz}S,QCqYs3J.((Fkpv">sunEvents</variable>
<variable id="P#6vyNW5F+sI$Qrr0?h*">index</variable>
<variable id="@5Qnz.4pO[WaGGMl~t:7">actualDateTime</variable>
<variable id="M87_jtL0%axzS#nEf}@8">i</variable>
<variable id="vV)QwBgKYRse|Gs4[[fT">icon</variable>
</variables>
<block type="comment" id="tAg0=MyLBUI#S44Z_+:f" x="-1087" y="-263">
<field name="COMMENT">daswetter oder accuweather</field>
<next>
<block type="variables_set" id="YQ~W/]6j7]GiW;M2o9[r">
<field name="VAR" id="lGekM1LmQ*+O~ztvyTc:">weatherAdapter</field>
<value name="VALUE">
<block type="text" id="u_YZ`*9~|0fRI?YXCj/%">
<field name="TEXT">accuweather</field>
</block>
</value>
<next>
<block type="variables_set" id="Z?=.#aeK1/gFw=42J0o:" disabled="true">
<field name="VAR" id="lGekM1LmQ*+O~ztvyTc:">weatherAdapter</field>
<value name="VALUE">
<block type="text" id="T3[xm$GuP81)^^bN6xX0">
<field name="TEXT">daswetter</field>
</block>
</value>
<next>
<block type="create" id="LQe;P09bd0~(hUFLWqkj">
<field name="NAME">0_userdata.0.Sunevent.next</field>
<value name="VALUE">
<block type="time_get" id="fm;5H}Iuc`$TS-j$gkg@">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">hh:mm</field>
</block>
</value>
<next>
<block type="create" id="$f98Y1:{]9c8-PcWZ23!">
<field name="NAME">0_userdata.0.Sunevent.icon</field>
<value name="VALUE">
<block type="text" id="-9a[$n}WeQ+X|%@KAUu-">
<field name="TEXT">weather-sunset-down</field>
</block>
</value>
<next>
<block type="controls_if" id="aWT)^_,X01O*My5%qRJ{">
<mutation elseif="1"></mutation>
<value name="IF0">
<block type="logic_compare" id="$Mb~iPxz|;qAazg6_fIV">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="b6C?CY-;)B_L@?.@vKa~">
<field name="VAR" id="lGekM1LmQ*+O~ztvyTc:">weatherAdapter</field>
</block>
</value>
<value name="B">
<block type="text" id="+f=YQ9/k@aZ@5$,BLA@e">
<field name="TEXT">accuweather</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id=".N1$ZK~J8:gTg-b-]xkM">
<field name="VAR" id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</field>
<value name="VALUE">
<block type="text" id="5rPYs{N{Bb;y~9/sZ{EI">
<field name="TEXT">accuweather.0.Daily.</field>
</block>
</value>
<next>
<block type="variables_set" id="dnjel3yq(6oygmqQ!dkj">
<field name="VAR" id="ovz}S,QCqYs3J.((Fkpv">sunEvents</field>
<value name="VALUE">
<block type="lists_create_with" id="`GS-e7_NuO%[Gi$L^G1M">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="convert_from_date" id=",f;2ZyAlw._@P3tT3Tb|">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
<value name="VALUE">
<block type="get_value_var" id="/F1?*lb5i^.IP:$5F=LK">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="text" id="!!|bLOmb_b!O#F;z,[G_">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id="6V7[[(izxMt?BX/#E-VY">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="variables_get" id="l(|D)96pya:zZtC,Bo,5">
<field name="VAR" id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</field>
</block>
</value>
<value name="ADD1">
<block type="text" id="HL[Fg8Lk8vc9cm:J0RQL">
<field name="TEXT">Day1.Sunrise</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="ADD1">
<block type="convert_from_date" id="`o9IZceriS8T*x|vHjT-">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
<value name="VALUE">
<block type="get_value_var" id="qlPvcXBEFIN6Q(])Zf1e">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="text" id="$b77uH(SKw/C:zsy6b]N">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id=";Z{TEONc%`vj2ab$0r-N">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="variables_get" id="^75~_ZO02c+8M3fLD:@=">
<field name="VAR" id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</field>
</block>
</value>
<value name="ADD1">
<block type="text" id="g!jaz;vh[`?/iH6I)dn4">
<field name="TEXT">Day1.Sunset</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="ADD2">
<block type="convert_from_date" id="q`kX3qBPbX9#rWrk_gPZ">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
<value name="VALUE">
<block type="get_value_var" id="{.t=[v{K;as@4JHH;=)5">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="text" id="dM@45=mm0NJBe+8y0;]w">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id="iyvr3._s~OG$~y(52u]i">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="variables_get" id="+8k+4nl/L?8#d#JMD(-T">
<field name="VAR" id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</field>
</block>
</value>
<value name="ADD1">
<block type="text" id="s}AkJj4}7Oa],!~M[N;j">
<field name="TEXT">Day2.Sunrise</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</statement>
<value name="IF1">
<block type="logic_compare" id="rQU!WF~q(bitAh|M@g(q">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="Gt+G^3Virtg[[n;5oAv/">
<field name="VAR" id="lGekM1LmQ*+O~ztvyTc:">weatherAdapter</field>
</block>
</value>
<value name="B">
<block type="text" id="{K!=g%4{7M#N1CY/|a|~">
<field name="TEXT">daswetter</field>
</block>
</value>
</block>
</value>
<statement name="DO1">
<block type="variables_set" id="-=_U;)7lZQegY1jdg)cK">
<field name="VAR" id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</field>
<value name="VALUE">
<block type="text" id="n8)9D;BD~G8U+^?#_B|P">
<field name="TEXT">daswetter.0.NextDaysDetailed.Location_1.</field>
</block>
</value>
<next>
<block type="variables_set" id="X{sXpUN}p#QmbxFmw8fv">
<field name="VAR" id="ovz}S,QCqYs3J.((Fkpv">sunEvents</field>
<value name="VALUE">
<block type="lists_create_with" id="KGhvO0)OHqNc(0A=1fIv">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="convert_from_date" id="qP;eIvR3D-L6?/0e~AXW">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
<value name="VALUE">
<block type="get_value_var" id="P^:@OuzJ|9V+/da%9hXY">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="text" id="%lm`:~Ng5g0ye#u8LpY3">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id="lP*QSKhZ3NyG=nieqAYp">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="variables_get" id="02;ViSq8#:bNa!aoQCy0">
<field name="VAR" id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</field>
</block>
</value>
<value name="ADD1">
<block type="text" id="`8uIK)lkeXa)uORJ,q!c">
<field name="TEXT">Day_1.sun_in</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="ADD1">
<block type="convert_from_date" id="(gZ)2;Qk@ba/C75gsU(m">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
<value name="VALUE">
<block type="get_value_var" id="Az`4rq*tGHQfkSu6z;@L">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="text" id="lvj~LN:O%tQP$Qv{oRA6">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id="EdueeQ@fX0;$/wF/+%K]">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="variables_get" id="lY{eT5lh9QBfS;j1cPbo">
<field name="VAR" id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</field>
</block>
</value>
<value name="ADD1">
<block type="text" id="6!Cnq-;oAG0]8jB2fI-*">
<field name="TEXT">Day_1.sun_out</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="ADD2">
<block type="convert_from_date" id="#6jO_%HDJ*x;|=VR=XC,">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
<value name="VALUE">
<block type="get_value_var" id="A!;q:Z6*Z6R*pZ+x.GF0">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="text">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id=",,Lm/%RWi7xv*{rwFt%b">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="variables_get" id="_rR;kn|US.%R:mRkJ]Dc">
<field name="VAR" id="Xv1p5y_ZlH)(!`r+@M2-">weatherAdapterPath</field>
</block>
</value>
<value name="ADD1">
<block type="text" id="0ij}w8n2_H7id81iN(Di">
<field name="TEXT">Day_2.sun_in</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="schedule" id="ErsW?NofKCD(:Q0`V~Ma">
<field name="SCHEDULE">* * * * *</field>
<statement name="STATEMENT">
<block type="variables_set" id="K.7g^mfGF[8pxWc_@F!(">
<field name="VAR" id="P#6vyNW5F+sI$Qrr0?h*">index</field>
<value name="VALUE">
<block type="math_number" id="Jp}00bvJvG3NJb$=.Ey_">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="@DQ2yP;Bfwk)m|BTja24">
<field name="VAR" id="@5Qnz.4pO[WaGGMl~t:7">actualDateTime</field>
<value name="VALUE">
<block type="time_get" id="3C!5:__oTnJHZkT=CdHT">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
</block>
</value>
<next>
<block type="controls_forEach" id="h|7J%UAbmOJ^U%@?Q9E_">
<field name="VAR" id="M87_jtL0%axzS#nEf}@8">i</field>
<value name="LIST">
<block type="variables_get" id="[F{0YG]6%@js31kZ0yCS">
<field name="VAR" id="ovz}S,QCqYs3J.((Fkpv">sunEvents</field>
</block>
</value>
<statement name="DO">
<block type="math_change" id="k5Wkbq)pJ3rxMf())#LW">
<field name="VAR" id="P#6vyNW5F+sI$Qrr0?h*">index</field>
<value name="DELTA">
<shadow type="math_number" id="Valeu~1_|nc^q`qSXq!j">
<field name="NUM">1</field>
</shadow>
</value>
<next>
<block type="controls_if" id="W$w0W1#f4(n=}tSWu~Db">
<value name="IF0">
<block type="logic_compare" id="S3M3iWnzs]~v?|E!k%S}">
<field name="OP">LT</field>
<value name="A">
<block type="variables_get" id="T+]nVz*-7{N=wNZ]#u$,">
<field name="VAR" id="@5Qnz.4pO[WaGGMl~t:7">actualDateTime</field>
</block>
</value>
<value name="B">
<block type="variables_get" id="Jn@V}yHRDy..QpfoHlNS">
<field name="VAR" id="M87_jtL0%axzS#nEf}@8">i</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="controls_flow_statements" id="{kN12BKUd3`*w.r~H3NA">
<field name="FLOW">BREAK</field>
</block>
</statement>
</block>
</next>
</block>
</statement>
<next>
<block type="control_ex" id="{Cq0X~RE]fq)Q:*9t1j@">
<field name="TYPE">false</field>
<field name="CLEAR_RUNNING">FALSE</field>
<value name="OID">
<shadow type="field_oid" id="kHf`Hf9Pk]W9Cee(4nWQ">
<field name="oid">Object ID</field>
</shadow>
<block type="text" id="gTFZ[557_KhO%}Q3Riao">
<field name="TEXT">0_userdata.0.Sunevent.next</field>
</block>
</value>
<value name="VALUE">
<shadow type="logic_boolean" id="X4-?Cs.mI+_n:pp^(mSU">
<field name="BOOL">TRUE</field>
</shadow>
<block type="convert_from_date" id="DFWkKAZ=CxL%QJ`va3aU">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">hh:mm</field>
<value name="VALUE">
<block type="variables_get" id="S=2,(W$!zu=~@Om4W^BI">
<field name="VAR" id="M87_jtL0%axzS#nEf}@8">i</field>
</block>
</value>
</block>
</value>
<value name="DELAY_MS">
<shadow type="math_number" id="`U*0`cyy(+!x/av];hxs">
<field name="NUM">0</field>
</shadow>
</value>
<next>
<block type="debug" id=";5aowQ7k1/*[)rn[/*,E">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="8E;^oHb[00iVTwq$?/e}">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="m^Sy9v.}u6FnVn_~~Qmd">
<field name="VAR" id="P#6vyNW5F+sI$Qrr0?h*">index</field>
</block>
</value>
<next>
<block type="controls_if" id="(Bd^RAxt-HWlq@,Q?J2K">
<mutation else="1"></mutation>
<value name="IF0">
<block type="logic_compare" id="43|7RBEH08AoepX,AkSq">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="{qmY@S`FE2]4E~3ec}52">
<field name="VAR" id="P#6vyNW5F+sI$Qrr0?h*">index</field>
</block>
</value>
<value name="B">
<block type="math_number" id="LRiZXf)MUC#Y+dRC_,)J">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="rPqQ-`A{E#0y{7h@?lY^">
<field name="VAR" id="vV)QwBgKYRse|Gs4[[fT">icon</field>
<value name="VALUE">
<block type="text" id="!q.lWsImqxu|0Pk*I;=t">
<field name="TEXT">weather-sunset-down</field>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="variables_set" id="1m=87T*7*X$4a!U0{/_H">
<field name="VAR" id="vV)QwBgKYRse|Gs4[[fT">icon</field>
<value name="VALUE">
<block type="text" id="36zG[DTfbdr}z02tRcKU">
<field name="TEXT">weather-sunset-up</field>
</block>
</value>
</block>
</statement>
<next>
<block type="control_ex" id="2OVi=tZ}O0b0jI/lRivB">
<field name="TYPE">false</field>
<field name="CLEAR_RUNNING">FALSE</field>
<value name="OID">
<shadow type="field_oid">
<field name="oid">Object ID</field>
</shadow>
<block type="text" id="/,dXm2wWk#mhaC+%[gM]">
<field name="TEXT">0_userdata.0.Sunevent.icon</field>
</block>
</value>
<value name="VALUE">
<shadow type="logic_boolean" id="0=re$F9YZu+U7R)7J--p">
<field name="BOOL">TRUE</field>
</shadow>
<block type="variables_get" id="uM|GIUVV|MHPcc35Tqdz">
<field name="VAR" id="vV)QwBgKYRse|Gs4[[fT">icon</field>
</block>
</value>
<value name="DELAY_MS">
<shadow type="math_number" id="|$7R_dM7IwX.2X8Mx^o7">
<field name="NUM">0</field>
</shadow>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</xml>
Für den Fall, dass jemand Interesse hat...