music mouse setup

This commit is contained in:
Martin Bauer 2024-03-08 13:02:43 +01:00
parent fb6f10891d
commit ffeee72652
7 changed files with 148 additions and 20 deletions

View File

@ -41,13 +41,21 @@
- pi-disable-onboard-bluetooth
- bluetooth-monitor
- hosts: musicmouse
roles:
- pi-standard-setup
- pi-hifiberry-amp
- pi-musicmouse
- pi-squeezelite-custom
- pi-shairport
- pi-lirc
- bluetooth-monitor
#- hosts: octopi
# roles:
# - pi-dhtsensor
#- hosts: newrpi
# roles:
# - pi-standard-setup
# - pi-lirc

View File

@ -40,12 +40,13 @@ all:
sensor_room_name_ascii: wohnzimmeroben
sensor_room_name: WohnzimmerOben
hifiberry_overlay: hifiberry-dacplus
my_btmonitor_pl0: 68 # default is 73 - increase to make more sensitve (i.e. lower distances)
musicmouse:
squeezelite_name: MusicMouse
shairport_name: MusicMouse
alsa_card_name: 0
alsa_card_name: 1
hifiberry_overlay: hifiberry-dacplus
sensor_room_name: Kinderzimmer
sensor_room_name_ascii: kinderzimmer
newrpi:
squeezelite_name: MyTestRaspberry
shairport_name: MyTestRaspberry
@ -56,7 +57,9 @@ all:
server:
sensor_room_name: Arbeitszimmer
sensor_room_name_ascii: arbeitszimmer
my_btmonitor_pl0: 78
homeassistant:
sensor_room_name: Anschlussraum
sensor_room_name_ascii: anschlussraum
vars:
ansible_user: root
ansible_python_interpreter: /usr/bin/python3

View File

@ -0,0 +1,40 @@
general:
alsa_device: softvol_effects
mqtt:
user: musicmouse
password: KNLEFLZF94yA6Zhj141
server: homeassistant
hass_url: https://ha.bauer.tech
hass_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI4N2ExMzM2ZmQ4ZWQ0ZDgzOWZhMjU3NmZjYTg1NWQ1ZiIsImlhdCI6MTcwNDAyOTUyOSwiZXhwIjoyMDE5Mzg5NTI5fQ.vx9L5bTSey98uc8TwodShaEXSMr-hjXugPsNviR_fEw"
button_leds_brightness: 0.5
volume_increment: 5
min_volume: 23
max_volume: 70
serial_port: "/dev/ttyUSB0"
figures:
elefant:
id: "88041174e9"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
fuchs:
id: "8804ce7230"
colors: ["#F4D35E", "#F95738", "#F95738", "#083d77"]
eule:
id: "88040d71f0"
colors: ["#e5a200", "#f8e300", "w33", "w99"]
omnom:
id: "88043c6ede"
colors: ["#005102", "#fec800", "#005102", "#3bc405"]
eichhoernchen:
id: "88040b78ff"
colors: ["#ff0ada", "#4BC6B9", "#69045a", "#4BC6B9"]
hund:
id: "8804bc7444"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
hase:
id: "88044670ba"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
schneemann:
id: "88043f71c2"
colors: ["#ff0ada", "#4BC6B9", "#69045a", "#4BC6B9"]

View File

@ -0,0 +1,11 @@
[Unit]
Description=MusicMouse Player
After=network.target
[Service]
Type=simple
Restart=always
ExecStart=/opt/musicmouse_venv/bin/python /opt/musicmouse/espmusicmouse/host_driver/main.py /media/musicmouse/
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,15 @@
[global]
workgroup = WORKGROUP
logging = syslog@1
server role = standalone server
obey pam restrictions = no
unix password sync = no
[MusicMouse]
browseable = yes
path = /media/musicmouse
guest ok = no
writeable = yes
create mask = 666
force create mode = 666

View File

@ -0,0 +1,38 @@
---
- name: Packages
apt:
name:
- python3
- python3-pip
- python3-vlc # also in venv - but this installs vlc + deps
- samba
- name: Checkout Musicmouse repo
ansible.builtin.git:
repo: 'ssh://git@git.bauer.tech:2222/martin/musicmouse.git'
dest: '/opt/musicmouse'
version: 'release/1.1'
accept_hostkey: true
- name: Create and update virtual env
ansible.builtin.pip:
requirements: /opt/musicmouse/espmusicmouse/host_driver/requirements.txt
virtualenv: /opt/musicmouse_venv
virtualenv_command: "/usr/bin/python3 -m venv"
- name: Create media directory
file:
path: /media/musicmouse
state: directory
- name: Install config file
copy: src=config.yml dest=/media/musicmouse/config.yml
- name: Install systemd service file
copy: src=musicmouse.service dest=/etc/systemd/system/
- name: Add script to autostart and start now
systemd: name=musicmouse state=restarted enabled=yes daemon_reload=yes
- name: Samba setup
copy: src=smb.conf dest=/etc/samba/
- name: Restart samba
systemd: name=smbd state=restarted enabled=yes
# manual steps:
# - set samba passwords with smbpasswd
# - copy music into /media/musicmouse (or via samba share)
# - upload host driver?
# - manual patching of hassclient necessary :( loop has to be passed in, to not use running_event_loop

View File

@ -1,20 +1,33 @@
---
- hosts: server
roles:
- bluetooth-monitor
#- hosts: server
# roles:
# - bluetooth-monitor
#
#- hosts: musikserverwohnzimmeroben
# roles:
# - bluetooth-monitor
#
#- hosts: kitchenpi
# roles:
# - pi-disable-onboard-bluetooth
# - bluetooth-monitor
#
#- hosts: bedroompi
# roles:
# - pi-disable-onboard-bluetooth
# - bluetooth-monitor
- hosts: musikserverwohnzimmeroben
roles:
- bluetooth-monitor
#- hosts: musicmouse
# roles:
# - pi-standard-setup
# - pi-hifiberry-amp
# - pi-musicmouse
# - pi-squeezelite-custom
# - pi-shairport
# - pi-lirc
# - bluetooth-monitor
- hosts: kitchenpi
- hosts: homeassistant
roles:
- pi-disable-onboard-bluetooth
- bluetooth-monitor
- hosts: bedroompi
roles:
- pi-disable-onboard-bluetooth
- bluetooth-monitor
- bluetooth-monitor