Hallo Gemeinde,
Hier ein kleines Script das Wetterdaten regenmässig zu Wunderground hoch läd.
Voraussetzung ist eine PWS (Personal Weather Station) bei Wunderground. Die Registrierung der PWS erfolgt hier:
https://www.wunderground.com/personal-w … ion/signup
Die Quelle der Wetterdaten ist bei mir der Weatherman. Näheres hierzu ist zu finden unter:
https://www.stall.biz/project/weatherma … automation
In dem Blockly müssen nur die Zugangsdaten der PWS (ID und Passwort) eingetragen werden.
Das Script rechnet die Messwerte in die von Wunderground geforderten Einheiten um und läd die Daten alle 2 Minutem hoch. Sollten die Messwerte aus anderen Quellen kommen, müssen die Umrechnungsfaktoren ggf. angepasst werden.
So, hier jetzt das Blockly:
und hier der Export:
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="schedule" id="NVQ4`W#p(8mnMqzc.so@" x="338" y="12"><field name="SCHEDULE">*/2 * * * *</field>
<statement name="STATEMENT"><block type="create" id="Ryy@[}Z8I!]_}]:y!y#Z"><field name="NAME">javascript.0.WEATHERMAN.Last_Wunderground_upload</field>
<next><block type="variables_set" id="J6pfV3Pv:-PcV-U8o3e("><field name="VAR">ID</field>
<value name="VALUE"><block type="text" id="4o}!@aUA-7n3A_,+!Zf="><field name="TEXT">xxx</field></block></value>
<next><block type="variables_set" id="lNS})+2:]k7-.RJdgaeC"><field name="VAR">PWD</field>
<value name="VALUE"><block type="text" id="*`IA18YFG:Rqdhs/%lt."><field name="TEXT">yyy</field></block></value>
<next><block type="variables_set" id="IuV!Ik{*|@RQ?@o@p54s"><field name="VAR">windspeed_mph</field>
<value name="VALUE"><block type="math_arithmetic" id="Hr]VNoyEq)zWSA3Ov.!B"><field name="OP">MULTIPLY</field>
<value name="A"><shadow type="math_number" id="y8`^YX%BoO1CEijv?e;J"><field name="NUM">2.23693629</field></shadow></value>
<value name="B"><shadow type="math_number" id="Q-V3X%h4_JnJ%4vwTwe("><field name="NUM">1</field></shadow>
<block type="get_value" id="PcDIA^0^.^0!CyEyQ%Ih"><field name="ATTR">val</field>
<field name="OID">javascript.0.WEATHERMAN.w_wind_avg</field></block></value></block></value>
<next><block type="variables_set" id=")G^m+8#;HudLoG-nk7to"><field name="VAR">rain_in</field>
<value name="VALUE"><block type="math_arithmetic" id="Y^#}5v_/pj:#g-+aM7uG"><field name="OP">MULTIPLY</field>
<value name="A"><shadow type="math_number" id="L?#oz=DGXpEmA@z/WM6a"><field name="NUM">0.03937</field></shadow></value>
<value name="B"><shadow type="math_number" id="Q-V3X%h4_JnJ%4vwTwe("><field name="NUM">1</field></shadow>
<block type="get_value" id="Z#jEx-=B=9Ud|,P!%Tn]"><field name="ATTR">val</field>
<field name="OID">javascript.0.WEATHERMAN.w_rain_intensity</field></block></value></block></value>
<next><block type="variables_set" id="KavP@R0V/~7;G^;G/*lE"><field name="VAR">rain_daily</field>
<value name="VALUE"><block type="math_arithmetic" id="xx2y4{FP^qg).tBzcw4i"><field name="OP">MULTIPLY</field>
<value name="A"><shadow type="math_number" id="q}Qu!!A_q*bMo2]/6npC"><field name="NUM">0.03937</field></shadow></value>
<value name="B"><shadow type="math_number" id="Q-V3X%h4_JnJ%4vwTwe("><field name="NUM">1</field></shadow>
<block type="get_value" id="{OwS|_!RcuS#gd9I7dYB"><field name="ATTR">val</field>
<field name="OID">javascript.0.WEATHERMAN.w_rain_volume_24</field></block></value></block></value>
<next><block type="variables_set" id="2o.mspN{c2VuYMvet|^e"><field name="VAR">baro_in</field>
<value name="VALUE"><block type="math_arithmetic" id="IOs;[N;fdtiNHk2GC:3K"><field name="OP">MULTIPLY</field>
<value name="A"><shadow type="math_number" id="X-R?36spX2@GhM+Bhih["><field name="NUM">0.0295301</field></shadow></value>
<value name="B"><shadow type="math_number" id="Q-V3X%h4_JnJ%4vwTwe("><field name="NUM">1</field></shadow>
<block type="get_value" id="yuXUY_6Kz%x6D2742NaL"><field name="ATTR">val</field>
<field name="OID">javascript.0.WEATHERMAN.w_barometer</field></block></value></block></value>
<next><block type="variables_set" id="}ZNtE{YDT~uH^(9oC@uJ"><field name="VAR">Aussentemp_F</field>
<value name="VALUE"><block type="math_arithmetic" id="~)9T~(f~8P[fqQ+zVlzZ"><field name="OP">ADD</field>
<value name="A"><shadow type="math_number" id="%PDN|YJ@naL)yZi3QAvx"><field name="NUM">1</field></shadow>
<block type="math_arithmetic" id="c,;et0f(JDhiPflCEvQ~"><field name="OP">MULTIPLY</field>
<value name="A"><shadow type="math_number" id="#wm=O,l0nAF9wv.iOX11"><field name="NUM">1.8</field></shadow></value>
<value name="B"><shadow type="math_number" id="Q-V3X%h4_JnJ%4vwTwe("><field name="NUM">1</field></shadow>
<block type="get_value" id="qOqzkEcqx~:Aulh^61Hv"><field name="ATTR">val</field>
<field name="OID">javascript.0.Wetter.TempAussen_mittel</field></block></value></block></value>
<value name="B"><shadow type="math_number" id="j*@d,/*5vtdrrXk|~.Eh"><field name="NUM">32</field></shadow></value></block></value>
<next><block type="variables_set" id="Knc[}47D!:t{BiPPIyJ:"><field name="VAR">Taupunkt_F</field>
<value name="VALUE"><block type="math_arithmetic" id="-I7a(p(*0]An=q_.k`Gw"><field name="OP">ADD</field>
<value name="A"><shadow type="math_number" id="%PDN|YJ@naL)yZi3QAvx"><field name="NUM">1</field></shadow>
<block type="math_arithmetic" id="2BH#}7rz%F8T%{).(C3H"><field name="OP">MULTIPLY</field>
<value name="A"><shadow type="math_number" id="6,TW%,p,xF`^)_.)n(^k"><field name="NUM">1.8</field></shadow></value>
<value name="B"><shadow type="math_number" id="Q-V3X%h4_JnJ%4vwTwe("><field name="NUM">1</field></shadow>
<block type="get_value" id="*_^,@J,Zq3+#T*m5~;/E"><field name="ATTR">val</field>
<field name="OID">javascript.0.WEATHERMAN.w_taupunkt</field></block></value></block></value>
<value name="B"><shadow type="math_number" id=";~WP]L/.ED;fW~Q5HqB7"><field name="NUM">32</field></shadow></value></block></value>
<next><block type="variables_set" id="(..4D@D}1bg(~)~wtU]Y"><field name="VAR">url</field>
<value name="VALUE"><block type="text_join" id="(`%c8pO+2VPBopp8V2uE"><mutation items="21"></mutation>
<value name="ADD0"><block type="text" id="Q!k*6kwCyW4I4Cz|wd@P"><field name="TEXT">https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=I</field></block></value>
<value name="ADD1"><block type="variables_get" id="xj,x#Q6z02@Ne;(-k1!A"><field name="VAR">ID</field></block></value>
<value name="ADD2"><block type="text" id="C-`~;w6JL`I.:oWwFxVd"><field name="TEXT">&PASSWORD=</field></block></value>
<value name="ADD3"><block type="variables_get" id="fx56Av]MfZot/a{Dmc|{"><field name="VAR">PWD</field></block></value>
<value name="ADD4"><block type="text" id="L0hDbLXU%1u~w5v.!F4f"><field name="TEXT">&dateutc=now&winddir=</field></block></value>
<value name="ADD5"><block type="get_value" id="_:4@dKfy1.kKNK8pTkt|"><field name="ATTR">val</field>
<field name="OID">javascript.0.WEATHERMAN.w_wind_dir</field></block></value>
<value name="ADD6"><block type="text" id="jmr1j,+KpmnwS?w_l+Ed"><field name="TEXT">&windspeedmph=</field></block></value>
<value name="ADD7"><block type="variables_get" id="9E;ZOzzC~ZqX=C:x/GjB"><field name="VAR">windspeed_mph</field></block></value>
<value name="ADD8"><block type="text" id="TIXVRGWq=6_mWoM+}cl,"><field name="TEXT">&baromin=</field></block></value>
<value name="ADD9"><block type="variables_get" id="Jy|66pdKM[;Ymn@O]cSc"><field name="VAR">baro_in</field></block></value>
<value name="ADD10"><block type="text" id="MW`,ew(c(~MSxb;kNx0V"><field name="TEXT">&rainin=</field></block></value>
<value name="ADD11"><block type="variables_get" id="/*W]fWFF=nd;?[h@:Y]:"><field name="VAR">rain_in</field></block></value>
<value name="ADD12"><block type="text" id="g2`9cWu%chRz{e~MJCVC"><field name="TEXT">&humidity=</field></block></value>
<value name="ADD13"><block type="get_value" id="c8]Z},O.#(X:^fh8BQDR"><field name="ATTR">val</field>
<field name="OID">javascript.0.WEATHERMAN.w_humidity</field></block></value>
<value name="ADD14"><block type="text" id="SIL,)^KA){`f@q!dAA=="><field name="TEXT">&tempf=</field></block></value>
<value name="ADD15"><block type="variables_get" id="EY.SScRsM@YGFg^QlVM-"><field name="VAR">Aussentemp_F</field></block></value>
<value name="ADD16"><block type="text" id="q}qN.05:t3NMIpo,|Q?Y"><field name="TEXT">&dailyrainin=</field></block></value>
<value name="ADD17"><block type="variables_get" id="kIjIuh}xDg+=O7c?Ujk}"><field name="VAR">rain_daily</field></block></value>
<value name="ADD18"><block type="text" id="Oqe8I4ntC{bf(l@VDCIN"><field name="TEXT">&dewptf=</field></block></value>
<value name="ADD19"><block type="variables_get" id="DHDV?62iQQ_nxWXc];[Y"><field name="VAR">Taupunkt_F</field></block></value>
<value name="ADD20"><block type="text" id="PD_5#o=a+5Lv(NZ{+{_;"><field name="TEXT">&action=updateraw</field></block></value></block></value>
<next><block type="request" id="@DtdK@NaHfPFifwX2)9Z"><mutation with_statement="true"></mutation>
<field name="WITH_STATEMENT">TRUE</field>
<value name="URL"><shadow type="text" id="M(AOk0tWYIWcpx2bEYJ."><field name="TEXT">text</field></shadow>
<block type="variables_get" id="vr9m*ZXavDVMWFaR_iN["><field name="VAR">url</field></block></value>
<statement name="STATEMENT"><block type="controls_if" id="=dHWKib4(|bqIz[deQxp"><mutation else="1"></mutation>
<value name="IF0"><block type="logic_compare" id="3^Or==q!t};6PCe3yo3a"><field name="OP">GT</field>
<value name="A"><block type="text_indexOf" id="M6}Pr%6[L-p@i:~0v:uR"><field name="END">FIRST</field>
<value name="VALUE"><block type="variables_get" id=";r~4V,}SMS,3}E((4rq:"><field name="VAR">result</field></block></value>
<value name="FIND"><shadow type="text" id="B[@H~FSpM_!7B}%5XsAX"><field name="TEXT">false</field></shadow></value></block></value>
<value name="B"></value></block></value>
<statement name="DO0"><block type="telegram" id="^383WMpd;gqr;Wqg5TmX"><field name="INSTANCE">.0</field>
<value name="MESSAGE"><shadow type="text" id="DJA?*T2{EtJM?Vy#zZN."><field name="TEXT">Der Wunderground Upload ist fehlgeschlagen</field></shadow></value></block></statement>
<statement name="ELSE"><block type="update" id="Dhlt1isqfpkSs@W+g!TB"><mutation delay_input="false"></mutation>
<field name="OID">javascript.0.WEATHERMAN.Last_Wunderground_upload</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE"><block type="time_get" id="G8N-|m^zK#|]1Jy2XHa9"><mutation format="true" language="false"></mutation>
<field name="OPTION">custom</field>
<field name="FORMAT">TT.MM, SS:mm:ss</field></block></value></block></statement></block></statement></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block></xml>
Hinweise und eventuelle Verbesserungsvorschläge sind immer willkommen.