Seite 1 von 1

Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 15:36
von NetFritz
Hallo
Ich habe ein Harmony Hub um meine Geräte mit der App zu steuern.
http://www.logitech.com/de-de/product/h ... ub?crid=60
Ich möchte nun auch einen Raspberry Pi mit dem Hub steuern.
Dazu habe ich das Programm pyharmony https://github.com/rkitover/pyharmony auf meinen Pi
unter /var/myharmony auf meinen Raspberry Pi übertragen.
Das Script starte ich erstmals mit "root@raspberrypi:/var/myharmony# PYTHONPATH="." python harmony -h"
als Ausgabe bekomme ich

Code: Alles auswählen

usage: harmony [-h] --email EMAIL --password PASSWORD --harmony_ip HARMONY_IP
               [--harmony_port HARMONY_PORT]
               [--loglevel {DEBUG,INFO,WARNING,CRITICAL,ERROR}]

               {show_config,show_current_activity,start_activity,sync,turn_off,send_command}
               ...

pyharmony utility script

positional arguments:
  {show_config,show_current_activity,start_activity,sync,turn_off,send_command}
    show_config         Print the Harmony device configuration.
    show_current_activity
                        Print the current activity config.
    start_activity      Switch to a different activity.
    sync                Sync the harmony.
    turn_off            Send a turn off command to the harmony.
    send_command        Send a simple command.

optional arguments:
  -h, --help            show this help message and exit
  --harmony_port HARMONY_PORT
                        Network port that the Harmony is listening on.
                        (default: 5222)
  --loglevel {DEBUG,INFO,WARNING,CRITICAL,ERROR}
                        Logging level to print to the console. (default: INFO)

required arguments:
  --email EMAIL         Logitech username in the form of an email address.
                        (default: None)
  --password PASSWORD   Logitech password. (default: None)
  --harmony_ip HARMONY_IP
                        IP Address of the Harmony device. (default: None)
Also soweit alles o.k.
Rufe ich das Script so auf :
"root@raspberrypi:/var/myharmony# PYTHONPATH="." python harmony --email xxxxxx@gmx.de --password xxxxxxxxxxx --harmony_ip 192.168.2.61 show_config"
bekomme ich folgende Ausgabe als Fehlermeldung, die ich als Python Anfänger (mit Erfahrung in Perl und PHP) nicht deuten kann.

Code: Alles auswählen

INFO:   requests.packages.urllib3.connectionpool        Starting new HTTPS connection (1): svcs.myharmony.com
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/var/myharmony/harmony/__main__.py", line 230, in <module>
    main()
  File "/var/myharmony/harmony/__main__.py", line 227, in main
    sys.exit(args.func(args))
  File "/var/myharmony/harmony/__main__.py", line 48, in show_config
    client = get_client(args)
  File "/var/myharmony/harmony/__main__.py", line 41, in get_client
    token = login_to_logitech(args)
  File "/var/myharmony/harmony/__main__.py", line 24, in login_to_logitech
    token = auth.login(args.email, args.password)
  File "/var/myharmony/harmony/auth.py", line 41, in login
    result = resp.json().get('GetUserAuthTokenResult', None)
TypeError: 'dict' object is not callable
Was kann ich machen um die Fehler abzustellen?
Gruß NetFritz

Re: Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 16:00
von Sirius3
@NetFritz: das Programm erwartet eine neuere Version der requests-Bibliothek, als die, die Du installiert hast.

Re: Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 16:09
von NetFritz
Hallo
das Programm erwartet eine neuere Version der requests-Bibliothek, als die, die Du installiert hast.
Was meinst Du mit requests-Bibliothek?
Das der Harmony-Hub mit pyharmony nicht spricht weil die Harmony Soft zu neu ist.
Oder eine neuere requests-Bibliothek die mit import ? aufgerufen wird.
Gruß NetFritz

Re: Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 17:01
von Sirius3
@NetFritz: requests ist eine Python-Bibliothek, die anscheinend von pyharmony verwendet wird und die Version, die Du installiert hast, passt nicht zu der, die pyharmony erwartet.

Re: Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 17:04
von NetFritz
Hallo
Habe mal ein bischen gegoogelt.

Folgendes ausgeführt:
apt-get update
apt-get install pip
pip install requests
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/dist-packages
Cleaning up...

"root@raspberrypi:/var/myharmony# PYTHONPATH="." python harmony --email xxxxxx@gmx.de --password xxxxxxxxxxx --harmony_ip 192.168.2.61 show_config"

Code: Alles auswählen

INFO    requests.packages.urllib3.connectionpool        Starting new HTTPS connection (1): svcs.myharmony.com
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/var/www/myhouse/harmony/__main__.py", line 83, in <module>
    main()
  File "/var/www/myhouse/harmony/__main__.py", line 79, in main
    sys.exit(args.func(args))
  File "/var/www/myhouse/harmony/__main__.py", line 37, in show_config
    token = login_to_logitech(args)
  File "/var/www/myhouse/harmony/__main__.py", line 23, in login_to_logitech
    token = auth.login(args.email, args.password)
  File "/var/www/myhouse/harmony/auth.py", line 41, in login
    result = resp.json().get('GetUserAuthTokenResult', None)
TypeError: 'dict' object is not callable
Fehlerausgabe immer noch gleich.
Was kann ich machen?
Gruß NetFritz

Re: Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 17:15
von /me
NetFritz hat geschrieben:Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/dist-packages
Dann solltest du wohl mal --upgrade verwenden.

Re: Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 17:38
von NetFritz
Hallo
root@raspberrypi:/var/www/myhouse# pip install --upgrade requests
Downloading/unpacking requests from https://pypi.python.org/packages/source ... fd7b527260
Downloading requests-2.7.0.tar.gz (451Kb): 451Kb downloaded
Running setup.py egg_info for package requests

