Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Iphone verliert immer das wlan???

    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

    Iphone verliert immer das wlan???

    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      denjo @OliverIO last edited by

      @oliverio mir kommen alle komisch vor weil Linux nicht mein perfektes Gebiet ist 😉 ja werde ich morgen machen. Habe nachtschicht jetzt. Danke erst mal

      Thomas Braun 1 Reply Last reply Reply Quote 0
      • Thomas Braun
        Thomas Braun Most Active @denjo last edited by Thomas Braun

        @denjo @OliverIO
        Ihr gestattet...

        sudo apt install hping3
        sudo -u iobroker mkdir /opt/iobroker/cmd
        sudo -u iobroker touch /opt/iobroker/cmd/iphone.sh
        sudo -u iobroker nano /opt/iobroker/cmd/iphone.sh
        

        Das skript in nano reinkopieren (geht in meiner shell mit der rechten Maustaste...)

        sudo -u iobroker chmod 0754 /opt/iobroker/cmd/iphone.sh
        

        Et voilà:

        echad@chet:/opt/iobroker/cmd $ ls -la /opt/iobroker/cmd/iphone.sh
        -rwxr-xr--+ 1 iobroker iobroker 678 Dec  2 00:03 /opt/iobroker/cmd/iphone.sh
        

        Funktioniert nur nicht, weil ich das skript nicht weiter angepasst habe:

        echad@chet:/opt/iobroker/cmd $ ./iphone.sh
        PING 192.168.1.209 (192.168.1.209) 56(84) bytes of data.
        ^C
        --- 192.168.1.209 ping statistics ---
        1 packets transmitted, 0 received, 100% packet loss, time 0ms
        
        Phone 192.168.1.209 is not present
        

        Man macht für den iobroker keine shell auf (oder gar eine root-shell...)

        OliverIO 1 Reply Last reply Reply Quote 0
        • OliverIO
          OliverIO @Thomas Braun last edited by OliverIO

          @thomas-braun sagte in Iphone verliert immer das wlan???:

          @denjo @OliverIO
          Ihr gestattet...

          sudo apt install hping3
          sudo -u iobroker mkdir /opt/iobroker/cmd
          sudo -u iobroker touch /opt/iobroker/cmd/iphone.sh
          sudo -u iobroker nano /opt/iobroker/cmd/iphone.sh
          

          Das skript in nano reinkopieren (geht in meiner shell mit der rechten Maustaste...)

          sudo -u iobroker chmod 0754 /opt/iobroker/cmd/iphone.sh
          

          Et voilà:

          echad@chet:/opt/iobroker/cmd $ ls -la /opt/iobroker/cmd/iphone.sh
          -rwxr-xr--+ 1 iobroker iobroker 678 Dec  2 00:03 /opt/iobroker/cmd/iphone.sh
          

          Funktioniert nur nicht, weil ich das skript nicht weiter angepasst habe:

          echad@chet:/opt/iobroker/cmd $ ./iphone.sh
          PING 192.168.1.209 (192.168.1.209) 56(84) bytes of data.
          ^C
          --- 192.168.1.209 ping statistics ---
          1 packets transmitted, 0 received, 100% packet loss, time 0ms
          
          Phone 192.168.1.209 is not present
          

          Man macht für den iobroker keine shell auf (oder gar eine root-shell...)

          Funktioniert schon, aber halt kein Handy gerade da unter der IP 🙂

          was denkst du wo der fehler herkommt? Im speziellen an der Stelle mit dem ^M

          bash: /opt/iobroker/cmd/iphone.sh: /bin/bash^M: Defekter Interpreter: Datei oder Verzeichnis nicht gefunden
          

          Ich tippe darauf, das er es aus einer Windows-Textdatei eingefügt hat, und die falschen Zeilenumbrüche drin sind.
          Von daher ist das einfügen in Nano der beste Weg

          Thomas Braun D 2 Replies Last reply Reply Quote 0
          • Thomas Braun
            Thomas Braun Most Active @OliverIO last edited by Thomas Braun

            @oliverio sagte in Iphone verliert immer das wlan???:

            Funktioniert schon, aber halt kein Handy gerade da unter der IP

            Falsch ausgedrückt von mir. Ich wollte sagen, dass es lediglich deswegen nicht funktioniert, weil ich den Inhalt des Skriptes nicht noch weiter angepasst habe.

            Ich tippe darauf, das er es aus einer Windows-Textdatei eingefügt hat, und die falschen Zeilenumbrüche drin sind.

            Keine Ahnung, da sind aber so einige komische Dinge zu finden. Auch die unbekannte gid da ist merkwürdig. Wo die her kommt? Keinen Schimmer.

            D 1 Reply Last reply Reply Quote 0
            • D
              denjo @Thomas Braun last edited by

              @thomas-braun ich habe sie über filezilla eingefügt und vorher sie von txt in sh Datei gebracht.

              1 Reply Last reply Reply Quote 0
              • D
                denjo @OliverIO last edited by

                @oliverio "sudo -u iobroker chmod 0754 /opt/iobroker/cmd/iphone.sh" sagtest du nicht 0755???

                OliverIO 1 Reply Last reply Reply Quote 0
                • OliverIO
                  OliverIO @denjo last edited by

                  @denjo
                  ja
                  0755
                  So ist es bei mir

                  D 2 Replies Last reply Reply Quote 0
                  • D
                    denjo @OliverIO last edited by

                    @oliverio okay, weil du in deiner neuen Anleitung dieses geschrieben hattest:

                    "sudo -u iobroker chmod 0754 /opt/iobroker/cmd/iphone.sh"

                    Werde es gleich nochmal ausprobieren wenn ich Feierabend habe bevor ich ins Bett gehe.

                    Besten Dank erst mal

                    1 Reply Last reply Reply Quote 0
                    • D
                      denjo @OliverIO last edited by denjo

                      @oliverio so ich habe jetzt alles genau so gemacht die datei hat 755 und besitzer und gruppe sind iobroker die datei sieht so aus

                      #!/bin/bash
                       #Enter your ip of your device here
                      DEVICES="192.168.178.82"
                       
                      for i in `echo $DEVICES`; do
                       
                          ping $i -c 1 
                          hping3 -2 -c 10 -p 5353 -i u1 $i -q >/dev/null 2>&1
                          sleep 1
                          # Only arp specific device, grep for a mac-address
                          status=`arp -an $i | awk '{print $4}' | grep "..:..:..:..:..:.."`
                          #A mac will be 17 characters including the ":"
                          IP=${i//./-}
                          if [ ${#status} -eq 17 ]; then
                              echo "Phone $i is detected!"
                       		curl http://192.168.178.98:8081/set/0_userdata.0.Anwesenheit.$IP?value=1
                          else
                              echo "Phone $i is not present"
                       		curl http://192.168.178.98:8081/set/0_userdata.0.Anwesenheit.$IP?value=0
                          fi
                      done
                      

                      am script habe ich nur die zahl auf 3 min geändert

                      function wakeIphone() {
                          exec("bash /opt/iobroker/cmd/iphone.sh")
                      }
                       
                      schedule ("*/3 * * * *", function(){
                              wakeIphone();  
                      });
                       
                      

                      wenn ich folgendes eingebe kommt das:

                      pi@raspberrypi:~ $ echad@chet:/opt/iobroker/cmd $ ls -la /opt/iobroker/cmd/iphone.sh
                      -bash: echad@chet:/opt/iobroker/cmd: Datei oder Verzeichnis nicht gefunden
                      pi@raspberrypi:~ $
                      

                      wobei datei und ordner da sind sehe ich ja über filezilla

                      und im log vom iobroker kommt wieder mal

                      
                      javascript.0
                      2099	2021-12-02 06:33:00.015	info	script.js.Test.iphone_anwesenheit: exec is not available. Please enable "Enable Exec" option in instance settings
                      
                      javascript.0
                      2099	2021-12-02 06:33:00.014	error	exec is not available. Please enable "Enable Exec" option in instance settings
                      

                      jetzt habe ich im java adapter die option exec erlauben aktiviert und es kommt im log keine fehler meldung mehr

                      Thomas Braun OliverIO 2 Replies Last reply Reply Quote 0
                      • Thomas Braun
                        Thomas Braun Most Active @denjo last edited by Thomas Braun

                        @denjo sagte in Iphone verliert immer das wlan???:

                        wobei datei und ordner da sind sehe ich ja über filezilla

                        Du hast ja auch mein Login prompt als Befehl eingegeben. Das funktioniert natürlich nicht.

                        chmod 0754

                        Hatte ich bewusst so gesetzt. Das Skript muss nicht für User außerhalb des iobrokers ausführbar sein.

                        D 1 Reply Last reply Reply Quote 0
                        • OliverIO
                          OliverIO @denjo last edited by OliverIO

                          @denjo
                          Du hast bei den curl Befehlen den falschen Port eingetragen. Simple api horcht bei mir auf 8087

                          OliverIO 1 Reply Last reply Reply Quote 0
                          • D
                            denjo @Thomas Braun last edited by

                            @thomas-braun

                            sudo -u iobroker chmod 0754 /opt/iobroker/cmd/iphone.sh
                            

                            habe das jetzt nochmal ausgeführt nun sind die rechte auf 754
                            und den port habe ich auf 5663 wie im adapter steht geämdert.

                            was soll ich jetzt genau eingeben zum testen?

                            Thomas Braun 1 Reply Last reply Reply Quote 0
                            • Thomas Braun
                              Thomas Braun Most Active @denjo last edited by

                              @denjo sagte in Iphone verliert immer das wlan???:

                              /opt/iobroker/cmd/iphone.sh

                              Du kannst jetzt z. B. in das Verzeichnis wechseln und das skript auf der Konsole ausführen:

                              cd /opt/iobroker/cmd/iphone.sh
                              ./iphone.sh
                              

                              Dann siehst du schon mal ob es drundsätzlich läuft.
                              Das dann ggf. in den ioBroker einweben ist der nächste Step.
                              Kann dir @OliverIO bestimmt noch helfen.

                              D 1 Reply Last reply Reply Quote 0
                              • D
                                denjo @Thomas Braun last edited by

                                @thomas-braun
                                habe jetzt die meldung

                                pi@raspberrypi:/opt/iobroker/cmd $ ./iphone.sh
                                PING 192.168.178.82 (192.168.178.82) 56(84) bytes of data.
                                From 192.168.178.98 icmp_seq=1 Destination Host Unreachable
                                
                                --- 192.168.178.82 ping statistics ---
                                1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
                                
                                Phone 192.168.178.82 is not present
                                curl: (52) Empty reply from server
                                pi@raspberrypi:/opt/iobroker/cmd $
                                
                                

                                das iphone ist gerade nicht da

                                1 Reply Last reply Reply Quote 0
                                • OliverIO
                                  OliverIO @OliverIO last edited by OliverIO

                                  @denjo sagte in Iphone verliert immer das wlan???:

                                  curl: (52) Empty reply from server

                                  hast du den simple api adapter installiert?
                                  hast du die portnummer angepasst?
                                  hast du datenpunkte angelegt, wo der status eingetragen werden soll?
                                  hast du die ggfs datenpunktbezeichnungen in den zeilen mit curl angepasst?

                                  D 1 Reply Last reply Reply Quote 0
                                  • D
                                    denjo @OliverIO last edited by

                                    @oliverio ja alles gemacht

                                    OliverIO 1 Reply Last reply Reply Quote 0
                                    • OliverIO
                                      OliverIO @denjo last edited by OliverIO

                                      @denjo

                                      dann dein angepasstes script hier nochmal posten

                                      deine Ausgabe sollte ungefähr so aussehen. Hier mit 2 IP-Adressen.
                                      eine erreichbar, eine nicht erreichbar

                                      PING 192.168.1.209 (192.168.1.209) 56(84) bytes of data.
                                      From 192.168.1.85 icmp_seq=1 Destination Host Unreachable
                                      
                                      --- 192.168.1.209 ping statistics ---
                                      1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
                                      
                                      Phone 192.168.1.209 is not present
                                      {"id":"0_userdata.0.Anwesenheit.192-168-1-209","value":0,"val":0}PING 192.168.1.225 (192.168.1.225) 56(84) bytes of data.
                                      
                                      --- 192.168.1.225 ping statistics ---
                                      1 packets transmitted, 0 received, 100% packet loss, time 0ms
                                      
                                      Phone 192.168.1.225 is detected!
                                      
                                      D 1 Reply Last reply Reply Quote 0
                                      • D
                                        denjo @OliverIO last edited by

                                        @OliverIO

                                        function wakeIphone() {
                                            exec("bash /opt/iobroker/cmd/iphone.sh")
                                        }
                                         
                                        schedule ("*/3 * * * *", function(){
                                                wakeIphone();  
                                        });
                                         
                                        
                                        OliverIO 1 Reply Last reply Reply Quote 0
                                        • OliverIO
                                          OliverIO @denjo last edited by

                                          @denjo

                                          ok und jetzt nochmal iphone.sh
                                          nur da musstest du ja etwas anpassen

                                          D 1 Reply Last reply Reply Quote 0
                                          • D
                                            denjo @OliverIO last edited by denjo

                                            @oliverio

                                            #!/bin/bash
                                             #Enter your ip of your device here
                                            DEVICES="192.168.178.82"
                                             
                                            for i in `echo $DEVICES`; do
                                             
                                                ping $i -c 1 
                                                hping3 -2 -c 10 -p 5353 -i u1 $i -q >/dev/null 2>&1
                                                sleep 1
                                                # Only arp specific device, grep for a mac-address
                                                status=`arp -an $i | awk '{print $4}' | grep "..:..:..:..:..:.."`
                                                #A mac will be 17 characters including the ":"
                                                IP=${i//./-}
                                                if [ ${#status} -eq 17 ]; then
                                                    echo "Phone $i is detected!"
                                             		curl http://192.168.178.98:5663/set/0_userdata.0.Anwesenheit.$IP?value=1
                                                else
                                                    echo "Phone $i is not present"
                                             		curl http://192.168.178.98:5663/set/0_userdata.0.Anwesenheit.$IP?value=0
                                                fi
                                            done
                                            
                                            

                                            das ist der erstellte datenpunkt

                                            "_id": "0_userdata.0.Anwesenheit",
                                            
                                            pi@raspberrypi:/opt/iobroker/cmd $ pi@raspberrypi:/opt/iobroker/cmd $ ./iphone.sh
                                            
                                            --- 192.168.178.82 ping statistics ---
                                            1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
                                            -bash: pi@raspberrypi:/opt/iobroker/cmd: Datei oder Verzeichnis nicht gefunden
                                            
                                            Phone 192.168.178.82 is not present
                                            curl: (52) Empty reply from server
                                            
                                            
                                            OliverIO 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

                                            683
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            ping adapter
                                            10
                                            65
                                            4142
                                            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