fhempy: googlecast

Begonnen von dominik, 04 Dezember 2020, 23:33:53

Vorheriges Thema - Nächstes Thema

kriegerkl

Hier ist die Ausgabe:


pi@raspberrypi:/opt/fhem/log $ sudo -u fhem pip3 install spotify_token
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting spotify_token
  Downloading spotify_token-1.0.0-py2.py3-none-any.whl (3.5 kB)
Requirement already satisfied: requests>=2.0 in /usr/local/lib/python3.8/site-packages (from spotify_token) (2.25.0)
Collecting beautifulsoup4>=4.8.1
  Downloading beautifulsoup4-4.9.3-py3-none-any.whl (115 kB)
     |████████████████████████████████| 115 kB 2.2 MB/s
Collecting lxml>=4.4.1
  Downloading lxml-4.6.2.tar.gz (3.2 MB)
     |████████████████████████████████| 3.2 MB 2.9 MB/s
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ysawmp8w/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ysawmp8w/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-2v7nuv37
         cwd: /tmp/pip-install-ysawmp8w/lxml/
    Complete output (3 lines):
    Building lxml version 4.6.2.
    Building without Cython.
    Error: Please make sure the libxml2 and libxslt development packages are installed.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.2.4; however, version 21.0 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.


Kann sein, dass ich  fhempy schon lokal gestartet hatte.
Ich starte den pi noch mal neu.

dominik

Mach mal
sudo apt install libxml2-dev libxslt-dev
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

kriegerkl

#182
Danke Dominik,

Zitat von: dominik am 29 Januar 2021, 23:48:15
Mach mal
sudo apt install libxml2-dev libxslt-dev
Das habe ich gemacht.

Im PhytonBindingLog gibt es weiter den Fehler:

2021-01-30 18:15:15,348 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-01-30 18:15:15,434 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
Traceback (most recent call last):
  File "FHEM/bindings/python/bin/fhempy", line 121, in <module>
    fpb.run()
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 463, in run
    asyncio.get_event_loop().run_until_complete(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 684, in _wrap_awaitable
    return (yield from awaitable.__await__())
  File "/opt/fhem/.local/lib/python3.8/site-packages/websockets/server.py", line 965, in __await_impl__
    server = await self._create_server()
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1463, in create_server
    raise OSError(err.errno, 'error while attempting '
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 15733): address already in use


Ich habe einmal sudo fuser 15733/tcp ausgeführt.
Ergebnis: 15733/tcp:            2271

pi@raspberrypi:~ $ ps -p 2271
  PID TTY          TIME CMD
2271 ?        00:00:22 fhempy

Wenn ich den Prozess kille, entsteht relativ schnell wieder ein neuer fhempy-Prozess.

Was kann das Problem sein?

Ich hatte die Installation befolgt und folgendes ausgeführt:

Systemd configuration for autostart
    curl -sL https://raw.githubusercontent.com/dominikkarall/fhempy/master/install_systemd_fhempy.sh | sudo -E bash -


Wird über den /etc/systemd/system/fhempy.service fhempy immer wieder gestartet oder liegt es an dem User pi unter dem er dort gestartet wird?

dominik

Geht es hier um einen fhempy peer oder eine lokale fhempy Installation? Lokale fhempy Installation bedeutet, dass es am gleichen Node wie FHEM läuft.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

kriegerkl

#184
Ich habe die nach Deiner Anleitung installiert: https://github.com/dominikkarall/fhempy


Systemd configuration for autostart
    curl -sL https://raw.githubusercontent.com/dominikkarall/fhempy/master/install_systemd_fhempy.sh | sudo -E bash -



Ich weiß nicht genau, was peer bedeutet.

dominik

Das Command ist NUR für fhempy peers notwendig, was das ist steht hier beschrieben:
https://github.com/dominikkarall/fhempy#fhempy-peers-eg-extend-bluetooth-range

Falls du die Commands nun auf deinem FHEM System ausgeführt hast, musst du nun folgendes machen
sudo systemctl stop fhempy
sudo systemctl disable fhempy
pip3 uninstall fhempy

Danach bitte nochmals im Log prüfen was drin steht.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

JF Mennedy

Hi,
peer bedeutet dass fhempy nicht auf dem selben raspi wie deine fhem Instanz läuft... Wenn fhempy auf dem selben  raspi läuft wie dein fhem Instanz ist es lokal... Wenn es lokal läuft brauchst du gar nicht den Dienst einzurichten. Dann erfolgt alles automatisch mit dem define des BindingsIO

define local_pybinding BindingsIo Python

Gruss Jan


kriegerkl

#187
Zitat von: JF Mennedy am 30 Januar 2021, 21:16:59
Hi,
peer bedeutet dass fhempy nicht auf dem selben raspi wie deine fhem Instanz läuft... Wenn fhempy auf dem selben  raspi läuft wie dein fhem Instanz ist es lokal... Wenn es lokal läuft brauchst du gar nicht den Dienst einzurichten. Dann erfolgt alles automatisch mit dem define des BindingsIO

define local_pybinding BindingsIo Python

Gruss Jan
Danke für die Erklärung.
Dann hab ich das jetzt verstanden.

Zitat von: dominik am 30 Januar 2021, 21:14:20
Das Command ist NUR für fhempy peers notwendig, was das ist steht hier beschrieben:
https://github.com/dominikkarall/fhempy#fhempy-peers-eg-extend-bluetooth-range

Falls du die Commands nun auf deinem FHEM System ausgeführt hast, musst du nun folgendes machen
sudo systemctl stop fhempy
sudo systemctl disable fhempy
pip3 uninstall fhempy

Danach bitte nochmals im Log prüfen was drin steht.

Im Log steht jetzt:


2021-01-30 21:34:31,530 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-01-30 21:34:31,619 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
Traceback (most recent call last):
  File "FHEM/bindings/python/bin/fhempy", line 121, in <module>
    fpb.run()
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 463, in run
    asyncio.get_event_loop().run_until_complete(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 684, in _wrap_awaitable
    return (yield from awaitable.__await__())
  File "/opt/fhem/.local/lib/python3.8/site-packages/websockets/server.py", line 965, in __await_impl__
    server = await self._create_server()
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1463, in create_server
    raise OSError(err.errno, 'error while attempting '
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 15733): address already in use
2021-01-30 21:34:54,624 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-01-30 21:34:54,732 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2021-01-30 21:34:54,777 - INFO     - asyncio: <Server sockets=(<asyncio.TransportSocket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 15733)>,)> is serving
2021-01-30 21:35:04,492 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 127.0.0.1
2021-01-30 21:35:04,591 - WARNING  - asyncio: Executing <Task pending name='Task-5' coro=<WebSocketServerProtocol.handler() running at /opt/fhem/.local/lib/python3.8/site-packages/websockets/server.py:191> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x75cf2ec8>()] created at /usr/local/lib/python3.8/asyncio/base_events.py:422> created at /opt/fhem/.local/lib/python3.8/site-packages/websockets/server.py:116> took 0.115 seconds


