05-24-2025, 09:31 AM
Hello everyone,
the delivery of the MAX7219 modules arrived. I have connected six pieces 32x8 dot matrix modules together (~80cm length) and control them via an ESP32-C3. (The MAX7219 looks awsome) Instead of contacting the MPD directly, I used the moOdeaudio LCD updater this time. I was very lazy and used Tasmota instead of my own sketch. Data exchange takes place via MQTT. I don't know the Python syntax well, so improvements are welcome. (In particular, sending the MQTT message should be done directly via Python, not via Bash commands.)
[video=youtube]https://youtu.be/man-YX2euvE[/video]
moOdeaudio[LCDupdater] ----> MQTT-Broker[mosquitto] --WIFI--> (ESP32)Tasmota[Scripting] --> MAX7219
/var/local/www/commandw/lcd_updater.py
Tasmota must be compiled as follows: user_config_override.h
Tasmota-Script:
Best regards
the delivery of the MAX7219 modules arrived. I have connected six pieces 32x8 dot matrix modules together (~80cm length) and control them via an ESP32-C3. (The MAX7219 looks awsome) Instead of contacting the MPD directly, I used the moOdeaudio LCD updater this time. I was very lazy and used Tasmota instead of my own sketch. Data exchange takes place via MQTT. I don't know the Python syntax well, so improvements are welcome. (In particular, sending the MQTT message should be done directly via Python, not via Bash commands.)
[video=youtube]https://youtu.be/man-YX2euvE[/video]
moOdeaudio[LCDupdater] ----> MQTT-Broker[mosquitto] --WIFI--> (ESP32)Tasmota[Scripting] --> MAX7219
/var/local/www/commandw/lcd_updater.py
Code:
#!/usr/bin/python3
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2014 The moOde audio player project / Tim Curtis
#
#
# Stub script for lcd-updater.sh daemon
#
import subprocess
import html
file_path = "/var/local/www/currentsong.txt"
song_info = {}
# read file
with open(file_path, 'r', encoding='utf-8') as file:
for line in file:
if '=' in line:
key, value = line.strip().split('=', 1)
song_info[key] = value
artist = html.unescape(song_info.get('artist'))
album = html.unescape(song_info.get('album'))
title = html.unescape(song_info.get('title'))
# Bash commands
pubartist = [
'/usr/bin/mosquitto_pub',
'-h', 'localhost',
'-t', 'moodeaudio2/artist',
'-m', artist
]
pubalbum = [
'/usr/bin/mosquitto_pub',
'-h', 'localhost',
'-t', 'moodeaudio2/album',
'-m', album
]
pubtitle = [
'/usr/bin/mosquitto_pub',
'-h', 'localhost',
'-t', 'moodeaudio2/title',
'-m', title
]
# publish to broker
subprocess.run(pubartist)
subprocess.run(pubalbum)
subprocess.run(pubtitle)
Tasmota must be compiled as follows: user_config_override.h
Code:
#ifndef USE_SCRIPT
#define USE_SCRIPT
#endif
#ifdef USE_RULES
#undef USE_RULES
#endif
#ifndef SUPPORT_MQTT_EVENT
#define SUPPORT_MQTT_EVENT
#endif
#ifndef USE_WEBSEND_RESPONSE
#define USE_WEBSEND_RESPONSE
#endif
#ifndef USE_DISPLAY
#define USE_DISPLAY // Add Display support
#endif
#define USE_DISPLAY_MAX7219_MATRIX
#define USE_UTF8_LATIN1
Tasmota-Script:
Code:
>D 48
artist=""
album=""
title="moOde audio player"
>B
#publish
+>Subscribe artist, moodeaudio2/artist
+>Subscribe album, moodeaudio2/album
+>Subscribe title, moodeaudio2/title
->DisplayText %title%
>S
if mqttc>0
then
=#publish
endif
if upd[title]>0
then
if ((artist=="Radio station") {
->DisplayText %title% (%album%)
} else {
->DisplayText %artist% - %title% (%album%)
}
endif
Best regards