Installing collected packages: requests
Found existing installation: requests 0.12.1
Uninstalling requests:
Successfully uninstalled requests
Running setup.py install for requests

Successfully installed requests
Cleaning up...

"root@raspberrypi:/var/myharmony# PYTHONPATH="." python harmony --email xxxxxx@gmx.de --password xxxxxxxxxxx --harmony_ip 192.168.2.61 show_config"

Code: Alles auswählen

INFO:   requests.packages.urllib3.connectionpool        Starting new HTTPS connection (1): svcs.myharmony.com
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/var/myharmony/harmony/__main__.py", line 230, in <module>
    main()
  File "/var/myharmony/harmony/__main__.py", line 227, in main
    sys.exit(args.func(args))
  File "/var/myharmony/harmony/__main__.py", line 48, in show_config
    client = get_client(args)
  File "/var/myharmony/harmony/__main__.py", line 41, in get_client
    token = login_to_logitech(args)
  File "/var/myharmony/harmony/__main__.py", line 29, in login_to_logitech
    args.harmony_ip, args.harmony_port, token)
  File "/var/myharmony/harmony/auth.py", line 111, in swap_auth_token
    use_tls=False, use_ssl=False)
TypeError: connect() got an unexpected keyword argument 'use_ssl'

Code: Alles auswählen

root@raspberrypi:/var/myharmony# pip install --upgrade certifi
Downloading/unpacking certifi
  Downloading certifi-2015.04.28.tar.gz (370Kb): 370Kb downloaded
  Running setup.py egg_info for package certifi

Installing collected packages: certifi
  Running setup.py install for certifi

Successfully installed certifi
"root@raspberrypi:/var/myharmony# PYTHONPATH="." python harmony --email xxxxxx@gmx.de --password xxxxxxxxxxx --harmony_ip 192.168.2.61 show_config"

Code: Alles auswählen

INFO:   requests.packages.urllib3.connectionpool        Starting new HTTPS connection (1): svcs.myharmony.com
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/var/myharmony/harmony/__main__.py", line 230, in <module>
    main()
  File "/var/myharmony/harmony/__main__.py", line 227, in main
    sys.exit(args.func(args))
  File "/var/myharmony/harmony/__main__.py", line 48, in show_config
    client = get_client(args)
  File "/var/myharmony/harmony/__main__.py", line 41, in get_client
    token = login_to_logitech(args)
  File "/var/myharmony/harmony/__main__.py", line 29, in login_to_logitech
    args.harmony_ip, args.harmony_port, token)
  File "/var/myharmony/harmony/auth.py", line 111, in swap_auth_token
    use_tls=False, use_ssl=False)
TypeError: connect() got an unexpected keyword argument 'use_ssl'
Irgendwas mit ssl, aber was?
Brauche Hilfe.
Gruß NetFritz

Re: Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 19:50
von Sirius3
@NetFritz: Du mußt schon darauf achten, dass alle Abhängigkeiten in der richtigen Version vorliegen - auch sleekxmpp.

Re: Harmony Hub mit pyharmony

Verfasst: Sonntag 17. Mai 2015, 22:46
von NetFritz
Hallo
Du mußt schon darauf achten, dass alle Abhängigkeiten in der richtigen Version vorliegen - auch sleekxmpp
Ist mir schon klar aber wie erkenne ich das z.B. mit sleekxmpp ?
Habe jetzt gesehen das es wohl in der requirements.txt steht.
Da steht drin:
argparse
requests==1.1.0
sleekxmpp

sleekxmpp upgrade durchgeführt:

Code: Alles auswählen

root@raspberrypi:~# pip install --upgrade sleekxmpp
Downloading/unpacking sleekxmpp from https://pypi.python.org/packages/source/s/sleekxmpp/sleekxmpp-1.3.1.tar.gz#md5=ff7c1154fb238efa83ea64ef91a1bff4
  Downloading sleekxmpp-1.3.1.tar.gz (831Kb): 831Kb downloaded
  Running setup.py egg_info for package sleekxmpp

Installing collected packages: sleekxmpp
  Found existing installation: sleekxmpp 1.0beta5
    Uninstalling sleekxmpp:
      Successfully uninstalled sleekxmpp
  Running setup.py install for sleekxmpp

Successfully installed sleekxmpp
Cleaning up...
Wenn ich jetzt das Script ausführe bekomme ich noch Fehler aber auch eine lange Ausgabe von show_config die wohl i.o. ist.

Code: Alles auswählen

INFO:   requests.packages.urllib3.connectionpool        Starting new HTTPS connection (1): svcs.myharmony.com
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
INFO:   sleekxmpp.features.feature_bind.bind    JID set to: 1111/gatorade.
INFO:   harmony.auth    Received UUID from device: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
ERROR:  sleekxmpp.xmlstream.xmlstream   Error reading from XML stream.
INFO:   sleekxmpp.features.feature_bind.bind    JID set to: 1111/gatorade.
{
    "activity": [
        {
            "activityOrder": 2,
            "activityTypeDisplayName": "Default",
            "baseImageUri": "https://rcbu-test-ssl-amr.s3.amazonaws.com/",
            "controlGroup": [
                {
                    "function": [
                        {
                            "action": "{\"command\":\"0\",\"type\":\"IRCommand\",\"deviceId\":\"27212728\"}",
                            "label": "0",
                            "name": "Number0"
                        },
------------  usw. ---------------------
Was kann ich machen um diesen Fehler weg zu bekommen?
Schon mal vielen Dank für die schnelle Hilfe.
Gruß NetFritz