schau mal hier, da wird das thema behandelt!
Posts by mega-hz
-
-
Als default Soundkarte ist BCM2835 ALSA (alsa-mixer) eingetragen
Hallo,
wenn als default soundkarte diese eingetragen ist, kommt auch über diese die Musik!
Du musst die Ausgabe auf BT umbiegen!
Wie genau, kann ICH Dir jetzt nicht sagen, will aber das gleiche machen wie Du (wenn ich mal dafür Zeit finde)
-
aha, ok, danke, werd ich beim nächsten Mal so machen!
-
zum richtigen format im Forum:
Ich habe den Quelltext kopiert, dann markiert und auf </> geklickt.
Wie macht man es damit die Einrückung nicht flöten geht?
zum "return" usw.
Eigentlich ist mein Programm nur eine große Schleife, daher verstehe ich das nicht mit der Funktion.
Wenn ich das richtig sehe, ist eine Funktion unter Python doch beginnend mit 'def xxx' oder nicht?
zum Vergleich der Messages:
Ich habe auf Windows den MQTT Explorer laufen und der zeigt mir genau die richtigen messages an!
Ich glaube mein komplettes Programm kann ich hier nicht einstellen, kann ich Dir das mal mailen?
Vielleicht magst Du ja mal drüber schauen..
-
habe ich ganz oben stehen.
muss das
gleich darunter stehen? Also so:?
Codebroker = '192.168.2.223' def on_message(client, flags, msg): message = msg.payload.decode() client = mqtt.Client() client.connect(broker, 1883, 60) client.subscribe("homesys/pi/#") client.on_message = on_message client.loop_start() return client
hier habe ich die calback-adds eingefügt:
Code
Display More#if SHIFT_IN != SHIFT_IN_Previous: (Um später wenns läuft nur bei Änderungen auszuführen) client.message_callback_add("homesys/pi/shift_outputs/get/+", print_input) state_topic = 'homesys/pi/shift_inputs/' for counter in range(32): client.publish(state_topic + 'in' + str(counter + 1), SHIFT_IN[counter]) SHIFT_IN_Previous = SHIFT_IN[:] #if SHIFT_OUT != SHIFT_OUT_Previous: (Um später wenns läuft nur bei Änderungen auszuführen) client.message_callback_add("homesys/pi/shift_outputs/set/+", print_output) state_topic = 'homesys/pi/shift_outputs/get/' for counter in range(32): client.publish(state_topic + 'out' + str(counter + 1), SHIFT_OUT[counter])
wäre das soweit richtig?
Was aber nicht geht:
Code
Display Moreif (msg.topic) == "homesys/pi/shift_outputs/set/out1": if message == "1": SHIFT_OUT[0] = 1 else: SHIFT_OUT[0] = 0 ODER: if (msg.topic) == "homesys/pi/shift_outputs/set/out1": Shift_OUT[0] = message (natürlich dann in einer Schleife für alle)
Für mich sieht es so aus, daß das eigentlich funktionieren müsste, tut es aber nicht.
Den Vorschlag das per JSON zu machen finde ich zwar interessant und ist bestimmt nicht verkehrt,
jedoch ist mqtt noch sehr neu für mich und mit Python tue ich mich auch noch schwer,
daher würde ich JSON erstmal für "später" mir vorbehalten.
-
-
Hallo, vielen Dank für die Beispiele!
Ich konnte diese auch prima anpassen, wenn ich es in meinem großen Programm mit einbinde, bleibt das Programm an der Auswertung der empfangenden Nachrichten hängen.
Codeif (msg.topic) == "homesys/pi/shift_outputs/set/out1": if message == "1": SHIFT_OUT[0] = 1 else: SHIFT_OUT[0] = 0 if (msg.topic) == "homesys/pi/shift_outputs/set/out2": if message == "1": SHIFT_OUT[1] = 1 else: SHIFT_OUT[1] = 0
der Programmkopf sieht so aus:
Python
Display More#!/usr/bin/python import os import time, random import paho.mqtt.client as mqtt import paho.mqtt.publish as publish import signal import subprocess import digitalio import board import RPi.GPIO as GPIO from PIL import Image, ImageDraw, ImageFont import adafruit_rgb_display.ili9341 as ili9341 from Hole_Lottozahlen import Hole_Lottozahlen from datetime import datetime from TFT_Buttons import Button import urllib.request from Shift_Register import get_bits_per_word, writedata, readdata, cleanup LAMPEN = False OUT_DATA = 19 CLOCK = 13 OUT_LATCH = 20 INP_DATA = 26 INP_LATCH = 21 PIEP = 4 ALIVE_PWM = 5 CAN_CE = 15 broker = '192.168.2.223' def on_message(client, flags, msg): message = msg.payload.decode() client = mqtt.Client() client.connect(broker, 1883, 60) client.subscribe("#") client.on_message = on_message client.loop_start() # Abfrage der Anzahl der vorhandenen Bits # Ist zemtral in Shift_Register.py festgelegt bits_per_word = get_bits_per_word() # Initialisierung der Variablen # Inputs vom 74HC165 Shift-Board SHIFT_IN = [0] * bits_per_word SHIFT_IN_Previous = [0] * bits_per_word # Outputs vom 74HC595 Shift-Board SHIFT_OUT = [0] * bits_per_word SHIFT_OUT_Previous = [0] * bits_per_word GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(PIEP, GPIO.OUT) # BRÃœLLER GPIO.setup(ALIVE_PWM, GPIO.OUT) # ALIVE-PWM GPIO.setup(CAN_CE, GPIO.OUT) # CAN-CE GPIO.output(CAN_CE, True) # CAN-CE auf High setzen
und das senden der Zustände der Outputs so:
Code
Display Morestate_topic = 'homesys/pi/shift_inputs/' client.publish(state_topic + 'in1', SHIFT_IN[0]) client.publish(state_topic + 'in2', SHIFT_IN[1]) client.publish(state_topic + 'in3', SHIFT_IN[2]) client.publish(state_topic + 'in4', SHIFT_IN[3]) client.publish(state_topic + 'in5', SHIFT_IN[4]) client.publish(state_topic + 'in6', SHIFT_IN[5]) client.publish(state_topic + 'in7', SHIFT_IN[6]) client.publish(state_topic + 'in8', SHIFT_IN[7]) client.publish(state_topic + 'in9', SHIFT_IN[8]) client.publish(state_topic + 'in10', SHIFT_IN[9]) client.publish(state_topic + 'in11', SHIFT_IN[10]) client.publish(state_topic + 'in12', SHIFT_IN[11]) client.publish(state_topic + 'in13', SHIFT_IN[12]) client.publish(state_topic + 'in14', SHIFT_IN[13]) client.publish(state_topic + 'in15', SHIFT_IN[14]) client.publish(state_topic + 'in16', SHIFT_IN[15]) client.publish(state_topic + 'in17', SHIFT_IN[16]) client.publish(state_topic + 'in18', SHIFT_IN[17]) client.publish(state_topic + 'in19', SHIFT_IN[18]) client.publish(state_topic + 'in20', SHIFT_IN[19]) client.publish(state_topic + 'in21', SHIFT_IN[20]) client.publish(state_topic + 'in22', SHIFT_IN[21]) client.publish(state_topic + 'in23', SHIFT_IN[22]) client.publish(state_topic + 'in24', SHIFT_IN[23]) client.publish(state_topic + 'in25', SHIFT_IN[24]) client.publish(state_topic + 'in26', SHIFT_IN[25]) client.publish(state_topic + 'in27', SHIFT_IN[26]) client.publish(state_topic + 'in28', SHIFT_IN[27]) client.publish(state_topic + 'in29', SHIFT_IN[28]) client.publish(state_topic + 'in30', SHIFT_IN[29]) client.publish(state_topic + 'in31', SHIFT_IN[30]) client.publish(state_topic + 'in32', SHIFT_IN[31]) SHIFT_IN_Previous = SHIFT_IN[:] # if SHIFT_OUT != SHIFT_OUT_Previous: writedata(SHIFT_OUT[:]) state_topic = 'homesys/pi/shift_outputs/get/' client.publish(state_topic + 'out1', SHIFT_OUT[0]) client.publish(state_topic + 'out2', SHIFT_OUT[1]) client.publish(state_topic + 'out3', SHIFT_OUT[2]) client.publish(state_topic + 'out4', SHIFT_OUT[3]) client.publish(state_topic + 'out5', SHIFT_OUT[4]) client.publish(state_topic + 'out6', SHIFT_OUT[5]) client.publish(state_topic + 'out7', SHIFT_OUT[6]) client.publish(state_topic + 'out8', SHIFT_OUT[7]) client.publish(state_topic + 'out9', SHIFT_OUT[8]) client.publish(state_topic + 'out10', SHIFT_OUT[9]) client.publish(state_topic + 'out11', SHIFT_OUT[10]) client.publish(state_topic + 'out12', SHIFT_OUT[11]) client.publish(state_topic + 'out13', SHIFT_OUT[12]) client.publish(state_topic + 'out14', SHIFT_OUT[13]) client.publish(state_topic + 'out15', SHIFT_OUT[14]) client.publish(state_topic + 'out16', SHIFT_OUT[15]) client.publish(state_topic + 'out17', SHIFT_OUT[16]) client.publish(state_topic + 'out18', SHIFT_OUT[17]) client.publish(state_topic + 'out19', SHIFT_OUT[18]) client.publish(state_topic + 'out20', SHIFT_OUT[19]) client.publish(state_topic + 'out21', SHIFT_OUT[20]) client.publish(state_topic + 'out22', SHIFT_OUT[21]) client.publish(state_topic + 'out23', SHIFT_OUT[22]) client.publish(state_topic + 'out24', SHIFT_OUT[23]) client.publish(state_topic + 'out25', SHIFT_OUT[24]) client.publish(state_topic + 'out26', SHIFT_OUT[25]) client.publish(state_topic + 'out27', SHIFT_OUT[26]) client.publish(state_topic + 'out28', SHIFT_OUT[27]) client.publish(state_topic + 'out29', SHIFT_OUT[28]) client.publish(state_topic + 'out30', SHIFT_OUT[29]) client.publish(state_topic + 'out31', SHIFT_OUT[30]) client.publish(state_topic + 'out32', SHIFT_OUT[31]) state_topic = 'homesys/pi/sys/cpu/' cmd = "cat /sys/class/thermal/thermal_zone0/temp | awk '{printf \"%.1f\", $(NF-0) / 1000}'" # pylint: disable=line-too-long Temp = subprocess.check_output(cmd, shell=True).decode("utf-8") publish.single(state_topic + 'temperatur', Temp, hostname=broker)
wenn ich die zeile mit
auskommentiere, läuft das Programm.
Habe ich da was falsch geschrieben? (in Bezug auf msg.topic)
Oder gehe ich die Sache da ganz falsch an?
Ich sehe es doch richtig, daß der Empfang -oben einmal gestartet- immer läuft, oder muss ich den jedes Mal neu "anschubsen"?
Auch könnte man die langen Zeilen von IN1-32 / OUT1-32 sicher in einer Schleife optimieren, wenn man weiss, wie...
-
ja hat es, aber wie sooft fehlt mir ein Tip oder ein Beispiel.. Python und seine Syntax...grrr
-
Hi,
sowas hatte ich auch schonmal, es lag daran, daß ich im MotionEye nur den Kamerastream aber ohne user/pw angegeben hatte.
Da ich vorher ebenfalls im Browser bzw. Oniv die Kamera angesprochen hatte, war für die Verbindung via MotionEye anscheinend kein /user/pw nötig,
nachdem ich den PI aber mal neustarten musste, fehlte ebenfalls das Bild.
Abhilfe brachte das einbinden von user/pw im Kamerastream-Url.
Was auch mal vorgekommen ist: Die Fritzbox hatte aus unerklärlichen Gründen der Kamera eine neue IP vergeben,
obwohl sie eigentlich statisch war.
Hoffe, ich konnte etwas helfen.
-
Hallo,
habe seit kurzen Home Assistant in Gebrauch in Verbindung mit einem PI:
Meine Hardware:
Server: Intel Atom 1.66GHz mit Debian Buster, Home Assistant, OMV, MotionEye und Icecast Server installiert.
PI: PI3 mit Debian Buster, 32 Inputs, 32 Outputs per 74595/74165, OMV(für zus.Backups), DataExplorer(für meinen B6ACv2) mit eigenem InfoScreen (2.8" TFT).
Auf dem Server läuft HA und empfängt per MQTT die vom PI gesendeten Statis der IO's.
Das Anzeigen der Zustände funktioniert bereits:
Python
Display Moreimport os import time, random import paho.mqtt.client as mqtt import paho.mqtt.publish as publish import subprocess import digitalio import board import RPi.GPIO as GPIO from PIL import Image, ImageDraw, ImageFont import adafruit_rgb_display.ili9341 as ili9341 from Hole_Lottozahlen import Hole_Lottozahlen from datetime import datetime from TFT_Buttons import Button import urllib.request from Shift_Register import get_bits_per_word, writedata, readdata, cleanup broker = '192.168.2.223' client.connect(broker, 1883, 60) client.loop_start() client = mqtt.Client() client.publish('homesys/pi/shift_inputs0', SHIFT_IN[1]) client.publish('homesys/pi/shift_inputs1', SHIFT_IN[2]) ... bis 32... client.publish('homesys/pi/shift_inputs32', SHIFT_IN[31]) client.publish('homesys/pi/shift_outputs/get/out1', SHIFT_OUT[0]) client.publish('homesys/pi/shift_outputs/get/out2', SHIFT_OUT[1]) ...bis 32... client.publish('homesys/pi/shift_outputs/get/out32', SHIFT_OUT[31])
Nun weiss ich nicht, wie ich auch per MQTT "empfangen" kann, die Beispiele die es per Google gibt, bringen mich nicht weiter.
Kann mir jemand helfen? Vielleicht mit einer Beispielzeile um von HA aus die OUTputs umschalten zu können?
Die Config im HA sieht für die IO's so aus:
Code
Display Morebinary_sensor: - platform: mqtt name: "IN1" state_topic: "homesys/pi/shift_inputs1" payload_on: "1" payload_off: "0" - platform: mqtt name: "IN2" state_topic: "homesys/pi/shift_inputs2" payload_on: "1" payload_off: "0" - platform: mqtt ............bis 32 switch: - platform: mqtt name: "OUT1" state_topic: "homesys/pi/shift_outputs/get/out1" # Topic to read the current state command_topic: "homesys/pi/shift_outputs/set/out1" # Topic to publish commands qos: 1 payload_on: 1 payload_off: 0 retain: true - platform: mqtt name: "OUT2" state_topic: "homesys/pi/shift_outputs/get/out2" # Topic to read the current state command_topic: "homesys/pi/shift_outputs/set/out2" # Topic to publish commands qos: 1 payload_on: 1 payload_off: 0 retain: true .... bis 32
Dabei habe ich gleich noch eine Frage:
Gibt es nicht eine andere Möglichkeit die IO's in die Config einzubinden die Platz sparender ist als wenn für jeden IO ein ganzes Gebet aufgeschrieben wird?
Gruß,
Wolfram.
-
Habs auch grade gesehen... Nein, nicht die ZIP Datei umbenennen sondern entpacken und die darin enthaltene Datei mit .img umbenennen!
-
probier doch das SD-Karten Image was ich weiter oben verlinkt habe, da funktioniert das Wetter, musst nur an Deine Location anpassen.
Gruß,
Wolfram.
-
Hallo,
ich möchte gerne einen eigenen Internetradio-"Sender" für mein lokales Netzwerk aufbauen.
Dazu habe ich auf meinem Server (Intel Atom mit Debian/OMV) ICECAST2, MPD und MPC installiert.
Ich habe es auch geschafft, daß Icecast2 2 Streams im Mountpoint Fenster anzeigt. MK-Radio und WF-Radio.
Im MPD habe ich zwei Outputs definiert, einmal mit MK-Radio und einmal mit WF-Radio.
Wenn ich nun in den MK-Radio/music ordner wechsel und mpd add / eingebe, fügt mpc alle Files in die Playliste.
Hier schon das erste Problem:
Habe im mpd.conf den Pfad für die Playlist auf den Ordner MK-Radio/playlist zeigen lassen.
Dort ist zwar eine von Hand angelegte Playlist.m3u, mpc "added" jedoch die Files anscheinend woanders hin.
Warum und wohin?
Mein Zweites Problem:
Da ich in der mpd.conf nur je einen Pfad für das music und einen für die playlist angeben kann, wie kann ich dem 2. Stream einen anderen Pfad zuweisen?
Geht das evt. direkt in der Output Definition?
Hire mal die mpd.conf: (/etc/mpd.conf)
Code
Display More# An example configuration file for MPD. # Read the user manual for documentation: http://www.musicpd.org/doc/user/ # or /usr/share/doc/mpd/html/user.html # Files and directories ####################################################### # # This setting controls the top directory which MPD will search to discover the # available audio files and add them to the daemon's online database. This # setting defaults to the XDG directory, otherwise the music directory will be # be disabled and audio files will only be accepted over ipc socket (using # file:// protocol) or streaming files over an accepted protocol. # music_directory "/srv/dev-disk-by-uuid-3508e320-1521-44a7-ba6a-c07fc0fb8b1f/#MP3/___INTERNETRADIO___/MK-RADIO/music" <-- wo kann ich den Pfad für den 2. Stream eintragen? # This setting sets the MPD internal playlist directory. The purpose of this # directory is storage for playlists created by MPD. The server will use # playlist files not created by the server but only if they are in the MPD # format. This setting defaults to playlist saving being disabled. # playlist_directory "/srv/dev-disk-by-uuid-3508e320-1521-44a7-ba6a-c07fc0fb8b1f/#MP3/___INTERNETRADIO___/MK-RADIO/playlist" # # This setting sets the location of the MPD database. This file is used to # load the database at server start up and store the database while the # server is not up. This setting defaults to disabled which will allow # MPD to accept files over ipc socket (using file:// protocol) or streaming # files over an accepted protocol. # db_file "/var/lib/mpd/tag_cache" # # These settings are the locations for the daemon log files for the daemon. # These logs are great for troubleshooting, depending on your log_level # settings. # # The special value "syslog" makes MPD use the local syslog daemon. This # setting defaults to logging to syslog, or to journal if mpd was started as # a systemd service. # log_file "/var/log/mpd/mpd.log" # # This setting sets the location of the file which stores the process ID # for use of mpd --kill and some init scripts. This setting is disabled by # default and the pid file will not be stored. # pid_file "/run/mpd/pid" # # This setting sets the location of the file which contains information about # most variables to get MPD back into the same general shape it was in before # it was brought down. This setting is disabled by default and the server # state will be reset on server start up. # state_file "/var/lib/mpd/state" # # The location of the sticker database. This is a database which # manages dynamic information attached to songs. # sticker_file "/var/lib/mpd/sticker.sql" # ############################################################################### # General music daemon options ################################################ # # This setting specifies the user that MPD will run as. MPD should never run as # root and you may use this setting to make MPD change its user ID after # initialization. This setting is disabled by default and MPD is run as the # current user. # user "mpd" # # This setting specifies the group that MPD will run as. If not specified # primary group of user specified with "user" setting will be used (if set). # This is useful if MPD needs to be a member of group such as "audio" to # have permission to use sound card. # #group "nogroup" # # This setting sets the address for the daemon to listen on. Careful attention # should be paid if this is assigned to anything other then the default, any. # This setting can deny access to control of the daemon. Choose any if you want # to have mpd listen on every address. Not effective if systemd socket # activation is in use. # # For network bind_to_address "localhost" # # And for Unix Socket #bind_to_address "/run/mpd/socket" # # This setting is the TCP port that is desired for the daemon to get assigned # to. # #port "6600" # # This setting controls the type of information which is logged. Available # setting arguments are "default", "secure" or "verbose". The "verbose" setting # argument is recommended for troubleshooting, though can quickly stretch # available resources on limited hardware storage. # #log_level "default" # # Setting "restore_paused" to "yes" puts MPD into pause mode instead # of starting playback after startup. # #restore_paused "no" # # This setting enables MPD to create playlists in a format usable by other # music players. # #save_absolute_paths_in_playlists "no" # # This setting defines a list of tag types that will be extracted during the # audio file discovery process. The complete list of possible values can be # found in the user manual. #metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc" # # This example just enables the "comment" tag without disabling all # the other supported tags: #metadata_to_use "+comment" # # This setting enables automatic update of MPD's database when files in # music_directory are changed. # auto_update "yes" # # Limit the depth of the directories being watched, 0 means only watch # the music directory itself. There is no limit by default. # auto_update_depth "10" # ############################################################################### # Symbolic link behavior ###################################################### # # If this setting is set to "yes", MPD will discover audio files by following # symbolic links outside of the configured music_directory. # #follow_outside_symlinks "yes" # # If this setting is set to "yes", MPD will discover audio files by following # symbolic links inside of the configured music_directory. # #follow_inside_symlinks "yes" # ############################################################################### # Zeroconf / Avahi Service Discovery ########################################## # # If this setting is set to "yes", service information will be published with # Zeroconf / Avahi. # #zeroconf_enabled "yes" # # The argument to this setting will be the Zeroconf / Avahi unique name for # this MPD server on the network. %h will be replaced with the hostname. # #zeroconf_name "Music Player @ %h" # ############################################################################### # Permissions ################################################################# # # If this setting is set, MPD will require password authorization. The password # setting can be specified multiple times for different password profiles. # #password "password@read,add,control,admin" # # This setting specifies the permissions a user has who has not yet logged in. # #default_permissions "read,add,control,admin" # ############################################################################### # Database ####################################################################### # #database { # plugin "proxy" # host "other.mpd.host" # port "6600" #} # Input ####################################################################### # input { plugin "curl" # proxy "proxy.isp.com:8080" # proxy_user "user" # proxy_password "password" } # QOBUZ input plugin input { enabled "no" plugin "qobuz" # app_id "ID" # app_secret "SECRET" # username "USERNAME" # password "PASSWORD" # format_id "N" } # TIDAL input plugin input { enabled "no" plugin "tidal" # token "TOKEN" # username "USERNAME" # password "PASSWORD" # audioquality "Q" } # Decoder ##################################################################### # decoder { plugin "hybrid_dsd" enabled "no" gapless "yes" } # ############################################################################### # Audio Output ################################################################ # # MPD supports various audio output types, as well as playing through multiple # audio outputs at the same time, through multiple audio_output settings # blocks. Setting this block is optional, though the server will only attempt # autodetection for one sound card. # # An example of an ALSA output: # #audio_output { # type "alsa" # name "My ALSA Device" # device "hw:0,0" # optional # mixer_type "hardware" # optional # mixer_device "default" # optional # mixer_control "PCM" # optional # mixer_index "0" # optional #} # # An example of an OSS output: # #audio_output { # type "oss" # name "My OSS Device" # device "/dev/dsp" # optional # mixer_type "hardware" # optional # mixer_device "/dev/mixer" # optional # mixer_control "PCM" # optional #} # # An example of a shout output (for streaming to Icecast): # audio_output { type "shout" # encoder "vorbis" # optional name "MK_Radio" host "localhost" port "8000" mount "/MK_Radio.mp3" password "geheim" # quality "5.0" bitrate "128" format "44100:16:2" encoding "mp3" # protocol "icecast2" # optional # user "source" # optional description "MK-Radio" # url "http://example.com" # optional genre "Knopfler" public "no" # optional timeout "5" # optional mixer_type "software" # optional replay_gain_handler "software" } audio_output { type "shout" # encoder "vorbis" # optional name "WF_Radio" host "localhost" port "8000" mount "/WF_Radio.mp3" password "geheim" # quality "5.0" bitrate "128" format "44100:16:2" encoding "mp3" # protocol "icecast2" # optional # user "source" # optional description "WF-Radio" # url "http://example.com" # optional genre "Classic Rock" public "no" # optional timeout "5" # optional mixer_type "software" # optional replay_gain_handler "software" } # # An example of a recorder output: # #audio_output { # type "recorder" # name "My recorder" # encoder "vorbis" # optional, vorbis or lame # path "/var/lib/mpd/recorder/mpd.ogg" ## quality "5.0" # do not define if bitrate is defined # bitrate "128" # do not define if quality is defined # format "44100:16:1" #} # # An example of a httpd output (built-in HTTP streaming server): # #audio_output { # type "httpd" # name "My HTTP Stream" # encoder "vorbis" # optional, vorbis or lame # port "8000" # bind_to_address "0.0.0.0" # optional, IPv4 or IPv6 # quality "5.0" # do not define if bitrate is defined # bitrate "128" # do not define if quality is defined # format "44100:16:1" # max_clients "0" # optional 0=no limit #} # # An example of a pulseaudio output (streaming to a remote pulseaudio server) # Please see README.Debian if you want mpd to play through the pulseaudio # daemon started as part of your graphical desktop session! # #audio_output { # type "pulse" # name "My Pulse Output" # server "remote_server" # optional # sink "remote_server_sink" # optional #} # # An example of a winmm output (Windows multimedia API). # #audio_output { # type "winmm" # name "My WinMM output" # device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional # or # device "0" # optional # mixer_type "hardware" # optional #} # # An example of an openal output. # #audio_output { # type "openal" # name "My OpenAL output" # device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional #} # ## Example "pipe" output: # #audio_output { # type "pipe" # name "my pipe" # command "aplay -f cd 2>/dev/null" ## Or if you're want to use AudioCompress # command "AudioCompress -m | aplay -f cd 2>/dev/null" ## Or to send raw PCM stream through PCM: # command "nc example.org 8765" # format "44100:16:2" #} # ## An example of a null output (for no audio output): # #audio_output { # type "null" # name "My Null Output" # mixer_type "none" # optional #} # ############################################################################### # Normalization automatic volume adjustments ################################## # # This setting specifies the type of ReplayGain to use. This setting can have # the argument "off", "album", "track" or "auto". "auto" is a special mode that # chooses between "track" and "album" depending on the current state of # random playback. If random playback is enabled then "track" mode is used. # See <http://www.replaygain.org> for more details about ReplayGain. # This setting is off by default. # replaygain "auto" # # This setting sets the pre-amp used for files that have ReplayGain tags. By # default this setting is disabled. # replaygain_preamp "0" # # This setting sets the pre-amp used for files that do NOT have ReplayGain tags. # By default this setting is disabled. # replaygain_missing_preamp "0" # # This setting enables or disables ReplayGain limiting. # MPD calculates actual amplification based on the ReplayGain tags # and replaygain_preamp / replaygain_missing_preamp setting. # If replaygain_limit is enabled MPD will never amplify audio signal # above its original level. If replaygain_limit is disabled such amplification # might occur. By default this setting is enabled. # #replaygain_limit "yes" # # This setting enables on-the-fly normalization volume adjustment. This will # result in the volume of all playing audio to be adjusted so the output has # equal "loudness". This setting is disabled by default. # volume_normalization "yes" # ############################################################################### # Character Encoding ########################################################## # # If file or directory names do not display correctly for your locale then you # may need to modify this setting. # filesystem_charset "UTF-8" # ###############################################################################
und hier die von Icecast2: (/etc/icecast2/icecast.xml)
Code
Display More<icecast> <!-- location and admin are two arbitrary strings that are e.g. visible on the server info page of the icecast web interface (server_version.xsl). --> <location>Mallinghausen</location> <admin>icemaster@localhost</admin> <!-- IMPORTANT! Especially for inexperienced users: Start out by ONLY changing all passwords and restarting Icecast. For detailed setup instructions please refer to the documentation. It's also available here: http://icecast.org/docs/ --> <limits> <clients>10</clients> <sources>2</sources> <queue-size>524288</queue-size> <client-timeout>30</client-timeout> <header-timeout>15</header-timeout> <source-timeout>10</source-timeout> <!-- If enabled, this will provide a burst of data when a client first connects, thereby significantly reducing the startup time for listeners that do substantial buffering. However, it also significantly increases latency between the source client and listening client. For low-latency setups, you might want to disable this. --> <burst-on-connect>1</burst-on-connect> <!-- same as burst-on-connect, but this allows for being more specific on how much to burst. Most people won't need to change from the default 64k. Applies to all mountpoints --> <burst-size>65535</burst-size> </limits> <authentication> <!-- Sources log in with username 'source' --> <source-password>geheim</source-password> <!-- Relays log in with username 'relay' --> <relay-password>geheim</relay-password> <!-- Admin logs in with the username given below --> <admin-user>mega-hz</admin-user> <admin-password>geheim</admin-password> </authentication> <!-- set the mountpoint for a shoutcast source to use, the default if not specified is /stream but you can change it here if an alternative is wanted or an extension is required <shoutcast-mount>/live.nsv</shoutcast-mount> --> <!-- Uncomment this if you want directory listings --> <!-- <directory> <yp-url-timeout>15</yp-url-timeout> <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url> </directory> --> <!-- This is the hostname other people will use to connect to your server. It affects mainly the urls generated by Icecast for playlists and yp listings. You MUST configure it properly for YP listings to work! --> <hostname>mega-hz-server</hostname> <!-- You may have multiple <listen-socket> elements --> <listen-socket> <port>8000</port> <!-- <bind-address>127.0.0.1</bind-address> --> <shoutcast-mount>/MK-Radio</shoutcast-mount> --> </listen-socket> <!-- <listen-socket> <port>8080</port> </listen-socket> --> <!-- <listen-socket> <port>8443</port> <ssl>1</ssl> </listen-socket> --> <!-- Global header settings Headers defined here will be returned for every HTTP request to Icecast. The ACAO header makes Icecast public content/API by default This will make streams easier embeddable (some HTML5 functionality needs it). Also it allows direct access to e.g. /status-json.xsl from other sites. If you don't want this, comment out the following line or read up on CORS. --> <http-headers> <header name="Access-Control-Allow-Origin" value="*" /> </http-headers> <!-- Relaying You don't need this if you only have one server. Please refer to the documentation for a detailed explanation. --> <!--<master-server>127.0.0.1</master-server>--> <!--<master-server-port>8001</master-server-port>--> <!--<master-update-interval>120</master-update-interval>--> <!--<master-password>hackme</master-password>--> <!-- setting this makes all relays on-demand unless overridden, this is useful for master relays which do not have <relay> definitions here. The default is 0 --> <!--<relays-on-demand>1</relays-on-demand>--> <!-- <relay> <server>127.0.0.1</server> <port>8080</port> <mount>/example.ogg</mount> <local-mount>/different.ogg</local-mount> <on-demand>0</on-demand> <relay-shoutcast-metadata>0</relay-shoutcast-metadata> </relay> --> <!-- Mountpoints Only define <mount> sections if you want to use advanced options, like alternative usernames or passwords --> <!-- Default settings for all mounts that don't have a specific <mount type="normal">. --> <!-- <mount type="default"> <public>0</public> <intro>/server-wide-intro.ogg</intro> <max-listener-duration>3600</max-listener-duration> <authentication type="url"> <option name="mount_add" value="http://auth.example.org/stream_start.php"/> </authentication> <http-headers> <header name="foo" value="bar" /> </http-headers> </mount> --> <!-- Normal mounts --> <!-- <mount type="normal"> <mount-name>/example-complex.ogg</mount-name> <username>othersource</username> <password>hackmemore</password> <max-listeners>1</max-listeners> <dump-file>/tmp/dump-example1.ogg</dump-file> <burst-size>65536</burst-size> <fallback-mount>/example2.ogg</fallback-mount> <fallback-override>1</fallback-override> <fallback-when-full>1</fallback-when-full> <intro>/example_intro.ogg</intro> <hidden>1</hidden> <public>1</public> <authentication type="htpasswd"> <option name="filename" value="myauth"/> <option name="allow_duplicate_users" value="0"/> </authentication> <http-headers> <header name="Access-Control-Allow-Origin" value="http://webplayer.example.org" /> <header name="baz" value="quux" /> </http-headers> <on-connect>/home/icecast/bin/stream-start</on-connect> <on-disconnect>/home/icecast/bin/stream-stop</on-disconnect> </mount> --> <!-- <mount type="normal"> <mount-name>/auth_example.ogg</mount-name> <authentication type="url"> <option name="mount_add" value="http://myauthserver.net/notify_mount.php"/> <option name="mount_remove" value="http://myauthserver.net/notify_mount.php"/> <option name="listener_add" value="http://myauthserver.net/notify_listener.php"/> <option name="listener_remove" value="http://myauthserver.net/notify_listener.php"/> <option name="headers" value="x-pragma,x-token"/> <option name="header_prefix" value="ClientHeader."/> </authentication> </mount> --> <fileserve>1</fileserve> <paths> <!-- basedir is only used if chroot is enabled --> <basedir>/usr/share/icecast2</basedir> <!-- Note that if <chroot> is turned on below, these paths must both be relative to the new root, not the original root --> <logdir>/var/log/icecast2</logdir> <webroot>/usr/share/icecast2/web</webroot> <adminroot>/usr/share/icecast2/admin</adminroot> <!-- <pidfile>/usr/share/icecast2/icecast.pid</pidfile> --> <!-- Aliases: treat requests for 'source' path as being for 'dest' path May be made specific to a port or bound address using the "port" and "bind-address" attributes. --> <!-- <alias source="/foo" destination="/bar"/> --> <!-- Aliases: can also be used for simple redirections as well, this example will redirect all requests for http://server:port/ to the status page --> <alias source="/" destination="/status.xsl"/> <!-- The certificate file needs to contain both public and private part. Both should be PEM encoded. <ssl-certificate>/usr/share/icecast2/icecast.pem</ssl-certificate> --> </paths> <logging> <accesslog>access.log</accesslog> <errorlog>error.log</errorlog> <!-- <playlistlog>playlist.log</playlistlog> --> <loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error --> <logsize>10000</logsize> <!-- Max size of a logfile --> <!-- If logarchive is enabled (1), then when logsize is reached the logfile will be moved to [error|access|playlist].log.DATESTAMP, otherwise it will be moved to [error|access|playlist].log.old. Default is non-archive mode (i.e. overwrite) --> <!-- <logarchive>1</logarchive> --> </logging> <security> <chroot>0</chroot> <!-- <changeowner> <user>nobody</user> <group>nogroup</group> </changeowner> --> </security> </icecast>
Der Radio Stream "MK_RADIO" funktioniert prima mit 2 Medion-Internetradios sowie dem NewTronRadio!
Der Radio Stream "WF_RADIO" wird angezeigt, es kommt aber nix.
Beide auch mit VLC getestet, gleiches Ergebnis.
Wer hat sowas auch schonmal gemacht und kann mir helfen?
Gruß,
Wolfram.
-
Nochmals vielen Dank für die schnelle Hilfe!
Das NewTron-Radio ist echt super geworden!
Wer ein komplett fertiges SD-Karten Image haben möchte, kann dies hier rutnerladen.
Image-Daten:
Debian Buster mit grafischer Oberfläche
NewTron-Radio inkl. Bugfixes
eingestellt für 5" Touch-TFT mit 800x480
Tonausgabe auf Klinkenbuchse eingestellt
16GB SD-Kartengröße
getestet und installiert auf einem PI2
WLAN Edimax installiert (SSID und PW ändern!)
User: pi Pw: 44324432
Wetterdaten müssten Eurem Standort und eurem API Key angepasst werden.
Gruß,
Wolfram.
-
das geht mit mit rechter Maustaste auf Lautsprecher-Symbol in der Taskleiste klicken und mit linker Maustaste das Audio-Ausgabegerät auswählen.
Ups, wusste ich nicht.kann man mal sehen wie selten der Desktop vom PI benutzt wird.. cool.
Mit dem Fullscreen und der Änderung durch die config klappt nun. Prima!Die Autostart Funktion über die .desktop datei funktioniert nun auch!
Nun ist alles wie es soll! Super Radio!
Funktionieren eigentlich auch noch die Skins des Ur-Tron Radios?
Falls Interesse besteht (und es erlaubt ist) , kann ich das nun erfolgreich eingerichtete SD-Karten Image hier verlinken, damit andere, die sich nicht alles wieder durchlesen wollen eine funktionierende Grund Installation haben.
-
PS: ich würde im NewTron-Radio Python-Skript nichts verändern.
fullscreen=True in .newtron-radio.conf reicht.
Nein, leider macht es keinen Unterschied ob in der Conf von False auf True geändert wird.
Habs jetzt direkt im Newtron-radio.py auf True gesetzt. Nun ist der Bildschirm auch auf volle Größe, egal ob auf dem 5" oder im VNC.
Musste noch die Audio Ausgabe von HDMI auf Klinkenbuchse umstellen, hab die Wetterdaten eingebaut und alles -bis auf
funktioniert prima!
Hier die Ausgabe von journalctl -u newtron-radio :
Code
Display Morepi@raspberrypi:~ $ journalctl -u newtron-radio -- Logs begin at Wed 2021-06-23 12:04:16 CEST, end at Wed 2021-06-23 12:24:54 CE Jun 23 12:04:23 raspberrypi systemd[1]: Starting NewTron-Radio Service... Jun 23 12:04:23 raspberrypi systemd[1]: Started NewTron-Radio Service. Jun 23 12:04:30 raspberrypi newtron-radio[443]: pygame 1.9.4.post1 Jun 23 12:04:30 raspberrypi newtron-radio[443]: Hello from the pygame community. Jun 23 12:04:30 raspberrypi newtron-radio[443]: trying fbcon Jun 23 12:04:30 raspberrypi newtron-radio[443]: Unable to open /dev/fb1 Jun 23 12:04:30 raspberrypi newtron-radio[443]: Driver fbcon failed! Jun 23 12:04:30 raspberrypi newtron-radio[443]: Is libts/libts-bin installed? Jun 23 12:04:30 raspberrypi newtron-radio[443]: Also check: Jun 23 12:04:30 raspberrypi newtron-radio[443]: SDL_FBDEV = /dev/fb1 Jun 23 12:04:30 raspberrypi newtron-radio[443]: SDL_MOUSEDEV = /dev/input/touchs Jun 23 12:04:30 raspberrypi newtron-radio[443]: SDL_MOUSEDRV = TSLIB Jun 23 12:04:30 raspberrypi newtron-radio[443]: Are theese correct? Set them in Jun 23 12:04:30 raspberrypi newtron-radio[443]: Traceback (most recent call last Jun 23 12:04:30 raspberrypi newtron-radio[443]: File "/usr/local/lib/newtron-v Jun 23 12:04:30 raspberrypi newtron-radio[443]: WIDTH, HEIGHT = disp_init() Jun 23 12:04:30 raspberrypi newtron-radio[443]: File "/usr/local/lib/newtron-v Jun 23 12:04:30 raspberrypi newtron-radio[443]: raise Exception('No suitable Jun 23 12:04:30 raspberrypi newtron-radio[443]: Exception: No suitable video dri Jun 23 12:04:30 raspberrypi systemd[1]: newtron-radio.service: Main process exit Jun 23 12:04:30 raspberrypi systemd[1]: newtron-radio.service: Failed with resul lines 1-22/22 (END)
-
Aha, komisch. Habe die Auflösung (beide Positionen im .py) in 800x420 geändert sowie in der newtron-radio.conf auf Fullscreen=True geändert.
Nun startet das Radio und spielt auch was ab! (Hatte auch nen reboot vorher gemacht).
Ton muss ich noch testen, bzw. später auf HifiBerry umleiten, das bekomme ich aber hin.
Warum aber stimmen die Display Größen nicht mit der physikalischen überein?
Display = 800 x 480, Newtron-radio=800x420 !
EDIT: Sorry, es scheint nur so das es abspielt, bei klick auf die Pausentaste stürzt es wieder ab.
Gruß,
Wolfram.
-
Code
Display Morepi@raspberrypi:~ $ newtron-radio pygame 1.9.4.post1 Hello from the pygame community. https://www.pygame.org/contribute.html using X-Display :0.0 Display area size: 800 x 400 /usr/local/lib/newtron-v3/newtron_radio.py:2079: DeprecationWarning: use_unicode parameter to ``MPDClient`` constructor is deprecated MPC = mpd.MPDClient(use_unicode=True) Zeile 249: timed out <class 'socket.timeout'>: timed out restarting mpd... connected using unix socket... /usr/local/lib/newtron-v3/newtron_radio.py:2083: DeprecationWarning: use_unicode parameter to ``MPDClient`` constructor is deprecated MPCTL = mpd.MPDClient(use_unicode=True) connected using unix socket... bye...
EDIT: wenn ich die Auflösung im newtron-radio.py auf 800x420 ändere, passt es, stürtz jedoch trotzdem ab wenn das voreingestellte RadioBob starten soll.
Da steht: Playing NO DATA
-
Hi,
JO, jetzt startet es, aber die unteren Buttons sind halb ausserhalb des Screens.
Und klicke ich auf Buttons stürzt das Radio ab.
(gestartet vom Desktop via VNC Viewer)
-
Beitrag "mpd mit pulseaudio und bluetooth (Raspi OS with Desktop)"
hatte dies vergessen... gerade ausgeführt... aber trotzdem:
Code
Display Morepi@raspberrypi:~ $ newtron-radio pygame 1.9.4.post1 Hello from the pygame community. https://www.pygame.org/contribute.html using X-Display :0.0 Display area size: 800 x 480 /usr/local/lib/newtron-v3/newtron_radio.py:2079: DeprecationWarning: use_unicode parameter to ``MPDClient`` constructor is deprecated MPC = mpd.MPDClient(use_unicode=True) connected using unix socket... /usr/local/lib/newtron-v3/newtron_radio.py:2083: DeprecationWarning: use_unicode parameter to ``MPDClient`` constructor is deprecated MPCTL = mpd.MPDClient(use_unicode=True) connected using unix socket... Traceback (most recent call last): File "/usr/local/lib/newtron-v3/newtron_radio.py", line 2129, in <module> SCR = Screen() File "/usr/local/lib/newtron-v3/newtron_radio.py", line 1409, in __init__ MPCTL.send_idle() # check for MPD-events AttributeError: 'MPDClient' object has no attribute 'send_idle' pi@raspberrypi:~ $