Sieht also besser aus.
Mein Device:

define castWohnzimmer PythonModule googlecast Wohnzimmer
attr castWohnzimmer userattr favorite_1 favorite_2 favorite_3 favorite_4 favorite_5
attr castWohnzimmer IODev local_pybinding
attr castWohnzimmer icon gassistant


sagt allerdings immer noch:
castWohnzimmer PythonBinding offline


Nach stop und start von fhem jetzt immerhin das:
castWohnzimmer Installing updates...

dominik

Ok, jetzt bitte nochmals
sudo -u fhem pip3 install spotify-token
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Sommerfeld

Hallo Domonik,
nach mehreren update Versuchen habe ich immer noch die
Version 1.26.
Was muss ich machen, um die aktuelle Version 1.27 zu
bekommen?
Internals:
   .FhemMetaInternals 1
   BindingType Python
   DEF        Python
   DeviceName ws:127.0.0.1:15733
   FD         231
   FUUID      5f513675-f33f-3b5c-6a47-c3e970bbbfac9d07
   FVERSION   10_BindingsIo.pm:0.182830/2019-01-16
   IP         127.0.0.1
   NAME       local_pybinding
   NR         1075
   NTFY_ORDER 50-local_pybinding
   PARTIAL   
   PORT       15733
   STATE      opened
   TYPE       BindingsIo
   WEBSOCKET  1
   localBinding 1
   nextOpenDelay 10
   .attraggr:
   .attrminint:
   READINGS:
     2021-01-31 08:45:25   info            ready
     2021-01-31 08:45:24   state           opened
     2021-01-27 08:05:42   version         0.1.26
   args:
     local_pybinding
     BindingsIo
     Python
   argsh:
Attributes:
     room       06_1_Sprachausgabe,hidden
   verbose    3


dominik

sudo -u fhem pip3 install --upgrade fhempy

Da ist mir leider ein Fehler im Update Prozess unterlaufen, daher muss nun einmalig manuell aktualisiert werden.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

Zitat von: dominik am 31 Januar 2021, 08:19:16
Ok, jetzt bitte nochmals
sudo -u fhem pip3 install spotify-token

Warte noch ein bisschen, ich werde die Abhängigkeit rausnehmen. In dem Package sind zu viele requirements drin die gar nicht gebraucht werden.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

So, Version 1.0.45. Installier bitte diese, damit sollte es mit spotify_token keine Probleme mehr geben, habe die Dependency entfernt.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

kriegerkl

Vielen Dank Dominik für Deine Hilfe
Es hat jetzt funktioniert.
Meine googlecast Devices waren jetzt verbunden (ready).

Dann habe ich allerdings den RPI rebootet, um zu überprüfen, ob es dann auch noch funktioniert.

Im local_pybinding-Device steht dann: "info Please wait till connection is established, might take a few minutes"
Und das steht auch noch nach Stunden da und die googlecast Devices sind offline.

Im PythonBinding.log steht folgendes:

2021-01-31 12:55:01,662 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-01-31 12:55:01,813 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2021-01-31 12:55:01,888 - INFO     - asyncio: <Server sockets=(<asyncio.TransportSocket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 15733)>,)> is serving
2021-01-31 12:55:09,521 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 127.0.0.1
2021-01-31 12:55:09,644 - WARNING  - asyncio: Executing <Task pending name='Task-5' coro=<WebSocketServerProtocol.handler() running at /opt/fhem/.local/lib/python3.8/site-packages/websockets/server.py:191> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x75cd8f88>()] created at /usr/local/lib/python3.8/asyncio/base_events.py:422> created at /opt/fhem/.local/lib/python3.8/site-packages/websockets/server.py:116> took 0.141 seconds
2021-01-31 12:55:09,980 - WARNING  - asyncio: Executing <Task pending name='Task-9' coro=<PyBinding.onMessage() running at /opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py:126> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, <TaskWakeupMethWrapper object at 0x74ae9f88>()] created at /usr/local/lib/python3.8/asyncio/base_events.py:422> created at /usr/local/lib/python3.8/asyncio/tasks.py:382> took 0.311 seconds


dominik

Kannst du bitte mal schauen ob im FHEM Log was steht?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik