Skip to content
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo
  1. ioBroker Community Home
  2. Deutsch
  3. ioBroker Allgemein
  4. Adapter: ioBroker.unifi

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.1k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.8k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.1k

Adapter: ioBroker.unifi

Geplant Angeheftet Gesperrt Verschoben ioBroker Allgemein
unifi
1.0k Beiträge 172 Kommentatoren 392.9k Aufrufe 93 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • Dr. BakteriusD Offline
    Dr. BakteriusD Offline
    Dr. Bakterius
    Most Active
    schrieb am zuletzt editiert von Dr. Bakterius
    #302

    Mir hat der Adapter auch zu viel Systemlast erzeugt. Ich brauche eigentlich nur die Info der übertragenen Byte (um daraus die aktuelle durchschnittliche Datenrate zu errechnen) und ob die beiden WAN-Schnittstellen ordnungsgemäß verbunden sind und welche verwendet wird (failsave). Dafür ist mir der Adapter zu aufgeblasen. Deswegen mache ich das jetzt mit einem Shell-Script ohne merklicher Systemlast.

    #!/bin/bash
    
    # Interface-Werte vom Unifi USG auslesen
     Erg=$(ssh *USER*@*USG-IP* '/opt/vyatta/bin/vyatta-op-cmd-wrapper show interfaces counters')
    
    # WAN1
    # Übertrage Bytes (Rx Tx)
     eth0_Bytes_Rx=$(echo "$Erg" | grep "eth0" | sed -e 's/ /\ /g' | awk '{print $3}')
     eth0_Bytes_Tx=$(echo "$Erg" | grep "eth0" | sed -e 's/ /\ /g' | awk '{print $5}')
    
    # WAN2
    # Übertrage Bytes (Rx Tx)
    eth2_Bytes_Rx=$(echo "$Erg" | grep "eth2" | sed -e 's/ /\ /g' | awk '{print $3}')
    eth2_Bytes_Tx=$(echo "$Erg" | grep "eth2" | sed -e 's/ /\ /g' | awk '{print $5}')
    
    # In Datenpunkte von ioBroker schreiben
     Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth0_Bytes_Rx)
     Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth0_Bytes_Tx)
     Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth2_Bytes_Rx)
     Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth2_Bytes_Tx)
    
    
    # Interface-Werte vom Unifi USG auslesen
     Erg2=$(ssh *USER*@*USG-IP*'/opt/vyatta/bin/vyatta-op-cmd-wrapper show load-balance status')
    
    # WAN1
    # Status Schnittstelle
     eth0_Status=$(echo "$Erg2" | grep "status" | sed -e 's/ /\ /g' | awk '{print $3}' | tr "\n" " " | sed -e 's/ /\ /g' | awk '{print $1}')
     eth0_Carrier=$(echo "$Erg2" | grep "carrier" | sed -e 's/ /\ /g' | awk '{print $3}' | tr "\n" " " | sed -e 's/ /\ /g' | awk '{print $1}')
     if [ "$eth0_Status" == "inactive" ] || [ "$eth0_Carrier" == "down" ];
     then
        eth0_Status="false"
     else
        eth0_Status="true"
     fi
    
    # WAN2
    # Status Schnittstelle
     eth2_Status=$(echo "$Erg2" | grep "status" | sed -e 's/ /\ /g' | awk '{print $3}' | tr "\n" " " | sed -e 's/ /\ /g' | awk '{print $2}')
     eth2_Carrier=$(echo "$Erg2" | grep "carrier" | sed -e 's/ /\ /g' | awk '{print $3}' | tr "\n" " " | sed -e 's/ /\ /g' | awk '{print $2}')
     if [ "$eth2_Status" == "inactive" ] || [ "$eth2_Carrier" == "down" ];
     then
        eth2_Status="false"
     else
        eth2_Status="true"
     fi
    
    # In Datenpunkte von ioBroker schreiben
     Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth0_Status)
     Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth2_Status)
    

    <xml xmlns="http://www.w3.org/1999/xhtml">
      <variables>
        <variable type="" id="Sh:,5JC@9t@w;]%@UxQV">Zeitstempel_alt</variable>
        <variable type="" id="4)^FI|7eZP:~|8@dl_}i">Rx_alt</variable>
        <variable type="" id="K1EWa[K6u([K4O7mUdeD">Tx_alt</variable>
        <variable type="" id="U5E{Gui(s~4G=k.GN:1;">Zeitstempel</variable>
        <variable type="" id="RpbuTH{(VZw@81!S)8AS">Rx</variable>
        <variable type="" id="q[(Kd7qbio8dO$z7F=[O">Tx</variable>
        <variable type="undefined" id="timeout">timeout</variable>
        <variable type="undefined" id="timeout2">timeout2</variable>
      </variables>
      <block type="variables_set" id="WZ^Eu@wnfBhs6HNq|e)X" x="63" y="38">
        <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
        <value name="VALUE">
          <block type="math_number" id="Lc|UH=NNY$ya0/C2U[#?">
            <field name="NUM">0</field>
          </block>
        </value>
        <next>
          <block type="variables_set" id="E:/.8;|Ltup$~|hq*JJ$">
            <field name="VAR" id="4)^FI|7eZP:~|8@dl_}i" variabletype="">Rx_alt</field>
            <value name="VALUE">
              <block type="math_number" id="y(4x;[XlO+s_Vr_Ln|=y">
                <field name="NUM">0</field>
              </block>
            </value>
            <next>
              <block type="variables_set" id="m5sJ4lph:VQ#TF!=RbMi">
                <field name="VAR" id="K1EWa[K6u([K4O7mUdeD" variabletype="">Tx_alt</field>
                <value name="VALUE">
                  <block type="math_number" id=";U@?sH1rhPI4~Wj1KlH-">
                    <field name="NUM">0</field>
                  </block>
                </value>
                <next>
                  <block type="on_ext" id="ZBQZzt6Ekixk]}hr?@IY">
                    <mutation items="1"></mutation>
                    <field name="CONDITION">any</field>
                    <field name="ACK_CONDITION"></field>
                    <value name="OID0">
                      <shadow type="field_oid" id=",?n~|Ft=xM|/SZlp$CjT">
                        <field name="oid">javascript.0.*DATENPUNKT*</field>
                      </shadow>
                    </value>
                    <statement name="STATEMENT">
                      <block type="comment" id="e*HlxXjd#M0N52xhB3{E">
                        <field name="COMMENT">aktuelle Werte ermitteln</field>
                        <next>
                          <block type="variables_set" id="j4RD5+a$9Mrf3#*8D.ZD">
                            <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                            <value name="VALUE">
                              <block type="time_get" id="Q+$572z#9dJ`jsjx%^}@">
                                <mutation format="false" language="false"></mutation>
                                <field name="OPTION">object</field>
                              </block>
                            </value>
                            <next>
                              <block type="variables_set" id="(G4$uZKqWxJ~^T7}YP},">
                                <field name="VAR" id="RpbuTH{(VZw@81!S)8AS" variabletype="">Rx</field>
                                <value name="VALUE">
                                  <block type="math_arithmetic" id="HqA8p/@cL=ZY8B`[`%pC">
                                    <field name="OP">ADD</field>
                                    <value name="A">
                                      <shadow type="math_number" id="2S7G/jD}Oi;^-2gOZYP(">
                                        <field name="NUM">1</field>
                                      </shadow>
                                      <block type="get_value" id="$[Lz:SYJW+T%y9ynqHRD">
                                        <field name="ATTR">val</field>
                                        <field name="OID">javascript.0.*DATENPUNKT*</field>
                                      </block>
                                    </value>
                                    <value name="B">
                                      <shadow type="math_number" id="3N;E4R4u!=6OE}G+:;r)">
                                        <field name="NUM">1</field>
                                      </shadow>
                                      <block type="get_value" id="aC3{9~M)hL4/sZtKOXJf">
                                        <field name="ATTR">val</field>
                                        <field name="OID">javascript.0.*DATENPUNKT*</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <next>
                                  <block type="variables_set" id="$%!xKlD*GTtBKp8h2$=z">
                                    <field name="VAR" id="q[(Kd7qbio8dO$z7F=[O" variabletype="">Tx</field>
                                    <value name="VALUE">
                                      <block type="math_arithmetic" id="Ph;B{wllpFXB7{3l[L9]">
                                        <field name="OP">ADD</field>
                                        <value name="A">
                                          <shadow type="math_number" id="2S7G/jD}Oi;^-2gOZYP(">
                                            <field name="NUM">1</field>
                                          </shadow>
                                          <block type="get_value" id="tpf8b]U8yD,S;C:zWR7b">
                                            <field name="ATTR">val</field>
                                            <field name="OID">javascript.0.*DATENPUNKT*</field>
                                          </block>
                                        </value>
                                        <value name="B">
                                          <shadow type="math_number" id="3N;E4R4u!=6OE}G+:;r)">
                                            <field name="NUM">1</field>
                                          </shadow>
                                          <block type="get_value" id=";{-+R+[s?Xdz#6N.G*K}">
                                            <field name="ATTR">val</field>
                                            <field name="OID">javascript.0.*DATENPUNKT*</field>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                    <next>
                                      <block type="comment" id=";[Oow]!Xc~a3))ca$UiU">
                                        <field name="COMMENT">Wenn der letzte Wert vor kurzem übertragen wurde</field>
                                        <next>
                                          <block type="controls_if" id="c:Ao5yGd;;+?-bjK2t}C">
                                            <mutation else="1"></mutation>
                                            <value name="IF0">
                                              <block type="logic_operation" id="7r46+{N?0g~9zTRr/i0I">
                                                <field name="OP">AND</field>
                                                <value name="A">
                                                  <block type="logic_compare" id="3R-M+H;/0uC([zE%D*g[">
                                                    <field name="OP">LT</field>
                                                    <value name="A">
                                                      <block type="math_arithmetic" id="Q/VW0*4RO6!{Sh]%*S6*">
                                                        <field name="OP">MINUS</field>
                                                        <value name="A">
                                                          <shadow type="math_number" id="C4Bk-M:tX8BG=V|dHroo">
                                                            <field name="NUM">1</field>
                                                          </shadow>
                                                          <block type="variables_get" id="V~eCRkFZob+rYt;aE;PL">
                                                            <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <shadow type="math_number" id="f,Q@+TqODW+b557p8H6|">
                                                            <field name="NUM">1</field>
                                                          </shadow>
                                                          <block type="variables_get" id="T3vi%U~=CLcbBs]Li+E`">
                                                            <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="uQ8dOD3MVm`krp5P[Mg!">
                                                        <field name="NUM">90000</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="logic_operation" id="i,4umy%b7lfBWEN9yl++" inline="false">
                                                    <field name="OP">AND</field>
                                                    <value name="A">
                                                      <block type="logic_compare" id="e3?U?ICb{6KpG)osljjS">
                                                        <field name="OP">GT</field>
                                                        <value name="A">
                                                          <block type="variables_get" id="8oM$[pyH,Irt*e~?E}P*">
                                                            <field name="VAR" id="RpbuTH{(VZw@81!S)8AS" variabletype="">Rx</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="variables_get" id="4(6c#nT6!BeLe,;+Rcl#">
                                                            <field name="VAR" id="4)^FI|7eZP:~|8@dl_}i" variabletype="">Rx_alt</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="logic_compare" id=";0xAPiyzkBDiwUkK7MkP">
                                                        <field name="OP">GT</field>
                                                        <value name="A">
                                                          <block type="variables_get" id="ODw@eyO:lR^C[l`A.$aQ">
                                                            <field name="VAR" id="q[(Kd7qbio8dO$z7F=[O" variabletype="">Tx</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="variables_get" id="_p9Ei+6/R|jdIp6IFG}c">
                                                            <field name="VAR" id="K1EWa[K6u([K4O7mUdeD" variabletype="">Tx_alt</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="comment" id=";w-?bTjH@^|:E-;:VBLo">
                                                <field name="COMMENT">Mb/s ausrechnen und Datenpunkte setzen</field>
                                                <next>
                                                  <block type="timeouts_cleartimeout" id="+]*qcF52dO~E~`/(2#bH">
                                                    <field name="NAME">timeout2</field>
                                                    <next>
                                                      <block type="control" id="O[nrm?:BQ!`T4GByBjYi">
                                                        <mutation delay_input="false"></mutation>
                                                        <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                        <value name="VALUE">
                                                          <shadow type="math_number" id="PvkrFp`0NUD61k|Fpd`Q">
                                                            <field name="NUM">3.1234</field>
                                                          </shadow>
                                                          <block type="math_round" id="4|/kaJ1k?xA^5v+zSF4w">
                                                            <field name="OP">ROUND</field>
                                                            <value name="NUM">
                                                              <shadow type="math_number" id="*Gp*(%{i[qVUt1[OS%(X">
                                                                <field name="NUM">3.1</field>
                                                              </shadow>
                                                              <block type="math_arithmetic" id="9mUkQl=FYLS]CL(C]Yz(">
                                                                <field name="OP">DIVIDE</field>
                                                                <value name="A">
                                                                  <shadow type="math_number" id="ml[|8`L!:SC.~P=Rd$.^">
                                                                    <field name="NUM">1</field>
                                                                  </shadow>
                                                                  <block type="math_arithmetic" id="Colj/6[=bUY0zhDl%6}?">
                                                                    <field name="OP">MULTIPLY</field>
                                                                    <value name="A">
                                                                      <shadow type="math_number" id="jNtW@Y:M@,HUCc5k.8jV">
                                                                        <field name="NUM">1</field>
                                                                      </shadow>
                                                                      <block type="math_arithmetic" id="mbQ(t9r4`t%d[{],|P)e">
                                                                        <field name="OP">DIVIDE</field>
                                                                        <value name="A">
                                                                          <shadow type="math_number" id="4#O?!T[X=o@rDg~X7-o}">
                                                                            <field name="NUM">1</field>
                                                                          </shadow>
                                                                          <block type="math_arithmetic" id="9``LsLG?i7p5(9Sp)dUj">
                                                                            <field name="OP">DIVIDE</field>
                                                                            <value name="A">
                                                                              <shadow type="math_number" id=".pvjEEiUAN(NJ)=eCt7r">
                                                                                <field name="NUM">1</field>
                                                                              </shadow>
                                                                              <block type="math_arithmetic" id="hnuA:rZH[|r(JE(?Wr~{">
                                                                                <field name="OP">MINUS</field>
                                                                                <value name="A">
                                                                                  <shadow type="math_number" id=",#y6X!:$Wqr_4son+Jw4">
                                                                                    <field name="NUM">1</field>
                                                                                  </shadow>
                                                                                  <block type="variables_get" id="qsF;hCz_aQg^Zj|tDL5{">
                                                                                    <field name="VAR" id="RpbuTH{(VZw@81!S)8AS" variabletype="">Rx</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="B">
                                                                                  <shadow type="math_number" id="NwDUgGmZ6L,r;cu/in/o">
                                                                                    <field name="NUM">1</field>
                                                                                  </shadow>
                                                                                  <block type="variables_get" id="kqW`/PL/?lBqmMhQ:L3e">
                                                                                    <field name="VAR" id="4)^FI|7eZP:~|8@dl_}i" variabletype="">Rx_alt</field>
                                                                                  </block>
                                                                                </value>
                                                                              </block>
                                                                            </value>
                                                                            <value name="B">
                                                                              <shadow type="math_number" id="KLGu]3wUoqNPQ2R^mjhg">
                                                                                <field name="NUM">1024</field>
                                                                              </shadow>
                                                                            </value>
                                                                          </block>
                                                                        </value>
                                                                        <value name="B">
                                                                          <shadow type="math_number" id="UsZr}?mgU(uI8^ENg2}L">
                                                                            <field name="NUM">1024</field>
                                                                          </shadow>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                    <value name="B">
                                                                      <shadow type="math_number" id="*k9A~[UUPnM~x%?nZJ9I">
                                                                        <field name="NUM">8</field>
                                                                      </shadow>
                                                                    </value>
                                                                  </block>
                                                                </value>
                                                                <value name="B">
                                                                  <shadow type="math_number" id="=;?ojD;3l|O#vgEB0Lc?">
                                                                    <field name="NUM">1</field>
                                                                  </shadow>
                                                                  <block type="math_arithmetic" id="2Ab:%ctpidA=Vy*AUA@j">
                                                                    <field name="OP">DIVIDE</field>
                                                                    <value name="A">
                                                                      <shadow type="math_number" id="H-(V0ncSB7L1cFOn|qgH">
                                                                        <field name="NUM">1</field>
                                                                      </shadow>
                                                                      <block type="math_arithmetic" id="Enb{gbjT)6EUt+}GsxVV">
                                                                        <field name="OP">MINUS</field>
                                                                        <value name="A">
                                                                          <shadow type="math_number" id=",#y6X!:$Wqr_4son+Jw4">
                                                                            <field name="NUM">1</field>
                                                                          </shadow>
                                                                          <block type="variables_get" id="2@//XN?:3RGe1ajE#Pxc">
                                                                            <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                                                                          </block>
                                                                        </value>
                                                                        <value name="B">
                                                                          <shadow type="math_number" id="NwDUgGmZ6L,r;cu/in/o">
                                                                            <field name="NUM">1</field>
                                                                          </shadow>
                                                                          <block type="variables_get" id="g]K#m*/+C[EM=Do~$d_%">
                                                                            <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                    <value name="B">
                                                                      <shadow type="math_number" id="dgd|ZX^0A;+xPOVk|gNz">
                                                                        <field name="NUM">1000</field>
                                                                      </shadow>
                                                                    </value>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="control" id="F!F?ERTEF0ZcAx/nR[1R">
                                                            <mutation delay_input="false"></mutation>
                                                            <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                            <field name="WITH_DELAY">FALSE</field>
                                                            <value name="VALUE">
                                                              <shadow type="math_number" id="N$v!CF%_0wWK/|Q{7Sts">
                                                                <field name="NUM">3.1234</field>
                                                              </shadow>
                                                              <block type="math_round" id="b-uq_yAA]PA#I4S.cIJA">
                                                                <field name="OP">ROUND</field>
                                                                <value name="NUM">
                                                                  <shadow type="math_number" id="~eRNsGFxbk7yF0WQWjJM">
                                                                    <field name="NUM">3.1</field>
                                                                  </shadow>
                                                                  <block type="math_arithmetic" id=":L7}Ta3jYmc/xyRgEE,#">
                                                                    <field name="OP">DIVIDE</field>
                                                                    <value name="A">
                                                                      <shadow type="math_number" id="ml[|8`L!:SC.~P=Rd$.^">
                                                                        <field name="NUM">1</field>
                                                                      </shadow>
                                                                      <block type="math_arithmetic" id="j|5jW[g=.WcpYKEnq8I}">
                                                                        <field name="OP">MULTIPLY</field>
                                                                        <value name="A">
                                                                          <shadow type="math_number" id="jNtW@Y:M@,HUCc5k.8jV">
                                                                            <field name="NUM">1</field>
                                                                          </shadow>
                                                                          <block type="math_arithmetic" id="-$P$X9;QQDULzFJi@xt)">
                                                                            <field name="OP">DIVIDE</field>
                                                                            <value name="A">
                                                                              <shadow type="math_number" id="4#O?!T[X=o@rDg~X7-o}">
                                                                                <field name="NUM">1</field>
                                                                              </shadow>
                                                                              <block type="math_arithmetic" id="Gm`ARxpR3p@}QhpBhhpY">
                                                                                <field name="OP">DIVIDE</field>
                                                                                <value name="A">
                                                                                  <shadow type="math_number" id=".pvjEEiUAN(NJ)=eCt7r">
                                                                                    <field name="NUM">1</field>
                                                                                  </shadow>
                                                                                  <block type="math_arithmetic" id="1vI{FSl)lyE/v6t0TDcy">
                                                                                    <field name="OP">MINUS</field>
                                                                                    <value name="A">
                                                                                      <shadow type="math_number" id=",#y6X!:$Wqr_4son+Jw4">
                                                                                        <field name="NUM">1</field>
                                                                                      </shadow>
                                                                                      <block type="variables_get" id="*MZT.|#bOKZqIT}1}jiH">
                                                                                        <field name="VAR" id="q[(Kd7qbio8dO$z7F=[O" variabletype="">Tx</field>
                                                                                      </block>
                                                                                    </value>
                                                                                    <value name="B">
                                                                                      <shadow type="math_number" id="NwDUgGmZ6L,r;cu/in/o">
                                                                                        <field name="NUM">1</field>
                                                                                      </shadow>
                                                                                      <block type="variables_get" id="A2wgE`A6a6bNC@C|qW^i">
                                                                                        <field name="VAR" id="K1EWa[K6u([K4O7mUdeD" variabletype="">Tx_alt</field>
                                                                                      </block>
                                                                                    </value>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="B">
                                                                                  <shadow type="math_number" id="ezPBP`zuFZTO)K}17oZa">
                                                                                    <field name="NUM">1024</field>
                                                                                  </shadow>
                                                                                </value>
                                                                              </block>
                                                                            </value>
                                                                            <value name="B">
                                                                              <shadow type="math_number" id="IAaDPy)6g6W.A#1jKWvZ">
                                                                                <field name="NUM">1024</field>
                                                                              </shadow>
                                                                            </value>
                                                                          </block>
                                                                        </value>
                                                                        <value name="B">
                                                                          <shadow type="math_number" id="n4O#)N61F/JX]4THh-rN">
                                                                            <field name="NUM">8</field>
                                                                          </shadow>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                    <value name="B">
                                                                      <shadow type="math_number" id="{L^ITqJqC5LcX!O?_c+6">
                                                                        <field name="NUM">1</field>
                                                                      </shadow>
                                                                      <block type="math_arithmetic" id="X|B-!:r,`J{0w8nwe%zn">
                                                                        <field name="OP">DIVIDE</field>
                                                                        <value name="A">
                                                                          <shadow type="math_number" id="H-(V0ncSB7L1cFOn|qgH">
                                                                            <field name="NUM">1</field>
                                                                          </shadow>
                                                                          <block type="math_arithmetic" id="$cDa.hRem~YXH#82~s7]">
                                                                            <field name="OP">MINUS</field>
                                                                            <value name="A">
                                                                              <shadow type="math_number" id=",#y6X!:$Wqr_4son+Jw4">
                                                                                <field name="NUM">1</field>
                                                                              </shadow>
                                                                              <block type="variables_get" id="E(tfp;)jn@E})xfA;zsr">
                                                                                <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                                                                              </block>
                                                                            </value>
                                                                            <value name="B">
                                                                              <shadow type="math_number" id="NwDUgGmZ6L,r;cu/in/o">
                                                                                <field name="NUM">1</field>
                                                                              </shadow>
                                                                              <block type="variables_get" id="8=(RAP.HNQN+Tux)5x`6">
                                                                                <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
                                                                              </block>
                                                                            </value>
                                                                          </block>
                                                                        </value>
                                                                        <value name="B">
                                                                          <shadow type="math_number" id="}]Y8RyL6ciu?Q:U``*Bk">
                                                                            <field name="NUM">1000</field>
                                                                          </shadow>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </statement>
                                            <statement name="ELSE">
                                              <block type="control" id="JthKIo:|$%,#gA4[N?eP">
                                                <mutation delay_input="false"></mutation>
                                                <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="math_number" id="j{/,M/Z,V/@cB8%rNs*{">
                                                    <field name="NUM">0</field>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="control" id="M*NBd0;__8?bLuzEv4MB">
                                                    <mutation delay_input="false"></mutation>
                                                    <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                    <field name="WITH_DELAY">FALSE</field>
                                                    <value name="VALUE">
                                                      <block type="math_number" id="h!T,]YTj1aeE%)QNuG4S">
                                                        <field name="NUM">0</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </next>
                                              </block>
                                            </statement>
                                            <next>
                                              <block type="timeouts_settimeout" id="hR-P}I]4z~wMO*}+v]DU">
                                                <field name="NAME">timeout</field>
                                                <field name="DELAY">10</field>
                                                <field name="UNIT">sec</field>
                                                <statement name="STATEMENT">
                                                  <block type="variables_set" id="9C8fbHULfc}n.EY9|$EQ">
                                                    <field name="VAR" id="4)^FI|7eZP:~|8@dl_}i" variabletype="">Rx_alt</field>
                                                    <value name="VALUE">
                                                      <block type="variables_get" id="lly)n/86vzcayF7YKK1X">
                                                        <field name="VAR" id="RpbuTH{(VZw@81!S)8AS" variabletype="">Rx</field>
                                                      </block>
                                                    </value>
                                                    <next>
                                                      <block type="variables_set" id="r?yY8]4w];-^}r[P4*2r">
                                                        <field name="VAR" id="K1EWa[K6u([K4O7mUdeD" variabletype="">Tx_alt</field>
                                                        <value name="VALUE">
                                                          <block type="variables_get" id="oi^AbN%Iv8kK1w^IU9Ez">
                                                            <field name="VAR" id="q[(Kd7qbio8dO$z7F=[O" variabletype="">Tx</field>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="variables_set" id=";v9kuQR`xV8YnWdx#(WG">
                                                            <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
                                                            <value name="VALUE">
                                                              <block type="variables_get" id="Ex#FQ|(`Ba2A98lsue30">
                                                                <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                                                              </block>
                                                            </value>
                                                            <next>
                                                              <block type="timeouts_settimeout" id="+6XM-Y*YbePlV[J)N!B8">
                                                                <field name="NAME">timeout2</field>
                                                                <field name="DELAY">81</field>
                                                                <field name="UNIT">sec</field>
                                                                <statement name="STATEMENT">
                                                                  <block type="control" id="R7uyP?$t%M4q^F6W}iIu">
                                                                    <mutation delay_input="false"></mutation>
                                                                    <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                                    <field name="WITH_DELAY">FALSE</field>
                                                                    <value name="VALUE">
                                                                      <block type="math_number" id="85-8AwWcTVobJJbPq8rI">
                                                                        <field name="NUM">0</field>
                                                                      </block>
                                                                    </value>
                                                                    <next>
                                                                      <block type="control" id="l[`)PxToGV`AWQaaAec3">
                                                                        <mutation delay_input="false"></mutation>
                                                                        <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                                        <field name="WITH_DELAY">FALSE</field>
                                                                        <value name="VALUE">
                                                                          <block type="math_number" id="L:hvmPPt;GGm^`|cg67U">
                                                                            <field name="NUM">0</field>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </next>
                                                                  </block>
                                                                </statement>
                                                              </block>
                                                            </next>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </statement>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </statement>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </next>
      </block>
    </xml>
    

    dslraserD 1 Antwort Letzte Antwort
    0
    • Dr. BakteriusD Dr. Bakterius

      Mir hat der Adapter auch zu viel Systemlast erzeugt. Ich brauche eigentlich nur die Info der übertragenen Byte (um daraus die aktuelle durchschnittliche Datenrate zu errechnen) und ob die beiden WAN-Schnittstellen ordnungsgemäß verbunden sind und welche verwendet wird (failsave). Dafür ist mir der Adapter zu aufgeblasen. Deswegen mache ich das jetzt mit einem Shell-Script ohne merklicher Systemlast.

      #!/bin/bash
      
      # Interface-Werte vom Unifi USG auslesen
       Erg=$(ssh *USER*@*USG-IP* '/opt/vyatta/bin/vyatta-op-cmd-wrapper show interfaces counters')
      
      # WAN1
      # Übertrage Bytes (Rx Tx)
       eth0_Bytes_Rx=$(echo "$Erg" | grep "eth0" | sed -e 's/ /\ /g' | awk '{print $3}')
       eth0_Bytes_Tx=$(echo "$Erg" | grep "eth0" | sed -e 's/ /\ /g' | awk '{print $5}')
      
      # WAN2
      # Übertrage Bytes (Rx Tx)
      eth2_Bytes_Rx=$(echo "$Erg" | grep "eth2" | sed -e 's/ /\ /g' | awk '{print $3}')
      eth2_Bytes_Tx=$(echo "$Erg" | grep "eth2" | sed -e 's/ /\ /g' | awk '{print $5}')
      
      # In Datenpunkte von ioBroker schreiben
       Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth0_Bytes_Rx)
       Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth0_Bytes_Tx)
       Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth2_Bytes_Rx)
       Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth2_Bytes_Tx)
      
      
      # Interface-Werte vom Unifi USG auslesen
       Erg2=$(ssh *USER*@*USG-IP*'/opt/vyatta/bin/vyatta-op-cmd-wrapper show load-balance status')
      
      # WAN1
      # Status Schnittstelle
       eth0_Status=$(echo "$Erg2" | grep "status" | sed -e 's/ /\ /g' | awk '{print $3}' | tr "\n" " " | sed -e 's/ /\ /g' | awk '{print $1}')
       eth0_Carrier=$(echo "$Erg2" | grep "carrier" | sed -e 's/ /\ /g' | awk '{print $3}' | tr "\n" " " | sed -e 's/ /\ /g' | awk '{print $1}')
       if [ "$eth0_Status" == "inactive" ] || [ "$eth0_Carrier" == "down" ];
       then
          eth0_Status="false"
       else
          eth0_Status="true"
       fi
      
      # WAN2
      # Status Schnittstelle
       eth2_Status=$(echo "$Erg2" | grep "status" | sed -e 's/ /\ /g' | awk '{print $3}' | tr "\n" " " | sed -e 's/ /\ /g' | awk '{print $2}')
       eth2_Carrier=$(echo "$Erg2" | grep "carrier" | sed -e 's/ /\ /g' | awk '{print $3}' | tr "\n" " " | sed -e 's/ /\ /g' | awk '{print $2}')
       if [ "$eth2_Status" == "inactive" ] || [ "$eth2_Carrier" == "down" ];
       then
          eth2_Status="false"
       else
          eth2_Status="true"
       fi
      
      # In Datenpunkte von ioBroker schreiben
       Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth0_Status)
       Erg=$(curl -s http://*IOBROKER-IP*:8082/set/javascript.0.*DATENPUNKT*?value=$eth2_Status)
      

      <xml xmlns="http://www.w3.org/1999/xhtml">
        <variables>
          <variable type="" id="Sh:,5JC@9t@w;]%@UxQV">Zeitstempel_alt</variable>
          <variable type="" id="4)^FI|7eZP:~|8@dl_}i">Rx_alt</variable>
          <variable type="" id="K1EWa[K6u([K4O7mUdeD">Tx_alt</variable>
          <variable type="" id="U5E{Gui(s~4G=k.GN:1;">Zeitstempel</variable>
          <variable type="" id="RpbuTH{(VZw@81!S)8AS">Rx</variable>
          <variable type="" id="q[(Kd7qbio8dO$z7F=[O">Tx</variable>
          <variable type="undefined" id="timeout">timeout</variable>
          <variable type="undefined" id="timeout2">timeout2</variable>
        </variables>
        <block type="variables_set" id="WZ^Eu@wnfBhs6HNq|e)X" x="63" y="38">
          <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
          <value name="VALUE">
            <block type="math_number" id="Lc|UH=NNY$ya0/C2U[#?">
              <field name="NUM">0</field>
            </block>
          </value>
          <next>
            <block type="variables_set" id="E:/.8;|Ltup$~|hq*JJ$">
              <field name="VAR" id="4)^FI|7eZP:~|8@dl_}i" variabletype="">Rx_alt</field>
              <value name="VALUE">
                <block type="math_number" id="y(4x;[XlO+s_Vr_Ln|=y">
                  <field name="NUM">0</field>
                </block>
              </value>
              <next>
                <block type="variables_set" id="m5sJ4lph:VQ#TF!=RbMi">
                  <field name="VAR" id="K1EWa[K6u([K4O7mUdeD" variabletype="">Tx_alt</field>
                  <value name="VALUE">
                    <block type="math_number" id=";U@?sH1rhPI4~Wj1KlH-">
                      <field name="NUM">0</field>
                    </block>
                  </value>
                  <next>
                    <block type="on_ext" id="ZBQZzt6Ekixk]}hr?@IY">
                      <mutation items="1"></mutation>
                      <field name="CONDITION">any</field>
                      <field name="ACK_CONDITION"></field>
                      <value name="OID0">
                        <shadow type="field_oid" id=",?n~|Ft=xM|/SZlp$CjT">
                          <field name="oid">javascript.0.*DATENPUNKT*</field>
                        </shadow>
                      </value>
                      <statement name="STATEMENT">
                        <block type="comment" id="e*HlxXjd#M0N52xhB3{E">
                          <field name="COMMENT">aktuelle Werte ermitteln</field>
                          <next>
                            <block type="variables_set" id="j4RD5+a$9Mrf3#*8D.ZD">
                              <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                              <value name="VALUE">
                                <block type="time_get" id="Q+$572z#9dJ`jsjx%^}@">
                                  <mutation format="false" language="false"></mutation>
                                  <field name="OPTION">object</field>
                                </block>
                              </value>
                              <next>
                                <block type="variables_set" id="(G4$uZKqWxJ~^T7}YP},">
                                  <field name="VAR" id="RpbuTH{(VZw@81!S)8AS" variabletype="">Rx</field>
                                  <value name="VALUE">
                                    <block type="math_arithmetic" id="HqA8p/@cL=ZY8B`[`%pC">
                                      <field name="OP">ADD</field>
                                      <value name="A">
                                        <shadow type="math_number" id="2S7G/jD}Oi;^-2gOZYP(">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="get_value" id="$[Lz:SYJW+T%y9ynqHRD">
                                          <field name="ATTR">val</field>
                                          <field name="OID">javascript.0.*DATENPUNKT*</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <shadow type="math_number" id="3N;E4R4u!=6OE}G+:;r)">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="get_value" id="aC3{9~M)hL4/sZtKOXJf">
                                          <field name="ATTR">val</field>
                                          <field name="OID">javascript.0.*DATENPUNKT*</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="variables_set" id="$%!xKlD*GTtBKp8h2$=z">
                                      <field name="VAR" id="q[(Kd7qbio8dO$z7F=[O" variabletype="">Tx</field>
                                      <value name="VALUE">
                                        <block type="math_arithmetic" id="Ph;B{wllpFXB7{3l[L9]">
                                          <field name="OP">ADD</field>
                                          <value name="A">
                                            <shadow type="math_number" id="2S7G/jD}Oi;^-2gOZYP(">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="get_value" id="tpf8b]U8yD,S;C:zWR7b">
                                              <field name="ATTR">val</field>
                                              <field name="OID">javascript.0.*DATENPUNKT*</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number" id="3N;E4R4u!=6OE}G+:;r)">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="get_value" id=";{-+R+[s?Xdz#6N.G*K}">
                                              <field name="ATTR">val</field>
                                              <field name="OID">javascript.0.*DATENPUNKT*</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="comment" id=";[Oow]!Xc~a3))ca$UiU">
                                          <field name="COMMENT">Wenn der letzte Wert vor kurzem übertragen wurde</field>
                                          <next>
                                            <block type="controls_if" id="c:Ao5yGd;;+?-bjK2t}C">
                                              <mutation else="1"></mutation>
                                              <value name="IF0">
                                                <block type="logic_operation" id="7r46+{N?0g~9zTRr/i0I">
                                                  <field name="OP">AND</field>
                                                  <value name="A">
                                                    <block type="logic_compare" id="3R-M+H;/0uC([zE%D*g[">
                                                      <field name="OP">LT</field>
                                                      <value name="A">
                                                        <block type="math_arithmetic" id="Q/VW0*4RO6!{Sh]%*S6*">
                                                          <field name="OP">MINUS</field>
                                                          <value name="A">
                                                            <shadow type="math_number" id="C4Bk-M:tX8BG=V|dHroo">
                                                              <field name="NUM">1</field>
                                                            </shadow>
                                                            <block type="variables_get" id="V~eCRkFZob+rYt;aE;PL">
                                                              <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                                                            </block>
                                                          </value>
                                                          <value name="B">
                                                            <shadow type="math_number" id="f,Q@+TqODW+b557p8H6|">
                                                              <field name="NUM">1</field>
                                                            </shadow>
                                                            <block type="variables_get" id="T3vi%U~=CLcbBs]Li+E`">
                                                              <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <block type="math_number" id="uQ8dOD3MVm`krp5P[Mg!">
                                                          <field name="NUM">90000</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                  <value name="B">
                                                    <block type="logic_operation" id="i,4umy%b7lfBWEN9yl++" inline="false">
                                                      <field name="OP">AND</field>
                                                      <value name="A">
                                                        <block type="logic_compare" id="e3?U?ICb{6KpG)osljjS">
                                                          <field name="OP">GT</field>
                                                          <value name="A">
                                                            <block type="variables_get" id="8oM$[pyH,Irt*e~?E}P*">
                                                              <field name="VAR" id="RpbuTH{(VZw@81!S)8AS" variabletype="">Rx</field>
                                                            </block>
                                                          </value>
                                                          <value name="B">
                                                            <block type="variables_get" id="4(6c#nT6!BeLe,;+Rcl#">
                                                              <field name="VAR" id="4)^FI|7eZP:~|8@dl_}i" variabletype="">Rx_alt</field>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <block type="logic_compare" id=";0xAPiyzkBDiwUkK7MkP">
                                                          <field name="OP">GT</field>
                                                          <value name="A">
                                                            <block type="variables_get" id="ODw@eyO:lR^C[l`A.$aQ">
                                                              <field name="VAR" id="q[(Kd7qbio8dO$z7F=[O" variabletype="">Tx</field>
                                                            </block>
                                                          </value>
                                                          <value name="B">
                                                            <block type="variables_get" id="_p9Ei+6/R|jdIp6IFG}c">
                                                              <field name="VAR" id="K1EWa[K6u([K4O7mUdeD" variabletype="">Tx_alt</field>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                              <statement name="DO0">
                                                <block type="comment" id=";w-?bTjH@^|:E-;:VBLo">
                                                  <field name="COMMENT">Mb/s ausrechnen und Datenpunkte setzen</field>
                                                  <next>
                                                    <block type="timeouts_cleartimeout" id="+]*qcF52dO~E~`/(2#bH">
                                                      <field name="NAME">timeout2</field>
                                                      <next>
                                                        <block type="control" id="O[nrm?:BQ!`T4GByBjYi">
                                                          <mutation delay_input="false"></mutation>
                                                          <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                          <field name="WITH_DELAY">FALSE</field>
                                                          <value name="VALUE">
                                                            <shadow type="math_number" id="PvkrFp`0NUD61k|Fpd`Q">
                                                              <field name="NUM">3.1234</field>
                                                            </shadow>
                                                            <block type="math_round" id="4|/kaJ1k?xA^5v+zSF4w">
                                                              <field name="OP">ROUND</field>
                                                              <value name="NUM">
                                                                <shadow type="math_number" id="*Gp*(%{i[qVUt1[OS%(X">
                                                                  <field name="NUM">3.1</field>
                                                                </shadow>
                                                                <block type="math_arithmetic" id="9mUkQl=FYLS]CL(C]Yz(">
                                                                  <field name="OP">DIVIDE</field>
                                                                  <value name="A">
                                                                    <shadow type="math_number" id="ml[|8`L!:SC.~P=Rd$.^">
                                                                      <field name="NUM">1</field>
                                                                    </shadow>
                                                                    <block type="math_arithmetic" id="Colj/6[=bUY0zhDl%6}?">
                                                                      <field name="OP">MULTIPLY</field>
                                                                      <value name="A">
                                                                        <shadow type="math_number" id="jNtW@Y:M@,HUCc5k.8jV">
                                                                          <field name="NUM">1</field>
                                                                        </shadow>
                                                                        <block type="math_arithmetic" id="mbQ(t9r4`t%d[{],|P)e">
                                                                          <field name="OP">DIVIDE</field>
                                                                          <value name="A">
                                                                            <shadow type="math_number" id="4#O?!T[X=o@rDg~X7-o}">
                                                                              <field name="NUM">1</field>
                                                                            </shadow>
                                                                            <block type="math_arithmetic" id="9``LsLG?i7p5(9Sp)dUj">
                                                                              <field name="OP">DIVIDE</field>
                                                                              <value name="A">
                                                                                <shadow type="math_number" id=".pvjEEiUAN(NJ)=eCt7r">
                                                                                  <field name="NUM">1</field>
                                                                                </shadow>
                                                                                <block type="math_arithmetic" id="hnuA:rZH[|r(JE(?Wr~{">
                                                                                  <field name="OP">MINUS</field>
                                                                                  <value name="A">
                                                                                    <shadow type="math_number" id=",#y6X!:$Wqr_4son+Jw4">
                                                                                      <field name="NUM">1</field>
                                                                                    </shadow>
                                                                                    <block type="variables_get" id="qsF;hCz_aQg^Zj|tDL5{">
                                                                                      <field name="VAR" id="RpbuTH{(VZw@81!S)8AS" variabletype="">Rx</field>
                                                                                    </block>
                                                                                  </value>
                                                                                  <value name="B">
                                                                                    <shadow type="math_number" id="NwDUgGmZ6L,r;cu/in/o">
                                                                                      <field name="NUM">1</field>
                                                                                    </shadow>
                                                                                    <block type="variables_get" id="kqW`/PL/?lBqmMhQ:L3e">
                                                                                      <field name="VAR" id="4)^FI|7eZP:~|8@dl_}i" variabletype="">Rx_alt</field>
                                                                                    </block>
                                                                                  </value>
                                                                                </block>
                                                                              </value>
                                                                              <value name="B">
                                                                                <shadow type="math_number" id="KLGu]3wUoqNPQ2R^mjhg">
                                                                                  <field name="NUM">1024</field>
                                                                                </shadow>
                                                                              </value>
                                                                            </block>
                                                                          </value>
                                                                          <value name="B">
                                                                            <shadow type="math_number" id="UsZr}?mgU(uI8^ENg2}L">
                                                                              <field name="NUM">1024</field>
                                                                            </shadow>
                                                                          </value>
                                                                        </block>
                                                                      </value>
                                                                      <value name="B">
                                                                        <shadow type="math_number" id="*k9A~[UUPnM~x%?nZJ9I">
                                                                          <field name="NUM">8</field>
                                                                        </shadow>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                  <value name="B">
                                                                    <shadow type="math_number" id="=;?ojD;3l|O#vgEB0Lc?">
                                                                      <field name="NUM">1</field>
                                                                    </shadow>
                                                                    <block type="math_arithmetic" id="2Ab:%ctpidA=Vy*AUA@j">
                                                                      <field name="OP">DIVIDE</field>
                                                                      <value name="A">
                                                                        <shadow type="math_number" id="H-(V0ncSB7L1cFOn|qgH">
                                                                          <field name="NUM">1</field>
                                                                        </shadow>
                                                                        <block type="math_arithmetic" id="Enb{gbjT)6EUt+}GsxVV">
                                                                          <field name="OP">MINUS</field>
                                                                          <value name="A">
                                                                            <shadow type="math_number" id=",#y6X!:$Wqr_4son+Jw4">
                                                                              <field name="NUM">1</field>
                                                                            </shadow>
                                                                            <block type="variables_get" id="2@//XN?:3RGe1ajE#Pxc">
                                                                              <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                                                                            </block>
                                                                          </value>
                                                                          <value name="B">
                                                                            <shadow type="math_number" id="NwDUgGmZ6L,r;cu/in/o">
                                                                              <field name="NUM">1</field>
                                                                            </shadow>
                                                                            <block type="variables_get" id="g]K#m*/+C[EM=Do~$d_%">
                                                                              <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
                                                                            </block>
                                                                          </value>
                                                                        </block>
                                                                      </value>
                                                                      <value name="B">
                                                                        <shadow type="math_number" id="dgd|ZX^0A;+xPOVk|gNz">
                                                                          <field name="NUM">1000</field>
                                                                        </shadow>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </value>
                                                          <next>
                                                            <block type="control" id="F!F?ERTEF0ZcAx/nR[1R">
                                                              <mutation delay_input="false"></mutation>
                                                              <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                              <field name="WITH_DELAY">FALSE</field>
                                                              <value name="VALUE">
                                                                <shadow type="math_number" id="N$v!CF%_0wWK/|Q{7Sts">
                                                                  <field name="NUM">3.1234</field>
                                                                </shadow>
                                                                <block type="math_round" id="b-uq_yAA]PA#I4S.cIJA">
                                                                  <field name="OP">ROUND</field>
                                                                  <value name="NUM">
                                                                    <shadow type="math_number" id="~eRNsGFxbk7yF0WQWjJM">
                                                                      <field name="NUM">3.1</field>
                                                                    </shadow>
                                                                    <block type="math_arithmetic" id=":L7}Ta3jYmc/xyRgEE,#">
                                                                      <field name="OP">DIVIDE</field>
                                                                      <value name="A">
                                                                        <shadow type="math_number" id="ml[|8`L!:SC.~P=Rd$.^">
                                                                          <field name="NUM">1</field>
                                                                        </shadow>
                                                                        <block type="math_arithmetic" id="j|5jW[g=.WcpYKEnq8I}">
                                                                          <field name="OP">MULTIPLY</field>
                                                                          <value name="A">
                                                                            <shadow type="math_number" id="jNtW@Y:M@,HUCc5k.8jV">
                                                                              <field name="NUM">1</field>
                                                                            </shadow>
                                                                            <block type="math_arithmetic" id="-$P$X9;QQDULzFJi@xt)">
                                                                              <field name="OP">DIVIDE</field>
                                                                              <value name="A">
                                                                                <shadow type="math_number" id="4#O?!T[X=o@rDg~X7-o}">
                                                                                  <field name="NUM">1</field>
                                                                                </shadow>
                                                                                <block type="math_arithmetic" id="Gm`ARxpR3p@}QhpBhhpY">
                                                                                  <field name="OP">DIVIDE</field>
                                                                                  <value name="A">
                                                                                    <shadow type="math_number" id=".pvjEEiUAN(NJ)=eCt7r">
                                                                                      <field name="NUM">1</field>
                                                                                    </shadow>
                                                                                    <block type="math_arithmetic" id="1vI{FSl)lyE/v6t0TDcy">
                                                                                      <field name="OP">MINUS</field>
                                                                                      <value name="A">
                                                                                        <shadow type="math_number" id=",#y6X!:$Wqr_4son+Jw4">
                                                                                          <field name="NUM">1</field>
                                                                                        </shadow>
                                                                                        <block type="variables_get" id="*MZT.|#bOKZqIT}1}jiH">
                                                                                          <field name="VAR" id="q[(Kd7qbio8dO$z7F=[O" variabletype="">Tx</field>
                                                                                        </block>
                                                                                      </value>
                                                                                      <value name="B">
                                                                                        <shadow type="math_number" id="NwDUgGmZ6L,r;cu/in/o">
                                                                                          <field name="NUM">1</field>
                                                                                        </shadow>
                                                                                        <block type="variables_get" id="A2wgE`A6a6bNC@C|qW^i">
                                                                                          <field name="VAR" id="K1EWa[K6u([K4O7mUdeD" variabletype="">Tx_alt</field>
                                                                                        </block>
                                                                                      </value>
                                                                                    </block>
                                                                                  </value>
                                                                                  <value name="B">
                                                                                    <shadow type="math_number" id="ezPBP`zuFZTO)K}17oZa">
                                                                                      <field name="NUM">1024</field>
                                                                                    </shadow>
                                                                                  </value>
                                                                                </block>
                                                                              </value>
                                                                              <value name="B">
                                                                                <shadow type="math_number" id="IAaDPy)6g6W.A#1jKWvZ">
                                                                                  <field name="NUM">1024</field>
                                                                                </shadow>
                                                                              </value>
                                                                            </block>
                                                                          </value>
                                                                          <value name="B">
                                                                            <shadow type="math_number" id="n4O#)N61F/JX]4THh-rN">
                                                                              <field name="NUM">8</field>
                                                                            </shadow>
                                                                          </value>
                                                                        </block>
                                                                      </value>
                                                                      <value name="B">
                                                                        <shadow type="math_number" id="{L^ITqJqC5LcX!O?_c+6">
                                                                          <field name="NUM">1</field>
                                                                        </shadow>
                                                                        <block type="math_arithmetic" id="X|B-!:r,`J{0w8nwe%zn">
                                                                          <field name="OP">DIVIDE</field>
                                                                          <value name="A">
                                                                            <shadow type="math_number" id="H-(V0ncSB7L1cFOn|qgH">
                                                                              <field name="NUM">1</field>
                                                                            </shadow>
                                                                            <block type="math_arithmetic" id="$cDa.hRem~YXH#82~s7]">
                                                                              <field name="OP">MINUS</field>
                                                                              <value name="A">
                                                                                <shadow type="math_number" id=",#y6X!:$Wqr_4son+Jw4">
                                                                                  <field name="NUM">1</field>
                                                                                </shadow>
                                                                                <block type="variables_get" id="E(tfp;)jn@E})xfA;zsr">
                                                                                  <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                                                                                </block>
                                                                              </value>
                                                                              <value name="B">
                                                                                <shadow type="math_number" id="NwDUgGmZ6L,r;cu/in/o">
                                                                                  <field name="NUM">1</field>
                                                                                </shadow>
                                                                                <block type="variables_get" id="8=(RAP.HNQN+Tux)5x`6">
                                                                                  <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
                                                                                </block>
                                                                              </value>
                                                                            </block>
                                                                          </value>
                                                                          <value name="B">
                                                                            <shadow type="math_number" id="}]Y8RyL6ciu?Q:U``*Bk">
                                                                              <field name="NUM">1000</field>
                                                                            </shadow>
                                                                          </value>
                                                                        </block>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </next>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </next>
                                                </block>
                                              </statement>
                                              <statement name="ELSE">
                                                <block type="control" id="JthKIo:|$%,#gA4[N?eP">
                                                  <mutation delay_input="false"></mutation>
                                                  <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                  <field name="WITH_DELAY">FALSE</field>
                                                  <value name="VALUE">
                                                    <block type="math_number" id="j{/,M/Z,V/@cB8%rNs*{">
                                                      <field name="NUM">0</field>
                                                    </block>
                                                  </value>
                                                  <next>
                                                    <block type="control" id="M*NBd0;__8?bLuzEv4MB">
                                                      <mutation delay_input="false"></mutation>
                                                      <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                      <field name="WITH_DELAY">FALSE</field>
                                                      <value name="VALUE">
                                                        <block type="math_number" id="h!T,]YTj1aeE%)QNuG4S">
                                                          <field name="NUM">0</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </next>
                                                </block>
                                              </statement>
                                              <next>
                                                <block type="timeouts_settimeout" id="hR-P}I]4z~wMO*}+v]DU">
                                                  <field name="NAME">timeout</field>
                                                  <field name="DELAY">10</field>
                                                  <field name="UNIT">sec</field>
                                                  <statement name="STATEMENT">
                                                    <block type="variables_set" id="9C8fbHULfc}n.EY9|$EQ">
                                                      <field name="VAR" id="4)^FI|7eZP:~|8@dl_}i" variabletype="">Rx_alt</field>
                                                      <value name="VALUE">
                                                        <block type="variables_get" id="lly)n/86vzcayF7YKK1X">
                                                          <field name="VAR" id="RpbuTH{(VZw@81!S)8AS" variabletype="">Rx</field>
                                                        </block>
                                                      </value>
                                                      <next>
                                                        <block type="variables_set" id="r?yY8]4w];-^}r[P4*2r">
                                                          <field name="VAR" id="K1EWa[K6u([K4O7mUdeD" variabletype="">Tx_alt</field>
                                                          <value name="VALUE">
                                                            <block type="variables_get" id="oi^AbN%Iv8kK1w^IU9Ez">
                                                              <field name="VAR" id="q[(Kd7qbio8dO$z7F=[O" variabletype="">Tx</field>
                                                            </block>
                                                          </value>
                                                          <next>
                                                            <block type="variables_set" id=";v9kuQR`xV8YnWdx#(WG">
                                                              <field name="VAR" id="Sh:,5JC@9t@w;]%@UxQV" variabletype="">Zeitstempel_alt</field>
                                                              <value name="VALUE">
                                                                <block type="variables_get" id="Ex#FQ|(`Ba2A98lsue30">
                                                                  <field name="VAR" id="U5E{Gui(s~4G=k.GN:1;" variabletype="">Zeitstempel</field>
                                                                </block>
                                                              </value>
                                                              <next>
                                                                <block type="timeouts_settimeout" id="+6XM-Y*YbePlV[J)N!B8">
                                                                  <field name="NAME">timeout2</field>
                                                                  <field name="DELAY">81</field>
                                                                  <field name="UNIT">sec</field>
                                                                  <statement name="STATEMENT">
                                                                    <block type="control" id="R7uyP?$t%M4q^F6W}iIu">
                                                                      <mutation delay_input="false"></mutation>
                                                                      <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                                      <field name="WITH_DELAY">FALSE</field>
                                                                      <value name="VALUE">
                                                                        <block type="math_number" id="85-8AwWcTVobJJbPq8rI">
                                                                          <field name="NUM">0</field>
                                                                        </block>
                                                                      </value>
                                                                      <next>
                                                                        <block type="control" id="l[`)PxToGV`AWQaaAec3">
                                                                          <mutation delay_input="false"></mutation>
                                                                          <field name="OID">javascript.0.*DATENPUNKT*</field>
                                                                          <field name="WITH_DELAY">FALSE</field>
                                                                          <value name="VALUE">
                                                                            <block type="math_number" id="L:hvmPPt;GGm^`|cg67U">
                                                                              <field name="NUM">0</field>
                                                                            </block>
                                                                          </value>
                                                                        </block>
                                                                      </next>
                                                                    </block>
                                                                  </statement>
                                                                </block>
                                                              </next>
                                                            </block>
                                                          </next>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </statement>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                    </block>
                  </next>
                </block>
              </next>
            </block>
          </next>
        </block>
      </xml>
      

      dslraserD Offline
      dslraserD Offline
      dslraser
      Forum Testing Most Active
      schrieb am zuletzt editiert von
      #303

      @Dr-Bakterius
      gibt es auch eine Möglichkeit ein Gäste WLAN per Script oder Blockly an und aus zu schalten ?

      Dr. BakteriusD liv-in-skyL 3 Antworten Letzte Antwort
      0
      • dslraserD dslraser

        @Dr-Bakterius
        gibt es auch eine Möglichkeit ein Gäste WLAN per Script oder Blockly an und aus zu schalten ?

        Dr. BakteriusD Offline
        Dr. BakteriusD Offline
        Dr. Bakterius
        Most Active
        schrieb am zuletzt editiert von
        #304

        @dslraser Keine Ahnung, sorry. Ich habe mir die Befehle auch erst zusammensuchen müssen. Wenn du dich per SSH in die USG verbindest, kannst du mit 'show ?' eine Liste der möglichen Befehle abrufen. Weitere Hilfe bekommt man immer wenn man den Befehl mit Fragezeichen eingibt. Allerdings kann man hier nur Werte abfragen, keine Befehle senden.

        1 Antwort Letzte Antwort
        0
        • dslraserD dslraser

          @Dr-Bakterius
          gibt es auch eine Möglichkeit ein Gäste WLAN per Script oder Blockly an und aus zu schalten ?

          liv-in-skyL Offline
          liv-in-skyL Offline
          liv-in-sky
          schrieb am zuletzt editiert von
          #305

          @dslraser
          mir ist der umfang der daten auch zu groß - teste gerade nodered unifi node - dort gibt es DisableWlan als befehl - getestet habe ich das noch nicht

          Image 7.png

          nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

          1 Antwort Letzte Antwort
          1
          • dslraserD dslraser

            @Dr-Bakterius
            gibt es auch eine Möglichkeit ein Gäste WLAN per Script oder Blockly an und aus zu schalten ?

            liv-in-skyL Offline
            liv-in-skyL Offline
            liv-in-sky
            schrieb am zuletzt editiert von
            #306

            @dslraser

            hab noch was gefunden und positiv getestet - ist ein linux-bash-script

            https://community.openhab.org/t/solved-exec-commandline-bash-script-unifi-via-rule/66136/7

            #!/bin/bash
            
            unifi_username=user
            unifi_password='pass'
            unifi_controller=https://192.168.x.xx:xxxx
            wifi_id=dsa4fsda6g46fdsg984
            cookie=/tmp/cookie
            
            #site_id=""             // deprecated
            
            curl_cmd="curl -s -S --cookie ${cookie} --cookie-jar ${cookie} --insecure "
            
            unifi_login() {
             # authenticate against unifi controller
             # Mute response by adding > /dev/null
             ${curl_cmd} -H "Content-Type: application/json" -X POST -d "{\"password\":\"$unifi_password\",\"username\":\"$unifi_username\"}" $unifi_controller/api/login #> /dev/null
            }
            
            unifi_logout() {
             # logout
             ${curl_cmd} $unifi_controller/logout
            }
            
            enable_wifi() {
             # enables guest wifi network
             # Mute response by adding > /dev/null
             ${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" -X PUT --data-binary '{"_id":"'$site_id'","enabled":true}' --compressed #> /dev/null
            }
            
            disable_wifi() {
             # enables guest wifi network
             # Mute response by adding > /dev/null
             ${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" -X PUT --data-binary '{"_id":"'$site_id'","enabled":false}' --compressed #> /dev/null
            }
            
            check_status() {
             # checks wifi network status
             # Mute response by adding > /dev/null
             response=$(${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" --compressed)
             status=$(echo $response | jq ".data[0].enabled")
             if [ "$status" == "true" ]; then
             exit 0
             elif [ "$status" == "false" ]; then
             exit 1
             else
             echo exit -1
             fi
            }
            
            unifi_login
            if [ "$1" == "enable" ]; then
             echo "Enabling WiFi."
             enable_wifi
            elif [ "$1" == "disable" ]; then
             echo "Disabling WiFi."
             disable_wifi
            elif [ "$1" == "status" ]; then
             check_status
            else
             echo "Must include command line parameter [enable|disable|status]."
            fi
            unifi_logout
            rm $cookie
            
            

            mit diesem script kann ich mein wlan ein und ausschalten ode den status abfragen

            • es muss "apt-get install jq" ausgeführt werden (nur nötig, wenn man status will) (damit es bei mir funktionierte, mußte ich den jq pfad im script bei dem jq befehle angeben (unter bereich status)) - die wifi_id findet man so:

            Getting your wifi_id:
            Navigate to your controller and sign in.
            Navigate to Settings > Wifi Networks.
            Click Edit next to the SSID you’d like to control.
            Copy the ID from the end of the URL.
            In the following example, the ID is ( 000d00c0e0b0e00d00000000 😞
            url://example:8443/manage/site/default/settings/wlans/00bd00a6e0000e9da2cde10c/edit/000d00c0e0b0e00d00000000

            nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

            dslraserD 3 Antworten Letzte Antwort
            1
            • liv-in-skyL liv-in-sky

              @dslraser

              hab noch was gefunden und positiv getestet - ist ein linux-bash-script

              https://community.openhab.org/t/solved-exec-commandline-bash-script-unifi-via-rule/66136/7

              #!/bin/bash
              
              unifi_username=user
              unifi_password='pass'
              unifi_controller=https://192.168.x.xx:xxxx
              wifi_id=dsa4fsda6g46fdsg984
              cookie=/tmp/cookie
              
              #site_id=""             // deprecated
              
              curl_cmd="curl -s -S --cookie ${cookie} --cookie-jar ${cookie} --insecure "
              
              unifi_login() {
               # authenticate against unifi controller
               # Mute response by adding > /dev/null
               ${curl_cmd} -H "Content-Type: application/json" -X POST -d "{\"password\":\"$unifi_password\",\"username\":\"$unifi_username\"}" $unifi_controller/api/login #> /dev/null
              }
              
              unifi_logout() {
               # logout
               ${curl_cmd} $unifi_controller/logout
              }
              
              enable_wifi() {
               # enables guest wifi network
               # Mute response by adding > /dev/null
               ${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" -X PUT --data-binary '{"_id":"'$site_id'","enabled":true}' --compressed #> /dev/null
              }
              
              disable_wifi() {
               # enables guest wifi network
               # Mute response by adding > /dev/null
               ${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" -X PUT --data-binary '{"_id":"'$site_id'","enabled":false}' --compressed #> /dev/null
              }
              
              check_status() {
               # checks wifi network status
               # Mute response by adding > /dev/null
               response=$(${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" --compressed)
               status=$(echo $response | jq ".data[0].enabled")
               if [ "$status" == "true" ]; then
               exit 0
               elif [ "$status" == "false" ]; then
               exit 1
               else
               echo exit -1
               fi
              }
              
              unifi_login
              if [ "$1" == "enable" ]; then
               echo "Enabling WiFi."
               enable_wifi
              elif [ "$1" == "disable" ]; then
               echo "Disabling WiFi."
               disable_wifi
              elif [ "$1" == "status" ]; then
               check_status
              else
               echo "Must include command line parameter [enable|disable|status]."
              fi
              unifi_logout
              rm $cookie
              
              

              mit diesem script kann ich mein wlan ein und ausschalten ode den status abfragen

              • es muss "apt-get install jq" ausgeführt werden (nur nötig, wenn man status will) (damit es bei mir funktionierte, mußte ich den jq pfad im script bei dem jq befehle angeben (unter bereich status)) - die wifi_id findet man so:

              Getting your wifi_id:
              Navigate to your controller and sign in.
              Navigate to Settings > Wifi Networks.
              Click Edit next to the SSID you’d like to control.
              Copy the ID from the end of the URL.
              In the following example, the ID is ( 000d00c0e0b0e00d00000000 😞
              url://example:8443/manage/site/default/settings/wlans/00bd00a6e0000e9da2cde10c/edit/000d00c0e0b0e00d00000000

              dslraserD Offline
              dslraserD Offline
              dslraser
              Forum Testing Most Active
              schrieb am zuletzt editiert von
              #307

              @liv-in-sky
              Danke Dir.

              1 Antwort Letzte Antwort
              0
              • liv-in-skyL liv-in-sky

                @dslraser

                hab noch was gefunden und positiv getestet - ist ein linux-bash-script

                https://community.openhab.org/t/solved-exec-commandline-bash-script-unifi-via-rule/66136/7

                #!/bin/bash
                
                unifi_username=user
                unifi_password='pass'
                unifi_controller=https://192.168.x.xx:xxxx
                wifi_id=dsa4fsda6g46fdsg984
                cookie=/tmp/cookie
                
                #site_id=""             // deprecated
                
                curl_cmd="curl -s -S --cookie ${cookie} --cookie-jar ${cookie} --insecure "
                
                unifi_login() {
                 # authenticate against unifi controller
                 # Mute response by adding > /dev/null
                 ${curl_cmd} -H "Content-Type: application/json" -X POST -d "{\"password\":\"$unifi_password\",\"username\":\"$unifi_username\"}" $unifi_controller/api/login #> /dev/null
                }
                
                unifi_logout() {
                 # logout
                 ${curl_cmd} $unifi_controller/logout
                }
                
                enable_wifi() {
                 # enables guest wifi network
                 # Mute response by adding > /dev/null
                 ${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" -X PUT --data-binary '{"_id":"'$site_id'","enabled":true}' --compressed #> /dev/null
                }
                
                disable_wifi() {
                 # enables guest wifi network
                 # Mute response by adding > /dev/null
                 ${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" -X PUT --data-binary '{"_id":"'$site_id'","enabled":false}' --compressed #> /dev/null
                }
                
                check_status() {
                 # checks wifi network status
                 # Mute response by adding > /dev/null
                 response=$(${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" --compressed)
                 status=$(echo $response | jq ".data[0].enabled")
                 if [ "$status" == "true" ]; then
                 exit 0
                 elif [ "$status" == "false" ]; then
                 exit 1
                 else
                 echo exit -1
                 fi
                }
                
                unifi_login
                if [ "$1" == "enable" ]; then
                 echo "Enabling WiFi."
                 enable_wifi
                elif [ "$1" == "disable" ]; then
                 echo "Disabling WiFi."
                 disable_wifi
                elif [ "$1" == "status" ]; then
                 check_status
                else
                 echo "Must include command line parameter [enable|disable|status]."
                fi
                unifi_logout
                rm $cookie
                
                

                mit diesem script kann ich mein wlan ein und ausschalten ode den status abfragen

                • es muss "apt-get install jq" ausgeführt werden (nur nötig, wenn man status will) (damit es bei mir funktionierte, mußte ich den jq pfad im script bei dem jq befehle angeben (unter bereich status)) - die wifi_id findet man so:

                Getting your wifi_id:
                Navigate to your controller and sign in.
                Navigate to Settings > Wifi Networks.
                Click Edit next to the SSID you’d like to control.
                Copy the ID from the end of the URL.
                In the following example, the ID is ( 000d00c0e0b0e00d00000000 😞
                url://example:8443/manage/site/default/settings/wlans/00bd00a6e0000e9da2cde10c/edit/000d00c0e0b0e00d00000000

                dslraserD Offline
                dslraserD Offline
                dslraser
                Forum Testing Most Active
                schrieb am zuletzt editiert von
                #308

                @liv-in-sky

                ich habe noch nichts ausprobiert...
                (ich hatte bisher nur angefangen zu suchen und wollte mir von diesem Post was ableiten, ist zwar nicht für unifi aber eben für ssh.)
                Das hier meine ich

                Ich bin sonst fast nur mit Blockly unterwegs, aber vielleicht lässt sich Dein Bash auch in eine Blockly Funktion packen.
                Ich bin noch unterwegs, aber ich schaue es mir später genauer an.

                1 Antwort Letzte Antwort
                0
                • liv-in-skyL liv-in-sky

                  @dslraser

                  hab noch was gefunden und positiv getestet - ist ein linux-bash-script

                  https://community.openhab.org/t/solved-exec-commandline-bash-script-unifi-via-rule/66136/7

                  #!/bin/bash
                  
                  unifi_username=user
                  unifi_password='pass'
                  unifi_controller=https://192.168.x.xx:xxxx
                  wifi_id=dsa4fsda6g46fdsg984
                  cookie=/tmp/cookie
                  
                  #site_id=""             // deprecated
                  
                  curl_cmd="curl -s -S --cookie ${cookie} --cookie-jar ${cookie} --insecure "
                  
                  unifi_login() {
                   # authenticate against unifi controller
                   # Mute response by adding > /dev/null
                   ${curl_cmd} -H "Content-Type: application/json" -X POST -d "{\"password\":\"$unifi_password\",\"username\":\"$unifi_username\"}" $unifi_controller/api/login #> /dev/null
                  }
                  
                  unifi_logout() {
                   # logout
                   ${curl_cmd} $unifi_controller/logout
                  }
                  
                  enable_wifi() {
                   # enables guest wifi network
                   # Mute response by adding > /dev/null
                   ${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" -X PUT --data-binary '{"_id":"'$site_id'","enabled":true}' --compressed #> /dev/null
                  }
                  
                  disable_wifi() {
                   # enables guest wifi network
                   # Mute response by adding > /dev/null
                   ${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" -X PUT --data-binary '{"_id":"'$site_id'","enabled":false}' --compressed #> /dev/null
                  }
                  
                  check_status() {
                   # checks wifi network status
                   # Mute response by adding > /dev/null
                   response=$(${curl_cmd} "$unifi_controller"'/api/s/default/rest/wlanconf/'"$wifi_id" --compressed)
                   status=$(echo $response | jq ".data[0].enabled")
                   if [ "$status" == "true" ]; then
                   exit 0
                   elif [ "$status" == "false" ]; then
                   exit 1
                   else
                   echo exit -1
                   fi
                  }
                  
                  unifi_login
                  if [ "$1" == "enable" ]; then
                   echo "Enabling WiFi."
                   enable_wifi
                  elif [ "$1" == "disable" ]; then
                   echo "Disabling WiFi."
                   disable_wifi
                  elif [ "$1" == "status" ]; then
                   check_status
                  else
                   echo "Must include command line parameter [enable|disable|status]."
                  fi
                  unifi_logout
                  rm $cookie
                  
                  

                  mit diesem script kann ich mein wlan ein und ausschalten ode den status abfragen

                  • es muss "apt-get install jq" ausgeführt werden (nur nötig, wenn man status will) (damit es bei mir funktionierte, mußte ich den jq pfad im script bei dem jq befehle angeben (unter bereich status)) - die wifi_id findet man so:

                  Getting your wifi_id:
                  Navigate to your controller and sign in.
                  Navigate to Settings > Wifi Networks.
                  Click Edit next to the SSID you’d like to control.
                  Copy the ID from the end of the URL.
                  In the following example, the ID is ( 000d00c0e0b0e00d00000000 😞
                  url://example:8443/manage/site/default/settings/wlans/00bd00a6e0000e9da2cde10c/edit/000d00c0e0b0e00d00000000

                  dslraserD Offline
                  dslraserD Offline
                  dslraser
                  Forum Testing Most Active
                  schrieb am zuletzt editiert von
                  #309

                  @liv-in-sky sagte in Adapter: ioBroker.unifi:

                  hab noch was gefunden und positiv getestet - ist ein linux-bash-script

                  Hi, kann man das auch in ein normal Script oder Blockly umwandeln ?
                  Oder wo/wie wendest Du das linux-bash-script an ?

                  Ich würde es gern in z.B iQontrol nutzen.

                  z.B. Gäste WLAN an oder Gäste WLAN aus

                  liv-in-skyL 1 Antwort Letzte Antwort
                  0
                  • dslraserD dslraser

                    @liv-in-sky sagte in Adapter: ioBroker.unifi:

                    hab noch was gefunden und positiv getestet - ist ein linux-bash-script

                    Hi, kann man das auch in ein normal Script oder Blockly umwandeln ?
                    Oder wo/wie wendest Du das linux-bash-script an ?

                    Ich würde es gern in z.B iQontrol nutzen.

                    z.B. Gäste WLAN an oder Gäste WLAN aus

                    liv-in-skyL Offline
                    liv-in-skyL Offline
                    liv-in-sky
                    schrieb am zuletzt editiert von
                    #310

                    @dslraser

                    wenn du das linux script erzeugst auf einer console :

                    • am besten im /opt/iobroker - ordner - da solltest du die rechte haben
                    • nano unifi.sh (dann inhalt reinkopieren) - mit "<ALT>-x speichern unter dem namen unifi.sh
                    • dann "chmod +x unifi.sh" - danmit es ausführbar ist

                    dann kannst du mit einem blockly und result aktiviert (variable result einfach erstellen) das script aufrufen und das result weiterverarbeiten

                    Image 7.png

                    Image 6.png

                    nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                    dslraserD 1 Antwort Letzte Antwort
                    0
                    • liv-in-skyL liv-in-sky

                      @dslraser

                      wenn du das linux script erzeugst auf einer console :

                      • am besten im /opt/iobroker - ordner - da solltest du die rechte haben
                      • nano unifi.sh (dann inhalt reinkopieren) - mit "<ALT>-x speichern unter dem namen unifi.sh
                      • dann "chmod +x unifi.sh" - danmit es ausführbar ist

                      dann kannst du mit einem blockly und result aktiviert (variable result einfach erstellen) das script aufrufen und das result weiterverarbeiten

                      Image 7.png

                      Image 6.png

                      dslraserD Offline
                      dslraserD Offline
                      dslraser
                      Forum Testing Most Active
                      schrieb am zuletzt editiert von
                      #311

                      @liv-in-sky
                      Danke für Deine Geduld und Mühe.
                      Also muss ich tatsächlich erst dieses Script installieren und dann über Blockly aufrufen.
                      Ich dachte es gäbe eine Möglichkeit dies gleich mit "ioBroker Boardmitteln" zu erledigen ?

                      liv-in-skyL 1 Antwort Letzte Antwort
                      0
                      • dslraserD dslraser

                        @liv-in-sky
                        Danke für Deine Geduld und Mühe.
                        Also muss ich tatsächlich erst dieses Script installieren und dann über Blockly aufrufen.
                        Ich dachte es gäbe eine Möglichkeit dies gleich mit "ioBroker Boardmitteln" zu erledigen ?

                        liv-in-skyL Offline
                        liv-in-skyL Offline
                        liv-in-sky
                        schrieb am zuletzt editiert von
                        #312

                        @dslraser
                        ja - ich steh auf diese linux scripts - dabei bin ich schneller als in javascript - old school halt!

                        ein richtiger profi könnte das sicher in javascript umwandeln - aber das kann ich leider nicht bieten 😞

                        ansonsten mit nodered - weiß nicht, ob du das magst

                        nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                        dslraserD 1 Antwort Letzte Antwort
                        0
                        • liv-in-skyL liv-in-sky

                          @dslraser
                          ja - ich steh auf diese linux scripts - dabei bin ich schneller als in javascript - old school halt!

                          ein richtiger profi könnte das sicher in javascript umwandeln - aber das kann ich leider nicht bieten 😞

                          ansonsten mit nodered - weiß nicht, ob du das magst

                          dslraserD Offline
                          dslraserD Offline
                          dslraser
                          Forum Testing Most Active
                          schrieb am zuletzt editiert von
                          #313

                          @liv-in-sky sagte in Adapter: ioBroker.unifi:

                          ansonsten mit nodered - weiß nicht, ob du das magst

                          Ich weiß nicht ob ich das mag, habe ich noch nie benutzt 😅

                          thewhoboxT 1 Antwort Letzte Antwort
                          0
                          • dslraserD dslraser

                            @liv-in-sky sagte in Adapter: ioBroker.unifi:

                            ansonsten mit nodered - weiß nicht, ob du das magst

                            Ich weiß nicht ob ich das mag, habe ich noch nie benutzt 😅

                            thewhoboxT Offline
                            thewhoboxT Offline
                            thewhobox
                            schrieb am zuletzt editiert von
                            #314

                            @dslraser Hab ich noch nicht getestet, sollte aber eig funktionieren.

                            const request = require('request');
                            const unifi_username = "user";
                            const unifi_password = "pass";
                            const unifi_controller = "https://192.168.x.xx:xxxx";
                            const wifi_id = "dsa4fsda6g46fdsg984";
                            
                            
                            function login() {
                                request.post({
                                        url: unifi_controller + "/api/login",
                                        body: JSON.stringify({ username: unifi_username, password: unifi_password }),
                                        headers: { 'Content-Type': 'application/json' }
                                    }, (err, resp) => {
                                    
                                    if(!err) {
                                        console.log("Login war erfolgreich!");
                                        getStatus();
                                    } else {
                                        console.log("Login Fehler! " + err);
                                    }
                                })
                            }
                            
                            function getStatus() {
                                request.get(unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, (err, resp) => {
                                    if(!err) {
                                        console.log("Status erfolgreich geholt!");
                                        console.log(resp);
                                        let status = JSON.parse(resp);
                                        let wlanOn = status.data[0].enabled;
                                        console.log("WLAN ist: " + (wlanOn ? "an" : "aus"));
                                    } else {
                                        console.log("Status konnte nicht geholt werden. " + err);
                                    }
                                })
                            }
                            
                            login();
                            

                            Meine Adapter: emby | discovery
                            Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.

                            dslraserD liv-in-skyL 3 Antworten Letzte Antwort
                            1
                            • thewhoboxT thewhobox

                              @dslraser Hab ich noch nicht getestet, sollte aber eig funktionieren.

                              const request = require('request');
                              const unifi_username = "user";
                              const unifi_password = "pass";
                              const unifi_controller = "https://192.168.x.xx:xxxx";
                              const wifi_id = "dsa4fsda6g46fdsg984";
                              
                              
                              function login() {
                                  request.post({
                                          url: unifi_controller + "/api/login",
                                          body: JSON.stringify({ username: unifi_username, password: unifi_password }),
                                          headers: { 'Content-Type': 'application/json' }
                                      }, (err, resp) => {
                                      
                                      if(!err) {
                                          console.log("Login war erfolgreich!");
                                          getStatus();
                                      } else {
                                          console.log("Login Fehler! " + err);
                                      }
                                  })
                              }
                              
                              function getStatus() {
                                  request.get(unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, (err, resp) => {
                                      if(!err) {
                                          console.log("Status erfolgreich geholt!");
                                          console.log(resp);
                                          let status = JSON.parse(resp);
                                          let wlanOn = status.data[0].enabled;
                                          console.log("WLAN ist: " + (wlanOn ? "an" : "aus"));
                                      } else {
                                          console.log("Status konnte nicht geholt werden. " + err);
                                      }
                                  })
                              }
                              
                              login();
                              
                              dslraserD Offline
                              dslraserD Offline
                              dslraser
                              Forum Testing Most Active
                              schrieb am zuletzt editiert von
                              #315

                              @thewhobox
                              danke Dir, probiere ich heute Abend mal aus. Ich sage hier Bescheid ob es funktioniert.

                              1 Antwort Letzte Antwort
                              0
                              • thewhoboxT thewhobox

                                @dslraser Hab ich noch nicht getestet, sollte aber eig funktionieren.

                                const request = require('request');
                                const unifi_username = "user";
                                const unifi_password = "pass";
                                const unifi_controller = "https://192.168.x.xx:xxxx";
                                const wifi_id = "dsa4fsda6g46fdsg984";
                                
                                
                                function login() {
                                    request.post({
                                            url: unifi_controller + "/api/login",
                                            body: JSON.stringify({ username: unifi_username, password: unifi_password }),
                                            headers: { 'Content-Type': 'application/json' }
                                        }, (err, resp) => {
                                        
                                        if(!err) {
                                            console.log("Login war erfolgreich!");
                                            getStatus();
                                        } else {
                                            console.log("Login Fehler! " + err);
                                        }
                                    })
                                }
                                
                                function getStatus() {
                                    request.get(unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, (err, resp) => {
                                        if(!err) {
                                            console.log("Status erfolgreich geholt!");
                                            console.log(resp);
                                            let status = JSON.parse(resp);
                                            let wlanOn = status.data[0].enabled;
                                            console.log("WLAN ist: " + (wlanOn ? "an" : "aus"));
                                        } else {
                                            console.log("Status konnte nicht geholt werden. " + err);
                                        }
                                    })
                                }
                                
                                login();
                                
                                liv-in-skyL Offline
                                liv-in-skyL Offline
                                liv-in-sky
                                schrieb am zuletzt editiert von
                                #316

                                @thewhobox hi,

                                bekomme das zurück

                                unifiWLAN: Login Fehler! Error: self signed certificate
                                

                                nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                thewhoboxT 1 Antwort Letzte Antwort
                                0
                                • thewhoboxT thewhobox

                                  @dslraser Hab ich noch nicht getestet, sollte aber eig funktionieren.

                                  const request = require('request');
                                  const unifi_username = "user";
                                  const unifi_password = "pass";
                                  const unifi_controller = "https://192.168.x.xx:xxxx";
                                  const wifi_id = "dsa4fsda6g46fdsg984";
                                  
                                  
                                  function login() {
                                      request.post({
                                              url: unifi_controller + "/api/login",
                                              body: JSON.stringify({ username: unifi_username, password: unifi_password }),
                                              headers: { 'Content-Type': 'application/json' }
                                          }, (err, resp) => {
                                          
                                          if(!err) {
                                              console.log("Login war erfolgreich!");
                                              getStatus();
                                          } else {
                                              console.log("Login Fehler! " + err);
                                          }
                                      })
                                  }
                                  
                                  function getStatus() {
                                      request.get(unifi_controller + "/api/s/default/rest/wlanconf/" + wifi_id, (err, resp) => {
                                          if(!err) {
                                              console.log("Status erfolgreich geholt!");
                                              console.log(resp);
                                              let status = JSON.parse(resp);
                                              let wlanOn = status.data[0].enabled;
                                              console.log("WLAN ist: " + (wlanOn ? "an" : "aus"));
                                          } else {
                                              console.log("Status konnte nicht geholt werden. " + err);
                                          }
                                      })
                                  }
                                  
                                  login();
                                  
                                  dslraserD Offline
                                  dslraserD Offline
                                  dslraser
                                  Forum Testing Most Active
                                  schrieb am zuletzt editiert von
                                  #317

                                  @thewhobox

                                  habe es doch schnell probiert, gleicher Fehler wie @liv-in-sky

                                  Login Fehler! Error: self signed certificate
                                  
                                  1 Antwort Letzte Antwort
                                  0
                                  • liv-in-skyL liv-in-sky

                                    @thewhobox hi,

                                    bekomme das zurück

                                    unifiWLAN: Login Fehler! Error: self signed certificate
                                    
                                    thewhoboxT Offline
                                    thewhoboxT Offline
                                    thewhobox
                                    schrieb am zuletzt editiert von thewhobox
                                    #318

                                    @liv-in-sky @dslraser dann probiert mal in der ersten zeile

                                    const request = require('request').defaults({ rejectUnauthorized: false });
                                    

                                    Meine Adapter: emby | discovery
                                    Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.

                                    dslraserD liv-in-skyL 4 Antworten Letzte Antwort
                                    0
                                    • thewhoboxT thewhobox

                                      @liv-in-sky @dslraser dann probiert mal in der ersten zeile

                                      const request = require('request').defaults({ rejectUnauthorized: false });
                                      
                                      dslraserD Offline
                                      dslraserD Offline
                                      dslraser
                                      Forum Testing Most Active
                                      schrieb am zuletzt editiert von
                                      #319

                                      @thewhobox sagte in Adapter: ioBroker.unifi:

                                      const request = require('request').defaults({ rejectUnauthorized: false });

                                      18:10:40.222	error	javascript.0 script.js.Heiko.04Telegram.Unifi: SyntaxError: Unexpected token o in JSON at position 1
                                      18:10:40.222	error	javascript.0 at Request.request.get [as _callback] (script.js.Heiko.04Telegram.Unifi:29:31)
                                      
                                      1 Antwort Letzte Antwort
                                      0
                                      • thewhoboxT thewhobox

                                        @liv-in-sky @dslraser dann probiert mal in der ersten zeile

                                        const request = require('request').defaults({ rejectUnauthorized: false });
                                        
                                        liv-in-skyL Offline
                                        liv-in-skyL Offline
                                        liv-in-sky
                                        schrieb am zuletzt editiert von
                                        #320

                                        @thewhobox

                                        Image 4.png

                                        nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                        1 Antwort Letzte Antwort
                                        0
                                        • thewhoboxT thewhobox

                                          @liv-in-sky @dslraser dann probiert mal in der ersten zeile

                                          const request = require('request').defaults({ rejectUnauthorized: false });
                                          
                                          dslraserD Offline
                                          dslraserD Offline
                                          dslraser
                                          Forum Testing Most Active
                                          schrieb am zuletzt editiert von
                                          #321

                                          @thewhobox

                                          javascript.0	2019-08-26 18:12:12.553	error	at endReadableNT (_stream_readable.js:1145:12)
                                          javascript.0	2019-08-26 18:12:12.553	error	at IncomingMessage.emit (events.js:203:15)
                                          javascript.0	2019-08-26 18:12:12.553	error	at Object.onceWrapper (events.js:286:20)
                                          javascript.0	2019-08-26 18:12:12.553	error	at IncomingMessage.<anonymous> (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:1083:12)
                                          javascript.0	2019-08-26 18:12:12.553	error	at Request.emit (events.js:198:13)
                                          javascript.0	2019-08-26 18:12:12.553	error	at Request.<anonymous> (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:1161:10)
                                          javascript.0	2019-08-26 18:12:12.553	error	at Request.emit (events.js:198:13)
                                          javascript.0	2019-08-26 18:12:12.553	error	at Request.self.callback (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:185:22)
                                          javascript.0	2019-08-26 18:12:12.553	error	at Request.request.get [as _callback] (script.js.Heiko.04Telegram.Unifi:29:31)
                                          javascript.0	2019-08-26 18:12:12.553	error	at JSON.parse (<anonymous>:null:null)
                                          javascript.0	2019-08-26 18:12:12.552	error	script.js.Heiko.04Telegram.Unifi: SyntaxError: Unexpected token o in JSON at position 1
                                          javascript.0	2019-08-26 18:12:12.552	info	script.js.Heiko.04Telegram.Unifi: {'statusCode':401,'body':'{\'meta\':{\'rc\':\'error\',\'msg\':\'api.err.LoginRequired\'},\'data\':[]}','headers':{'cache-control':'private','expires':'Thu, 01 Jan 19
                                          
                                          1 Antwort Letzte Antwort
                                          0
                                          Antworten
                                          • In einem neuen Thema antworten
                                          Anmelden zum Antworten
                                          • Älteste zuerst
                                          • Neuste zuerst
                                          • Meiste Stimmen


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate
                                          FAQ Cloud / IOT
                                          HowTo: Node.js-Update
                                          HowTo: Backup/Restore
                                          Downloads
                                          BLOG

                                          643

                                          Online

                                          32.4k

                                          Benutzer

                                          81.4k

                                          Themen

                                          1.3m

                                          Beiträge
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Anmelden

                                          • Du hast noch kein Konto? Registrieren

                                          • Anmelden oder registrieren, um zu suchen
                                          • Erster Beitrag
                                            Letzter Beitrag
                                          0
                                          • Aktuell
                                          • Tags
                                          • Ungelesen 0
                                          • Kategorien
                                          • Unreplied
                                          • Beliebt
                                          • GitHub
                                          • Docu
                                          • Hilfe