@oliverio sagte in Wake on Lan installieren :
danach ein skript im javascript adapter erstellen
@Olli_M
Hier mal ein Skript dazu, das schaltet jeden Tag mein Büro, über einen HM-IP Schalter im Flur, an und aus - inkl. Steckdose
Blockly wakeonlan
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="%g/ANJxNOs5Cicx-gOSb">log_info_text</variable>
<variable id="-r/}hhL0@h;1gaLT?}`b">oid</variable>
<variable id="6_JJzzeJG!sq.1_eKyW|">delay</variable>
<variable id="ofh(iD!YW(+.E5!h-H5`">wol_ip</variable>
<variable id="IT?3aSGqeT+8[51FKL~q">wol_mac</variable>
<variable id="CgO7**.g^~ROq!;VBXGG">wol_hostname</variable>
<variable id="@Rx5)VE,|H|,FBCrH4:L">error</variable>
<variable id="+~qvXTXYsqr5jkS2%jmm">result</variable>
<variable type="timeout" id="sendeWoLDelay">sendeWoLDelay</variable>
</variables>
<block type="procedures_defnoreturn" id="Ha@.OsV]W_)8l},9e-%}" x="13" y="13">
<mutation>
<arg name="log_info_text" varid="%g/ANJxNOs5Cicx-gOSb"></arg>
</mutation>
<field name="NAME">log_info</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="debug" id="AANqq.F;(3x=J-7PD4EV" inline="true">
<field name="Severity">log</field>
<value name="TEXT">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="6w9`Hf9~|RY5t2C0X0rX">
<field name="TEXT">test</field>
</shadow>
<block type="text_join" id=",POUCWP3D[u0,//UBZ[w">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="text" id="4mxi~0XN[06PL27GU1ip">
<field name="TEXT">+++ </field>
</block>
</value>
<value name="ADD1">
<block type="text" id="I)[%/A^fJ6^hsvN)9/O7">
<field name="TEXT">Wake on LAN: </field>
</block>
</value>
<value name="ADD2">
<block type="variables_get" id="z4y3-s:~(-!kgCNWne)5">
<field name="VAR" id="%g/ANJxNOs5Cicx-gOSb">log_info_text</field>
</block>
</value>
<value name="ADD3">
<block type="text" id="*#z%dPW;NK9?dKG^}xm$">
<field name="TEXT"> +++</field>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" id="Kys+qcC(bUA!F,^8{PVF" x="13" y="213">
<mutation>
<arg name="oid" varid="-r/}hhL0@h;1gaLT?}`b"></arg>
<arg name="delay" varid="6_JJzzeJG!sq.1_eKyW|"></arg>
</mutation>
<field name="NAME">schalteSteckdoseEin</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="control_ex" id="F)QRfApL|JFF%nLS~q!g" inline="true">
<field name="TYPE">false</field>
<field name="CLEAR_RUNNING">FALSE</field>
<value name="OID">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="field_oid" id="YDka~k7ocKK0i;::n{*`">
<field name="oid">Object ID</field>
</shadow>
<block type="variables_get" id="rP!M2[.gp72]fY5hj2u|">
<field name="VAR" id="-r/}hhL0@h;1gaLT?}`b">oid</field>
</block>
</value>
<value name="VALUE">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="logic_boolean" id="SFLtwmU^1YD-HWGZ{^x%">
<field name="BOOL">TRUE</field>
</shadow>
<block type="logic_boolean" id="dk.HtyjC+[9@l]Gu8:hN">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="DELAY_MS">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number" id=".U)9C]5OUYvIy.5SyQG;">
<field name="NUM">0</field>
</shadow>
<block type="variables_get" id="U@PKwKWG?zp{2[GbEEP/">
<field name="VAR" id="6_JJzzeJG!sq.1_eKyW|">delay</field>
</block>
</value>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" id="rH3ln1Qykq:@87z8ry0%" x="13" y="313">
<mutation>
<arg name="wol_ip" varid="ofh(iD!YW(+.E5!h-H5`"></arg>
<arg name="wol_mac" varid="IT?3aSGqeT+8[51FKL~q"></arg>
<arg name="wol_hostname" varid="CgO7**.g^~ROq!;VBXGG"></arg>
</mutation>
<field name="NAME">wol</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="exec" id="g(i(cmX5rHp18RxviHwU" inline="true">
<mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="true"></mutation>
<field name="WITH_STATEMENT">TRUE</field>
<field name="LOG"></field>
<value name="COMMAND">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="V`po#;p:P_.KUR9.IKEQ">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id="M@qFv#cCgQwWeWlUI#AF">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="text" id="4P_SAbwQ}x^D].9,$1Sb">
<field name="TEXT">/usr/bin/wakeonlan </field>
</block>
</value>
<value name="ADD1">
<block type="text_join" id="9B+wA0Dy=%XyxfP(Fm#8">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="text" id="P@XEq;klgqc#dZ2B]}Hr">
<field name="TEXT">-i </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="2DQHe.;Cd9Ei6y6#ki}#">
<field name="VAR" id="ofh(iD!YW(+.E5!h-H5`">wol_ip</field>
</block>
</value>
<value name="ADD2">
<block type="text" id="M`n:LuD]!vtlx%AU3PZy">
<field name="TEXT"> </field>
</block>
</value>
</block>
</value>
<value name="ADD2">
<block type="variables_get" id="`QjG?:Tt$VxruNOV$Xf;">
<field name="VAR" id="IT?3aSGqeT+8[51FKL~q">wol_mac</field>
</block>
</value>
</block>
</value>
<statement name="STATEMENT">
<block type="controls_if" id="F-[.%rl#5^{Y]qf4;(k%">
<mutation else="1"></mutation>
<value name="IF0">
<block type="variables_get" id="?K8I|MWI+]rH1ndDaAT$">
<field name="VAR" id="@Rx5)VE,|H|,FBCrH4:L">error</field>
</block>
</value>
<statement name="DO0">
<block type="procedures_callnoreturn" id="(iu|MiJ}_;-4kF9Q1U5o" inline="true">
<mutation name="log_info">
<arg name="log_info_text"></arg>
</mutation>
<value name="ARG0">
<block type="text_join" id="}g0%C}FPgMK?w[cM;EbL">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="text" id="c6~Oli]7qQPpa1zwkY6*">
<field name="TEXT">Fehler beim ausfuehren von Wake on LAN fuer </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="kmXu6T*^!SJSQ!9#F`X*">
<field name="VAR" id="CgO7**.g^~ROq!;VBXGG">wol_hostname</field>
</block>
</value>
<value name="ADD2">
<block type="text_join" id="NaY|B}9Aw6zz`4h]DI=.">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="text" id="|rzoQ3T{O!(x~W#}0[|3">
<field name="TEXT">Fehler: </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="`i{lP;W2PmmBk0WIVb{b">
<field name="VAR" id="@Rx5)VE,|H|,FBCrH4:L">error</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="procedures_callnoreturn" id="C?,%S092w#U78!@w~Xt9" inline="true">
<mutation name="log_info">
<arg name="log_info_text"></arg>
</mutation>
<value name="ARG0">
<block type="text_join" id="!QMWPzW96R}pPHGyB,U-">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="text" id="pYvZj7QD/A:#[lh]KTLm">
<field name="TEXT">Paket fuer </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="3g)|$$Jr42}32iXp7~wN">
<field name="VAR" id="CgO7**.g^~ROq!;VBXGG">wol_hostname</field>
</block>
</value>
<value name="ADD2">
<block type="text" id="Wz})O$hE%oK}21=BLi2=">
<field name="TEXT"> wurde gesendet: </field>
</block>
</value>
<value name="ADD3">
<block type="variables_get" id="lzF~?R6i^9rG~tmV_FDb">
<field name="VAR" id="+~qvXTXYsqr5jkS2%jmm">result</field>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
</statement>
</block>
</statement>
</block>
<block type="comment" id="z||]UF72gf:`#??Pm`i(" x="13" y="863">
<field name="COMMENT">thor - wenn ping = true</field>
<next>
<block type="comment" id="L6-3JshN}!Qff0o!iH{Z">
<field name="COMMENT">Skript zum Automatischen Abschalten ein</field>
<next>
<block type="on_ext" id="Kkd4Xc9jNf5/gU(+RpD9">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">true</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="field_oid" id="cOo@z`0_S2Hr#k6,~jA/">
<field name="oid">default</field>
</shadow>
<block type="text" id="fqo7XZk0(`Qf6+KFw#Q$">
<field name="TEXT">ping.0.thor</field>
</block>
</value>
<statement name="STATEMENT">
<block type="comment" id="9`0MM%h(kvQR/9h9*T~K">
<field name="COMMENT">Wenn Skript zum autom. = aus, dann schalte es ein</field>
<next>
<block type="controls_if" id="u1O5D?`ORN_i!pVUM=hH">
<value name="IF0">
<block type="logic_compare" id="`Il*A/-G6PhKD6d|9m8s">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value_var" id="E1kNEl(yq$?4)g:^qxLx">
<field name="ATTR">val</field>
<value name="OID">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="0H):SRu*s]tQj={K.~ID">
<field name="TEXT"></field>
</shadow>
<block type="text" id="lEWvKtxK,8pPk`5~-4v1">
<field name="TEXT">javascript.0.scriptEnabled.PRODUKTIV.Energie.05_Steckdosen_automatisch_ausschalten</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="7E)I_Xpq#Z2,}}gaGg$6">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control_ex" id="5,huwlF:C}xF/3:b27~X" inline="true">
<field name="TYPE">false</field>
<field name="CLEAR_RUNNING">FALSE</field>
<value name="OID">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="field_oid" id="GYP9CA$[U@8LvjL=eUnV">
<field name="oid">Object ID</field>
</shadow>
<block type="text" id="g;]9I|~jrY?90^#u%%!(">
<field name="TEXT">javascript.0.scriptEnabled.PRODUKTIV.Energie.05_Steckdosen_automatisch_ausschalten</field>
</block>
</value>
<value name="VALUE">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="logic_boolean" id="zN~Sjat4e$M4_Ql4|v$U">
<field name="BOOL">FALSE</field>
</shadow>
<block type="logic_boolean" id="%bssM5hA)DW!QYjUZ#Yr">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="DELAY_MS">
<shadow type="math_number" id="}|c~yr@m*m}LK]tDDC]z">
<field name="NUM">0</field>
</shadow>
</value>
<next>
<block type="procedures_callnoreturn" id="tBC;]piwGzsYP$X%5hWk" inline="true">
<mutation name="log_info">
<arg name="log_info_text"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="V+U}/h_3TyRe1~yQKdfm">
<field name="TEXT">Aktivere Skript zum Automatischen ausschalten der Steckdose.</field>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</statement>
<next>
<block type="comment" id="rxP]#$@pGa)g0ub:_bNQ">
<field name="COMMENT">thor - sende WoL</field>
<next>
<block type="on_ext" id="eC=PrAM}Jf`b]7}g@:-Z">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">any</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="field_oid" id="lM;0[R6@DwEo7d=:KG:w">
<field name="oid">default</field>
</shadow>
<block type="text" id="k$*,h=}:^1gDPYezDQ8?">
<field name="TEXT">javascript.0.System.WakeOnLAN.wol_thor</field>
</block>
</value>
<statement name="STATEMENT">
<block type="comment" id="[?Ha$cJ.B~aD:h:i!N?i">
<field name="COMMENT">Wenn Steckdose = false</field>
<next>
<block type="controls_if" id="bTa(VYIb6ZD)|BkirJ~1">
<mutation else="1"></mutation>
<value name="IF0">
<block type="logic_compare" id="YX0K,S4RtI?[S(}Sk@PS">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value_var" id="6CV}%{v*:3ZY@%*#1u^)">
<field name="ATTR">val</field>
<value name="OID">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="!oX3/?P`GU5L{T`{+Nk1">
<field name="TEXT">linkeddevices.0.energie.steckdosen.pc_state</field>
</shadow>
<block type="text" id="w(T%qH/,zGoS8Me9~mhV">
<field name="TEXT">linkeddevices.0.energie.steckdosen.pc_state</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="j-GOb%UM{Z6eJL.;oW-*">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="comment" id="ZBjhxb0sij5647ch%_AO">
<field name="COMMENT">Steckdose = aus</field>
<next>
<block type="comment" id="G%LqL:nDT=R|-Wpe8P}R">
<field name="COMMENT">deaktiviere kurzeitig Skript </field>
<next>
<block type="comment" id="~;T`^J?Mz(xz!ic0{64t">
<field name="COMMENT">zum Abschalten der Steckdose</field>
<next>
<block type="controls_if" id="We~|v}p/1Kk)o+EsGb6V">
<value name="IF0">
<block type="logic_compare" id=")Kk#OE9GNWM|d:W9/yu;">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value_var" id="6Kts(0S1Y1=VyP~;pblU">
<field name="ATTR">val</field>
<value name="OID">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="0H):SRu*s]tQj={K.~ID">
<field name="TEXT"></field>
</shadow>
<block type="text" id="/4:/FjSg6_S2S29p$Woh">
<field name="TEXT">javascript.0.scriptEnabled.PRODUKTIV.Energie.05_Steckdosen_automatisch_ausschalten</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="d0RN^GYM%pz_(bl;*pER">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control_ex" id=":AkLTe4Vh{aVpzN$wLc#" inline="true">
<field name="TYPE">true</field>
<field name="CLEAR_RUNNING">FALSE</field>
<value name="OID">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="field_oid" id="GYP9CA$[U@8LvjL=eUnV">
<field name="oid">Object ID</field>
</shadow>
<block type="text" id=";-0^Br]DF~)L!feYM%-H">
<field name="TEXT">javascript.0.scriptEnabled.PRODUKTIV.Energie.05_Steckdosen_automatisch_ausschalten</field>
</block>
</value>
<value name="VALUE">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="logic_boolean" id="zN~Sjat4e$M4_Ql4|v$U">
<field name="BOOL">FALSE</field>
</shadow>
<block type="logic_boolean" id="jivlLuyr8[E*AV5+of}j">
<field name="BOOL">FALSE</field>
</block>
</value>
<value name="DELAY_MS">
<shadow type="math_number" id="!RtK-zkN:=T(AY9`2[`-">
<field name="NUM">0</field>
</shadow>
</value>
<next>
<block type="procedures_callnoreturn" id="QncciL-Xc3GoOjQgc|pr" inline="true">
<mutation name="log_info">
<arg name="log_info_text"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="!/4{L8?(Hk%oGoOrxmei">
<field name="TEXT">Deaktivere Skript zum Automatischen ausschalten der Steckdose.</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="comment" id="SiDX:1y||n)Qen%2xuI6">
<field name="COMMENT">Steckdose PC einschalten</field>
<next>
<block type="procedures_callnoreturn" id="f-aL+v4(Da8UU%BE8moK" inline="true">
<mutation name="schalteSteckdoseEin">
<arg name="oid"></arg>
<arg name="delay"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="G]@=^-5TftV!8k}eG~BA">
<field name="TEXT">linkeddevices.0.energie.steckdosen.pc_state</field>
</block>
</value>
<value name="ARG1">
<block type="math_number" id="afju.1])ktCO9pT]76?5">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id="8XvkH6YAZ3DyTZ/;:;Sf" inline="true">
<mutation name="log_info">
<arg name="log_info_text"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="n+JPzyJWl+6,iTiqN3j]">
<field name="TEXT">Steckdose PC war aus, wird eingeschaltet</field>
</block>
</value>
<next>
<block type="comment" id="mMzQ6626@p?263QmdiMd">
<field name="COMMENT">Sende WoL Paket</field>
<next>
<block type="timeouts_cleartimeout" id="URr+9wV(|G|pw]09~V5K">
<field name="NAME">sendeWoLDelay</field>
<next>
<block type="timeouts_settimeout" id="%0kKBloeWl)n}POlVQA/">
<field name="NAME">sendeWoLDelay</field>
<field name="DELAY">5000</field>
<field name="UNIT">ms</field>
<statement name="STATEMENT">
<block type="procedures_callnoreturn" id="BL4kjx!5laW26h#Iw{,V" inline="true">
<mutation name="wol">
<arg name="wol_ip"></arg>
<arg name="wol_mac"></arg>
<arg name="wol_hostname"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="s*gz7De|J?L3}q:z:4M#">
<field name="TEXT">10.1.1.2</field>
</block>
</value>
<value name="ARG1">
<block type="text" id="0ia3!xwjU^6qRw:U^i.7">
<field name="TEXT">0C:9D:92:84:86:49</field>
</block>
</value>
<value name="ARG2">
<block type="text" id=":AntnZxEe93PN3/v]w]~">
<field name="TEXT">thor</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="comment" id="l^r6Uxq(LH;G|5^;9$cO">
<field name="COMMENT">Steckdose = ein</field>
<next>
<block type="comment" id="%{!AQ0f5P}442!%H{+Tu">
<field name="COMMENT">Wenn ping auf thor = false, sende WoL</field>
<next>
<block type="controls_if" id="N=R=3Ub)5_m{~;-FH`+8">
<value name="IF0">
<block type="logic_compare" id="dX#Aov,4z_$~D8SNDCPU">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value_var" id="f.|7.#0CKU.*hOWR~!3$">
<field name="ATTR">val</field>
<value name="OID">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="Z./qfUsnHP4ooGLd.-*p">
<field name="TEXT">ping.0.iobroker-master.10_1_1_2</field>
</shadow>
<block type="text" id="x+:_CAx3MwVD9*?P0!0i">
<field name="TEXT">ping.0.thor</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_boolean" id=".GlNuVjHD.o7t7G1jDlv">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="procedures_callnoreturn" id="+hYC+#S@aCL|n/i-,]h[" inline="true">
<mutation name="wol">
<arg name="wol_ip"></arg>
<arg name="wol_mac"></arg>
<arg name="wol_hostname"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="+_=:lEol#~K2v~ctykU]">
<field name="TEXT">10.1.1.2</field>
</block>
</value>
<value name="ARG1">
<block type="text" id="hVmEddMQB3`!{L4yxQ5h">
<field name="TEXT">0C:9D:92:84:86:49</field>
</block>
</value>
<value name="ARG2">
<block type="text" id="V(;lGhdXn0TDP!|BcXNX">
<field name="TEXT">thor</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</xml>
Und wenn wir schon dabei sind, hier noch die Möglichkeit Windows per Remotezugriff zu steuern - also zb. herunterfahren:
Aus meiner Doku:
Registry Schlüssel erstellen:
reg ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
In der Windows Firewall
Eingehende Regel für Remoteherunterfahren (RPC-EP eingehend)
Eingehende Regel für Remoteherunterfahren (TCP eingehend)
Windows-Verwaltungsinstrumentation (WMI eingehend)
aktivieren.
Den Dienst “Remoteregistrierung” (automatisch) starten:
sc config RemoteRegistry start= auto
sc start RemoteRegistry
Dem Benutzer (habe dafür einen Benutzer 'iobroker' auf meinem Windows-System) das Recht (über secpol.msc):
Lokale Richtlinien > Zuweisen von Benutzerrechten > „Erzwingen des Herunterfahrens von einem Remotesystem aus“
erteilen und dem Benutzer die Gruppe
„Remoteverwaltungsbenutzer“
zuteilen.
Den Windows PC vom entfernten Gerät mit
Windows
shutdown -s -m \\IP
Linux
net rpc shutdown -I <IP> -U benutzer%password
herunterfahren.
Und das Skript dazu:
Blockly Win-Remote-Shutdown
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="@WATHdu%prdBNmQ;D(`j">log_info_text</variable>
<variable id="Vwt@2DYc5$66FbP;w.NC">ip</variable>
<variable id="AK#Z!#j;.?84ZpXF3.L;">user</variable>
<variable id="=ywqY_xQ1G2vVm$H9kEW">password</variable>
<variable id="@Rx5)VE,|H|,FBCrH4:L">error</variable>
<variable id="+~qvXTXYsqr5jkS2%jmm">result</variable>
</variables>
<block type="procedures_defnoreturn" id="8=]?c.DYLv5$S2h4JK}g" x="13" y="13">
<mutation>
<arg name="log_info_text" varid="@WATHdu%prdBNmQ;D(`j"></arg>
</mutation>
<field name="NAME">log_info</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="debug" id="z0~6NF:mNYZ42p;~R$cx" inline="true">
<field name="Severity">log</field>
<value name="TEXT">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="text">
<field name="TEXT">test</field>
</shadow>
<block type="text_join" id="X:hX@v/AX8V**+n{htG#" inline="true">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="text" id="=J!n%{}iQ[O_]O@,@pay">
<field name="TEXT">+++ </field>
</block>
</value>
<value name="ADD1">
<block type="text" id="(Wrd+z=g7d6fDE?kqb_.">
<field name="TEXT">Remote Herunterfahren </field>
</block>
</value>
<value name="ADD2">
<block type="variables_get" id="MU.l#t=T[`*AguX(WVe4">
<field name="VAR" id="@WATHdu%prdBNmQ;D(`j">log_info_text</field>
</block>
</value>
<value name="ADD3">
<block type="text" id="];MS8F*@p+3uz@]5#{|w">
<field name="TEXT"> +++</field>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" id="Zkg4Oy+/RcmN+YPZiFni" x="13" y="138">
<mutation>
<arg name="ip" varid="Vwt@2DYc5$66FbP;w.NC"></arg>
<arg name="user" varid="AK#Z!#j;.?84ZpXF3.L;"></arg>
<arg name="password" varid="=ywqY_xQ1G2vVm$H9kEW"></arg>
</mutation>
<field name="NAME">shutdown</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="exec" id="ez`TEX-yWSd=OPAjr1C}" inline="true">
<mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="true"></mutation>
<field name="WITH_STATEMENT">TRUE</field>
<field name="LOG">log</field>
<value name="COMMAND">
<shadow type="text" id="[|@V#C_FDcV?^hi4~S$6">
<field name="TEXT"></field>
</shadow>
<block type="text_join" id="[j%3$vQ~x)_JX-$m+k-l" inline="true">
<mutation items="7"></mutation>
<value name="ADD0">
<block type="text" id="FdgH4OY`lYy6MQ9/:_QD">
<field name="TEXT">/usr/bin/net </field>
</block>
</value>
<value name="ADD1">
<block type="text" id="c]n5r:ai3w1SpY6Mk}J[">
<field name="TEXT">rpc shutdown -f -t 0 -c "remote shutdown" -I </field>
</block>
</value>
<value name="ADD2">
<block type="variables_get" id="kKBk4I8_Of8^.fb:=rw0">
<field name="VAR" id="Vwt@2DYc5$66FbP;w.NC">ip</field>
</block>
</value>
<value name="ADD3">
<block type="text" id=")OE(PANMA4;OD7^{|zt!">
<field name="TEXT"> -U </field>
</block>
</value>
<value name="ADD4">
<block type="variables_get" id="h,Gwb2KS{I~gN/KLkqo0">
<field name="VAR" id="AK#Z!#j;.?84ZpXF3.L;">user</field>
</block>
</value>
<value name="ADD5">
<block type="text" id="pbI0GnL%cPaMj2v8n^J5">
<field name="TEXT">%</field>
</block>
</value>
<value name="ADD6">
<block type="variables_get" id=".`-895v?*ja(XW7Njh3#">
<field name="VAR" id="=ywqY_xQ1G2vVm$H9kEW">password</field>
</block>
</value>
</block>
</value>
<statement name="STATEMENT">
<block type="controls_if" id=";$p%*sm8kk6(R@YA:[Ug">
<mutation else="1"></mutation>
<value name="IF0">
<block type="variables_get" id="L{)=[KMNmylAz{k=3TBn">
<field name="VAR" id="@Rx5)VE,|H|,FBCrH4:L">error</field>
</block>
</value>
<statement name="DO0">
<block type="procedures_callnoreturn" id="lB%E*^#X([D64LV;?a-e" inline="true">
<mutation name="log_info">
<arg name="log_info_text"></arg>
</mutation>
<value name="ARG0">
<block type="text_join" id="D;Vw-6N|p%!UA`3FM*ll" inline="true">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="text" id="a?J]NK#(UJVg%lU5x?7y">
<field name="TEXT">Fehler beim ausfuehren von Remoter Herunterfahren fuer </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="~wo#[]b=G!Me@,f*k~$e">
<field name="VAR" id="Vwt@2DYc5$66FbP;w.NC">ip</field>
</block>
</value>
<value name="ADD2">
<block type="text_join" id="U+p9V+tlPOCpjZ%G:}yn">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="text" id="h8aTUf!s`U+OBypXAHAd">
<field name="TEXT">Fehler: </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="`7OtB+UGu5QO@]XD_[$s">
<field name="VAR" id="@Rx5)VE,|H|,FBCrH4:L">error</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="procedures_callnoreturn" id="sT)QeiW-g*eo!sPQ5OAj" inline="true">
<mutation name="log_info">
<arg name="log_info_text"></arg>
</mutation>
<value name="ARG0">
<block type="text_join" id="w_bnv)yKhGBh`5bPuN6*" inline="true">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="text" id="$a}5eZNq-d8w{3Zc;C.H">
<field name="TEXT">Remote Herunterfahren von </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="(f|C=jbHsUGL=3;yg#)!">
<field name="VAR" id="Vwt@2DYc5$66FbP;w.NC">ip</field>
</block>
</value>
<value name="ADD2">
<block type="text" id="@$TS^P)E_T}F*vJ5!!H9">
<field name="TEXT"> erfolgreich ausgefuerht: </field>
</block>
</value>
<value name="ADD3">
<block type="variables_get" id="#UN6uqb|ON@@%4?;$L5m">
<field name="VAR" id="+~qvXTXYsqr5jkS2%jmm">result</field>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
</statement>
</block>
</statement>
</block>
<block type="on_ext" id="EiIjbpQZq[]Zs%*REfNL" x="13" y="463">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">any</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="TH7^]~r.[{dOWh/`r3f/">
<field name="oid">default</field>
</shadow>
<block type="text" id="mZ[~tptu;9P4N3gfTAMO">
<field name="TEXT">javascript.0.System.remote.shutdown_thor</field>
</block>
</value>
<statement name="STATEMENT">
<block type="controls_if" id="2YhAW;X6laNU-ywuRArD">
<value name="IF0">
<block type="logic_compare" id="+2%XTo(1A)%I:V8CTvVD">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value_var" id="*=dJo5_+AtnjYKHH/+j~">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="text" id="Z`o^@C88OscSauJ@~7_T">
<field name="TEXT"></field>
</shadow>
<block type="text" id="p+E!)XD2:vY![~oZD4It">
<field name="TEXT">ping.0.thor</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="6{FtUFt]^Wd_v{)HS!Nx">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="procedures_callnoreturn" id="nu(nUu/5Xsb.Womi{~b~" inline="true">
<mutation name="shutdown">
<arg name="ip"></arg>
<arg name="user"></arg>
<arg name="password"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="U+24Xrf=ZmL#%#84_HB2">
<field name="TEXT">10.1.1.2</field>
</block>
</value>
<value name="ARG1">
<block type="text" id=")31aJ@FWp$!p;T|fhj}z">
<field name="TEXT">iobroker</field>
</block>
</value>
<value name="ARG2">
<block type="text" id="h5h~P$4a*C+w!BjajwT[">
<field name="TEXT">iobroker</field>
</block>
</value>
</block>
</statement>
</block>
</statement>
</block>
</xml>
DPs für die Skripte:
createState("System.WakeOnLAN.wol_thor", { name: 'Wake on LAN thor', "role": "button", "type": "mixed", "read": true, "write": true, "smartName": { "de": "Wake on LAN thor", "smartType": "SWITCH" } });
createState("System.remote.shutdown_thor", { name: 'shutdown_thor', "role": "button", "type": "mixed", "read": true, "write": true, "smartName": { "de": "thor herunterfahren", "smartType": "SWITCH" } });