Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. iobroker->Kodi/CEC->TV steuern

    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

    iobroker->Kodi/CEC->TV steuern

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

      @oliverio sagte in iobroker->Kodi/CEC->TV steuern:

      @djmarc75
      ich denke die Befehle sind schon bekannt und hier offiziell
      dokumentiert
      https://kodi.wiki/view/JSON-RPC_API

      Das ist ein böhmisches Dorf für mich.

      @psyganja sagte in iobroker->Kodi/CEC->TV steuern:

      Kodi selbst bietet sogar eine built in function

      Ok, Das dann in Verbindung mit

      @oliverio sagte in iobroker->Kodi/CEC->TV steuern:

      https://kodi.wiki/view/JSON-RPC_API

      Aber das ist mir alles zu hoch.
      Vll kann Dir @OliverIO da besser helfen ?!

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

        @psyganja
        also ich weiß nicht, was da für ein key gemeint ist, dan @arteck da erwähnt hat. wenn hier ssh gemeint ist, dann ist es nicht der richtige. kodi interessiert sich nicht für ssh
        wenn dann musst du die berechtigung aus kodi direkt nehmen
        https://forum.kodi.tv/showthread.php?tid=352997

        bitte prüfe der reihe nach folgendes, was du hier eingestellt hast
        https://kodi.wiki/view/Settings/Services/Control#Web_server

        Allow remote control via HTTP sollte angeschaltet sein
        Require authentication sollte ausgeschaltet sein. da es hier nur innerhalb deines netzwerkes ist und du hoffentlich keine ports am router freigegeben hast, ist das relativ gefahrlos
        das webinterface ist egal

        Zusätzlich noch diese beiden Optionen betrachten:
        https://kodi.wiki/view/Settings/Services/Control#Application_control
        Ganz einfach wäre es beides anzuschalten

        Danach kannst du es nochmal probieren, wie du es bereits am Anfang gemacht hast, als du das Ergebnis erhalten hast.
        Evtl kannst du uns noch sagen, wie du den Befehl abgesetzt hast.
        Aus einem Browser? aus einem Skript? Mit curl?

        @psyganja sagte in iobroker->Kodi/CEC->TV steuern:

        {"error":{"code":-32099,"message":"Bad client permission."},"id":1,"jsonrpc":"2.0"}

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

          @psyganja sagte in iobroker->Kodi/CEC->TV steuern:

          Kodi selbst bietet sogar eine built in function

          genau diese Funktionen nutzt das von dir erwähnte Addon.
          Allerdings werden diese Funktionen nicht durch das JSON-RPC Interface angeboten. Das Addon ergänzt das

          import xbmc
          import urllib.parse
          import sys
          import time
          
          try:
                  params = urllib.parse.parse_qs('&'.join(sys.argv[1:]))
                  command = params.get('command',None)
          except:
                  command = None
          
          if command and command[0] == 'activate':
                  xbmc.executebuiltin('CECActivateSource')
          
          elif command and command[0] == 'toggle':
                  xbmc.executebuiltin('CECToggleState')
          
          elif command and command[0] == 'standby':
                  xbmc.executebuiltin('CECStandby')
          
          elif command and command[0] == 'stop_and_standby':
                  if xbmc.Player().isPlaying():
                          xbmc.executebuiltin("PlayerControl(Stop)")
                          time.sleep(3)
                  xbmc.executebuiltin('CECStandby')
          
          P 1 Reply Last reply Reply Quote 0
          • P
            PsyGanja @OliverIO last edited by

            @oliverio said in iobroker->Kodi/CEC->TV steuern:

            @psyganja sagte in iobroker->Kodi/CEC->TV steuern:

            Kodi selbst bietet sogar eine built in function

            genau diese Funktionen nutzt das von dir erwähnte Addon.
            Allerdings werden diese Funktionen nicht durch das JSON-RPC Interface angeboten. Das Addon ergänzt das

            import xbmc
            import urllib.parse
            import sys
            import time
            
            try:
                    params = urllib.parse.parse_qs('&'.join(sys.argv[1:]))
                    command = params.get('command',None)
            except:
                    command = None
            
            if command and command[0] == 'activate':
                    xbmc.executebuiltin('CECActivateSource')
            
            elif command and command[0] == 'toggle':
                    xbmc.executebuiltin('CECToggleState')
            
            elif command and command[0] == 'standby':
                    xbmc.executebuiltin('CECStandby')
            
            elif command and command[0] == 'stop_and_standby':
                    if xbmc.Player().isPlaying():
                            xbmc.executebuiltin("PlayerControl(Stop)")
                            time.sleep(3)
                    xbmc.executebuiltin('CECStandby')
            

            Ja das habe ich verstanden. Die ganzen Einstellungen in Kodi bzgl fernsteuern über http habe ich schon gemacht. Sonst würde die App Yatse auch nicht funktionieren. Ich habe auch http Zugriff über User PWD konfiguriert.
            Den JSON Befehl habe ich über einen Browser abgegeben Könnte man das auch auf der Shell machen? Den curl Befehl habe ich noch nicht getestet.

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

              @psyganja
              ja, genau da kann man den Befehl cURL nutzen

              auf Deutsch
              https://wiki.ubuntuusers.de/cURL/

              und die original-Doku
              https://linux.die.net/man/1/curl

              du kannst aber innerhalb des javascript adapters auch jede andere kommunikationsbibliothek verwenden

              https://github.com/request/request
              https://axios-http.com/docs/intro
              https://github.com/node-fetch/node-fetch

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

                @oliverio

                Ich habe jetzt mal den cURL Befehl über eine Linux Console abgesetzt

                curl --header 'Content-Type: application/json' --data-binary '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"standby"}},"id":1}' http://192.168.188.46:8080/jsonrpc
                

                bekomme jetzt keine Fehlermeldung , aber der TV schaltet sich nicht aus. Kann natürlich auch nicht prüfen ob der CEC Befehl von Kodi ausgeführt wurde.

                DJMarc75 1 Reply Last reply Reply Quote 0
                • DJMarc75
                  DJMarc75 @PsyGanja last edited by

                  @psyganja das Command mal in CECstandby ändern- oder CECStandby

                  P 1 Reply Last reply Reply Quote 0
                  • P
                    PsyGanja @DJMarc75 last edited by

                    @djmarc75 said in iobroker->Kodi/CEC->TV steuern:

                    @psyganja das Command mal in CECstandby ändern- oder CECStandby

                    nein im Addon heißt der Befehl "standby"

                    elif command and command[0] == 'standby':
                            xbmc.executebuiltin('CECStandby')
                    
                    OliverIO 1 Reply Last reply Reply Quote 0
                    • OliverIO
                      OliverIO @PsyGanja last edited by OliverIO

                      @psyganja

                      dann könntest du erstmal ganz unten auf betriebssystemebene probieren
                      und direkt den cec-client installieren.
                      dieser steuert nämlich die eigentliche libCEC, welche auch Kodi verwendet.

                      https://www.linuxuprising.com/2019/07/raspberry-pi-power-on-off-tv-connected.html

                      und auch mal noch das Kapitel 5 hier beachten
                      https://kodi.wiki/view/CEC

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

                        @oliverio

                        Nun funktioniert es!
                        Ich habe das ganze heute im Schlafzimmer am TV versucht, nachdem ich keine Fehlermeldung zurück bekommen habe als ich den cURL Befehl abgesetzt hatte, der TV kann nicht über CEC ausgeschaltet werden😟
                        Also das ganze an einem anderen TV getestet und siehe da, der dieser cURL Befehl

                        curl -X POST -H 'Content-Type: application/json' --data-binary '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"standby"}},"id":1}' http://192.168.188.46:8080/jsonrpc
                        
                        

                        schaltet nun meinen TV aus! Zum einschalten dann einfach

                        curl -X POST -H 'Content-Type: application/json' --data-binary '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.json-cec","params":{"command":"activate"}},"id":1}' http://192.168.188.46:8080/jsonrpc
                        

                        Jetzt möchte ich mir ein Script bauen welches ich dann im iot Adapter als Alexa Gerät anlegen möchte. Jemand dafür ein Beispiel?

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

                          @psyganja
                          beachte mal noch das kabel thema,
                          evtl mal das hdmi-kabel vom tv wo es funktioniert hat auch an den anderen anschließen. evtl. fehlen da Leitungen im HDMI-Kabel, die man sonst nicht bemerkt.

                          oder auch den genauen tv-typ mit dem schlüsselwort cec im internet eingeben. wenn es nur am tv liegt, gibt es evtl auch ein firmware upgrade.
                          aber ist meist eher unwahrscheinlich.
                          wenn tv mal auf den markt ist, dann entwickeln die hersteller lieber neue modelle als sich um die alten zu kümmern

                          1 Reply Last reply Reply Quote 0
                          • P
                            PsyGanja last edited by

                            @oliverio
                            Ach das ist ein ganz alter billig Teil von TV.

                            Dort wo ich es brauche funktioniert es.

                            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

                            459
                            Online

                            31.9k
                            Users

                            80.1k
                            Topics

                            1.3m
                            Posts

                            iobroker kodi cec
                            4
                            38
                            1989
                            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