@AndreasE112 So.... alles wieder gut... da war murphy wieder im Einsatz .... frohe weihnachten allerseits !!!
NEWS
Best posts made by AndreasE112
-
RE: Umzug auf SSD / IO broker läuft aber kein Zugriff
-
RE: Heizkörperthermostate ohne Batterie evtl. 220V
@homoran... ich habe überall steckdosen... ( an die 100 im ganzen Haus) und ausserdem gibt es noch die diejenigen die nicht so viele Steckdosen haben ja auch noch die tollen Fußleisten mit Kabelkanal
.
ich glaube das hier ist die Lösung :
Latest posts made by AndreasE112
-
Bräuchte untersützung bei python
Hi,
ich habe folgendes vor:
Einen Audistream per UDP empfangen und in eine Datei abspeichern.
Ich habe dazu ein python functions code schnipsel bekommen:import argparse import pathlib from pathlib import Path from socketserver import BaseRequestHandler, UDPServer from threading import Thread from time import sleep, monotonic_ns from wave import open as wave_open try: from pyaudio import PyAudio except ModuleNotFoundError: PyAudio = None STREAM_CHANNELS = 1 STREAM_WIDTH = 2 STREAM_RATE = 16000 def server( port, file=None, *, max_length=None, timeout=None, feedback=True, daemon=False): """Receive data on a UDP port and record to file or play as audio. Arguments: port - port number on which to listen file - file to which to write; if ending in '.wav' will record as audio samples; if None will play audio max_length - if not None, stop after this number of seconds from receipt of the first datagram timeout - if not None, once a datagram has been received, close file and return if datagrams doesn't arrive faster than this period in seconds feedback - if true, print a period on standard output for each 4kibytes received & diagnostics at shutdown daemon - if true, re-raise keyboard exception on exit """ wv = False if file is not None: file = Path(file) wv = file.suffix.lower() == '.wav' activity_timestamp_ns = None start_timestamp_ns = None count = 0 exception = None max_length_ns = None if max_length is None \ else max_length * 1000000000 timeout_ns = None if timeout is None else timeout * 1000000000 needs_starting = False class Handler(BaseRequestHandler): def handle(self): nonlocal activity_timestamp_ns, start_timestamp_ns nonlocal count, needs_starting if wv: fh.writeframesraw(self.request[0]) else: if needs_starting: needs_starting = False fh.start_stream() fh.write(self.request[0]) previous_count = count count += len(self.request[0]) if feedback and previous_count // 4096 != count // 4096: print('.', end='', flush=True) activity_timestamp_ns = monotonic_ns() if start_timestamp_ns is None: start_timestamp_ns = activity_timestamp_ns def read_stream(): nonlocal exception with UDPServer(('0.0.0.0', int(port)), Handler) as server: thread = Thread(target=server.serve_forever) thread.start() try: while True: sleep(1) now_ns = monotonic_ns() if timeout_ns is not None and \ activity_timestamp_ns is not None and \ now_ns - activity_timestamp_ns > timeout_ns: break if max_length_ns is not None and \ start_timestamp_ns is not None and \ now_ns - start_timestamp_ns > max_length_ns: break except KeyboardInterrupt as e: exception = e if feedback: diagnostic = ' & removing empty file' if \ activity_timestamp_ns is None else '' print(f'\nshutting down{diagnostic}', flush=True) server.shutdown() thread.join() if file is not None: with ( wave_open(str(file), 'wb') if wv else open(file, 'wb') ) as fh: if wv: fh.setnchannels(STREAM_CHANNELS) fh.setsampwidth(STREAM_WIDTH) fh.setframerate(STREAM_RATE) read_stream() if activity_timestamp_ns is None: file.unlink(missing_ok=True) else: if PyAudio: pya = PyAudio() else: raise ModuleNotFoundError( 'Install pyaudio for realtime streaming') needs_starting = True fh = pya.open(STREAM_RATE, STREAM_CHANNELS, pya.get_format_from_width(STREAM_WIDTH), output=True, start=not needs_starting ) read_stream() fh.stop_stream() fh.close() pya.terminate() if exception and daemon: raise exception if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("-p","--port", type=int) parser.add_argument("-f","--file", type=str) parser.add_argument("-l","--max_length", type=int) parser.add_argument("-t","--max_timeout", type=int) parser.add_argument("-fb","--feedback", type=bool) parser.add_argument("-dae","--daemon", type=bool) args = parser.parse_args() temp_file = open(args.file, "w") server(args.port,temp_file,args.max_length,args.max_timeout,args.feedback,args.daemon)
Ich habe im prinzip nur den unteren main anteil dazugebaut.
Ich kenne mich mit python noch nicht so gut aus. Da kommt immer diese Fehlermeldung beim aufruf:pi@iobroker:/opt/iobroker/iobroker-data/esphome.0 $ sudo python rec_stream_to_file.py --port 12345 --file test.wav --max_length 5 --max_timeout 1 --feedback tr Traceback (most recent call last): File "/opt/iobroker/iobroker-data/esphome.0/rec_stream_to_file.py", line 136, in <module> server(args.port,temp_file,args.max_length,args.max_timeout,args.feedback,args.daemon) TypeError: server() takes from 1 to 2 positional arguments but 6 were given
hat jemand ne idee was ich falsch mache ?
ok ich hab es noch nur mit port und file versucht dann kommt eine andere meldung
pi@iobroker:/opt/iobroker/iobroker-data/esphome.0 $ sudo python rec_stream_to_file.py --port 12345 --file test.wav Traceback (most recent call last): File "/opt/iobroker/iobroker-data/esphome.0/rec_stream_to_file.py", line 136, in <module> server(args.port,temp_file) File "/opt/iobroker/iobroker-data/esphome.0/rec_stream_to_file.py", line 39, in server file = Path(file) ^^^^^^^^^^ File "/usr/lib/python3.11/pathlib.py", line 872, in __new__ self = cls._from_parts(args) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/pathlib.py", line 510, in _from_parts drv, root, parts = self._parse_args(args) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/pathlib.py", line 494, in _parse_args a = os.fspath(a) ^^^^^^^^^^^^ TypeError: expected str, bytes or os.PathLike object, not TextIOWrapper
-
Voice Assistant Iobroker
Hallo,
gibt es für meine Raspberry PI4 einen Voice to text converter ?
Ich suche einen Ersatz für die Piper Pipeline welche bei HA genutzt wird.
Ich habe einen ESPHome voice assistent gebaut, der läuft. Wakeword wird erkannt.
Stream gestartet, dann nix mehr... weil ich HA parall zu IObroker im Docker laufen habe und damit ist es nicht möglich über Addons das Piper Addon zu intstallieren.Da ich sowieso eigentlich kein HA haben will, suche ich eine Alternative für oder parallel zu Iobroker.
Ich suche schon seit Wochen im Netz finde aber nichts richtiges.... der SEPIA Adapter wäre wohl scheinbar das richtige gewesen. Scheint aber tot zu sein. Ich möchte es vermeiden ein weiteres Raspberry nur als Voice to text server zu verwenden.
Hat noch jemand einen Vorschlag ?
-
RE: ESPHome kein Webinterface
ok bei mir wird kein Visit angezeigt. Eventuell liegt dass an den Keys.... beim device erstellen wird ja ein Key erzeugt. Aber im Adapter ist ja nur einer drin .... Ist der Key denn immer gleich.... sah für mich nicht so aus.
Ich konnte den Voice Assistent über mqtt so weit bringen dass er nun das Wake erkennt. Jetzt muss ich noch rausfinden wie ich den speech to text im IObroker umgesetzt bekomme.
Normalerweise würde der ESPHomeVA das zu einem in HA verfügbaren Konverter schicken. Den gibt es derzeit bei mir noch nicht. Hat damit jemand Erfahrungen. -
RE: ESPHome kein Webinterface
kann man neben der Device Config auch die virtuelle Oberfläche generieren so wie bei HA ? Ich habe jetzt einen Voice Assistent mit dem ESP32-S3 gebaut. Scheint laut log zu laufen. Aber wie kann ich jetzt die Device Parammeter andern /sehen ( also Button schalten , oder sehen ob das Wake word erkannt wird ).
-
RE: ESPHome kein Webinterface
Ich muss sagen ich war jetzt echt verzweifelt, ich das raspi neu aufgesetzt mit bookworm. Habe das Backup reingespielt und dann ESPHome. Sonst nix. ging nicht.... kommt der Fehler mit der Pillow lib, downgrade hat auf beta 8 hat auch nichts gebracht.
Während ich docker installiert habe ist mir dann aufgefallen, dass pip nicht installiert war.
-> "sudo apt install python3-pip"
und plötzlich läuft es mit der beta 8. was kann die 10er mehr ? -
RE: ESPHome kein Webinterface
@Ralf Meinst du das es funktionieren könnte wenn ich das Raspi in einer VDI neu installiere mit iob und esphome und und und .... und nachher das image auf die festplatte schiebe ?
-
RE: ESPHome kein Webinterface
ja und zwar glaub ich hier liegt das Problem:
pi@iobroker:/usr/local/bin/esphome $ python -m ensurepip Defaulting to user installation because normal site-packages is not writeable Looking in links: /tmp/tmplhmx8v86 Requirement already satisfied: setuptools in /usr/local/lib/python3.9/site-packages (58.1.0) Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (23.0.1)
Mal schauen wie sich das ändern lässt...
deinstallieren und neu installiert: Pfade zu pip sind nun scheinbar korrekt
pi@iobroker:/usr/local/lib $ pip -V pip 25.0 from /home/pi/.local/lib/python3.11/site-packages/pip (python 3.11) pi@iobroker:/usr/local/lib $ pip3 -V pip 25.0 from /home/pi/.local/lib/python3.11/site-packages/pip (python 3.11) pi@iobroker:/usr/local/lib $