Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Adapter: ioBroker.unifi

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Adapter: ioBroker.unifi

    This topic has been deleted. Only users with topic management privileges can see it.
    • Hiltex
      Hiltex @lutzer last edited by

      @lutzer mir sind das eigentlich auch zu viele Datenpunkte, aber ich nutze den Adapter für die Anwesenheitserkennung, die sehr zuverlässig funktioniert. Insofern störe ich mich auch nicht daran

      D 1 Reply Last reply Reply Quote 0
      • D
        darkiop Most Active @Hiltex last edited by

        @Hiltex dafür nutze ich ihn auch - mit Hilfe des last_seen Objektes.

        1 Reply Last reply Reply Quote 0
        • L
          lutzer last edited by

          Und wie ist es mit Handys und Standbay?
          Und wir schalten nachts die Handys auf Flugmodus, kann man damit trotzdem arbeiten?
          Das sind immer meine zwei ko Kriterien.

          Chaot 1 Reply Last reply Reply Quote 0
          • Chaot
            Chaot @lutzer last edited by

            @lutzer Logischerweise geht das dann nicht mehr.
            Wenn das Handy nicht mehr sendet kannst du es auch nicht für eine Anwesenheitskontrolle verwenden.

            dslraser 1 Reply Last reply Reply Quote 0
            • dslraser
              dslraser Forum Testing Most Active @Chaot last edited by

              @Chaot
              nicht getestet, aber Flugmodus und WLAN geht ja auch gleichzeitig (dann ist nur der Rest aus)
              20190824_155458.jpg

              1 Reply Last reply Reply Quote 0
              • Dr. Bakterius
                Dr. Bakterius Most Active last edited by 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>
                

                dslraser 1 Reply Last reply Reply Quote 0
                • dslraser
                  dslraser Forum Testing Most Active @Dr. Bakterius last edited by

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

                  Dr. Bakterius liv-in-sky 3 Replies Last reply Reply Quote 0
                  • Dr. Bakterius
                    Dr. Bakterius Most Active @dslraser last edited by

                    @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 Reply Last reply Reply Quote 0
                    • liv-in-sky
                      liv-in-sky @dslraser last edited by

                      @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

                      1 Reply Last reply Reply Quote 1
                      • liv-in-sky
                        liv-in-sky @dslraser last edited by

                        @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

                        dslraser 3 Replies Last reply Reply Quote 1
                        • dslraser
                          dslraser Forum Testing Most Active @liv-in-sky last edited by

                          @liv-in-sky
                          Danke Dir.

                          1 Reply Last reply Reply Quote 0
                          • dslraser
                            dslraser Forum Testing Most Active @liv-in-sky last edited by

                            @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 Reply Last reply Reply Quote 0
                            • dslraser
                              dslraser Forum Testing Most Active @liv-in-sky last edited by

                              @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-sky 1 Reply Last reply Reply Quote 0
                              • liv-in-sky
                                liv-in-sky @dslraser last edited by

                                @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

                                dslraser 1 Reply Last reply Reply Quote 0
                                • dslraser
                                  dslraser Forum Testing Most Active @liv-in-sky last edited by

                                  @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-sky 1 Reply Last reply Reply Quote 0
                                  • liv-in-sky
                                    liv-in-sky @dslraser last edited by

                                    @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

                                    dslraser 1 Reply Last reply Reply Quote 0
                                    • dslraser
                                      dslraser Forum Testing Most Active @liv-in-sky last edited by

                                      @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 😅

                                      thewhobox 1 Reply Last reply Reply Quote 0
                                      • thewhobox
                                        thewhobox @dslraser last edited by

                                        @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();
                                        
                                        dslraser liv-in-sky 3 Replies Last reply Reply Quote 1
                                        • dslraser
                                          dslraser Forum Testing Most Active @thewhobox last edited by

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

                                          1 Reply Last reply Reply Quote 0
                                          • liv-in-sky
                                            liv-in-sky @thewhobox last edited by

                                            @thewhobox hi,

                                            bekomme das zurück

                                            unifiWLAN: Login Fehler! Error: self signed certificate
                                            
                                            thewhobox 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

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

                                            582
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            unifi
                                            170
                                            998
                                            309525
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo