Ansible files
This commit is contained in:
parent
274f15b213
commit
4308dae03d
|
@ -1,5 +1,5 @@
|
|||
# Run with
|
||||
# ansible-playbook pis/download-and-prepare-raspi-image.yml
|
||||
# ansible-playbook 01-download-and-prepare-raspi-image.yml
|
||||
---
|
||||
|
||||
- hosts: 127.0.0.1
|
||||
|
@ -88,7 +88,9 @@
|
|||
- "{{target_folder}}/mounted_raspi_image/system"
|
||||
- "{{target_folder}}/raspian_lite_latest.zip"
|
||||
- name: Final Image
|
||||
debug: |
|
||||
The prepared image is ready at {{target_folder}}.
|
||||
Copy it to sdcard with
|
||||
dd bs=4M if=the_image of=/dev/your/sdcard
|
||||
debug:
|
||||
msg: |
|
||||
The prepared image is ready at {{target_folder}}.
|
||||
Copy it to sdcard with
|
||||
dd bs=4M status=progress if=the_image of=/dev/your/sdcard
|
||||
use e.g. /dev/sdb not /dev/sdb1 !
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# where "raspberrypi" is the hostname of the pi
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
- hosts: kitchenpi
|
||||
gather_facts: false
|
||||
vars:
|
||||
timezone: "Europe/Berlin"
|
||||
|
@ -20,10 +20,7 @@
|
|||
default: root
|
||||
tasks:
|
||||
- name: Do apt update/upgrade
|
||||
apt:
|
||||
upgrade: yes
|
||||
update_cache: yes
|
||||
cache_valid_time: 7200
|
||||
apt: upgrade=yes update_cache=yes cache_valid_time=7200
|
||||
- name: Detect Raspi Model
|
||||
slurp: src=/sys/firmware/devicetree/base/model
|
||||
register: raspberry_model
|
||||
|
@ -85,13 +82,23 @@
|
|||
register: wifi_country
|
||||
changed_when: False
|
||||
ignore_errors: yes #to avoid error when WiFi is not present
|
||||
when: wifi_ssid | bool
|
||||
- name: Change WiFi country
|
||||
command: "raspi-config nonint do_wifi_country {{ wifi_country }}"
|
||||
when: wifi_ssid | bool
|
||||
- name: Set WiFi credentials
|
||||
command: "raspi-config nonint do_wifi_ssid_passphrase {{ wifi_ssid }} {{ lookup('keepass', wifi_pass_url) }}"
|
||||
when: wifi_ssid | bool
|
||||
# Message of the day
|
||||
- name: Set Message of the day
|
||||
copy: src=configs/motd/{{ inventory_hostname }} dest=/etc/motd
|
||||
#- name: Remove motd tail
|
||||
# copy: dest=/etc/motd.
|
||||
# LED off script
|
||||
- name: Copy led off script
|
||||
copy: src=configs/raspi-leds-off.sh dest=/usr/sbin/raspi-leds-off.sh mode="u+rwx"
|
||||
- name: Copy led off service
|
||||
copy: src=configs/raspi-leds-off.service dest=/lib/systemd/system/
|
||||
- name: Activate led off servic
|
||||
systemd: name=raspi-leds-off state=restarted enabled=yes daemon_reload=yes
|
||||
|
||||
handlers:
|
||||
- name: restart sshd
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
# Run with
|
||||
# ansible-playbook -i raspberrypi, 03-install-pulseaudio-bluetooth.yml
|
||||
# where "raspberrypi" is the hostname of the pi
|
||||
---
|
||||
|
||||
- hosts: raspberrypi
|
||||
gather_facts: false
|
||||
remote_user: root
|
||||
tasks:
|
||||
# --- Initial Checks ---
|
||||
- fail: msg="Make sure to set the MAC address of the BT device to variable 'bluetooth_mac_address_audio'"
|
||||
when: bluetooth_mac_address_audio is undefined
|
||||
- name: Detect Raspi Model
|
||||
slurp:
|
||||
src: /sys/firmware/devicetree/base/model
|
||||
register: raspberry_model
|
||||
- name: Decode Raspi Model
|
||||
set_fact:
|
||||
raspi_model: "{{ raspberry_model.content | b64decode }}"
|
||||
- name: Check if its a Raspberry 3 (where I've tested this)
|
||||
fail:
|
||||
msg: I've only tested this on Raspberry 3 Model Pi, this is something else
|
||||
when: 'not raspi_model.startswith("Raspberry Pi 3 Model B Plus")'
|
||||
#- name: Determine MAC Address of first Bluetooth device
|
||||
# command: 'hciconfig hci0'
|
||||
# register: hci_output
|
||||
#- name: Extract MAC address
|
||||
# set_fact:
|
||||
# hci0_addr: "{{ hci_output.stdout | regex_search('BD Address: ([^\\s]+)', '\\1') | first }}"
|
||||
# --- The actual work ---
|
||||
- name: Install pulseaudio packages
|
||||
apt:
|
||||
name:
|
||||
- pulseaudio
|
||||
- pulseaudio-utils
|
||||
- pulseaudio-module-bluetooth
|
||||
- alsa-utils
|
||||
- bluez-tools
|
||||
cache_valid_time: 7200
|
||||
state: present
|
||||
install_recommends: no
|
||||
- name: Add root to pulse-access group
|
||||
user:
|
||||
name: root
|
||||
groups:
|
||||
- pulse-access
|
||||
- pulse
|
||||
- audio
|
||||
append: yes
|
||||
- name: Copy DBus permission file
|
||||
copy: src=dbus-pulseaudio-bluetooth.conf dest=/etc/dbus-1/system.d/pulseaudio-bluetooth.conf
|
||||
- name: Copy Pulseaudio system-mode config file
|
||||
copy: src=pulseaudio.cfg dest=/etc/pulse/system.pa
|
||||
- name: Copy bluetoothd main.conf
|
||||
copy: src=bluetooth_main.conf dest=/etc/bluetooth/main.conf
|
||||
- name: Copy bluetoothd audio.conf
|
||||
copy: src=bluetooth_audio.conf dest=/etc/bluetooth/audio.conf
|
||||
- name: Copy bt-agent service file
|
||||
template: src=bt-agent.service dest=/lib/systemd/system/bt-agent.service
|
||||
- name: Copy pulseaudio service file
|
||||
copy: src=pulseaudio.service dest=/lib/systemd/system/
|
||||
- name: Copy Python script for discoverable and name setting
|
||||
copy:
|
||||
src: start_bt_discoverable.py
|
||||
dest: /bin/start_bt_discoverable
|
||||
mode: u=rwx,g=rx
|
||||
#- name: Stop Bluetooth
|
||||
# service:
|
||||
# name: bluetooth
|
||||
# state: stopped
|
||||
#- name: Set bluetooth device name
|
||||
# ini_file:
|
||||
# path: "/var/lib/bluetooth/{{hci0_addr}}/settings"
|
||||
# section: General
|
||||
# option: Alias
|
||||
# value: "{{bluetooth_name}}"
|
||||
#- name: Mark as discoverable
|
||||
# ini_file:
|
||||
# path: "/var/lib/bluetooth/{{hci0_addr}}/settings"
|
||||
# section: General
|
||||
# option: Discoverable
|
||||
# value: true
|
||||
- name: Enable and restart bluetooth
|
||||
service:
|
||||
name: bluetooth
|
||||
enabled: yes
|
||||
state: restarted
|
||||
- name: Enable and restart pulseaudio
|
||||
service:
|
||||
name: pulseaudio
|
||||
enabled: yes
|
||||
state: restarted
|
||||
- name: Enable and restart bt-agent
|
||||
service:
|
||||
name: bt-agent
|
||||
enabled: yes
|
||||
state: restarted
|
||||
daemon_reload: yes
|
|
@ -0,0 +1,44 @@
|
|||
# Install instructions taken from
|
||||
# https://github.com/mikebrady/shairport-sync/blob/master/INSTALL.md
|
||||
|
||||
---
|
||||
|
||||
- hosts: kitchenpi
|
||||
gather_facts: false
|
||||
vars:
|
||||
shairport_sync_version: "3.3.5"
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: Apt install dependencies
|
||||
apt:
|
||||
cache_valid_time: 7200
|
||||
state: present
|
||||
name:
|
||||
- build-essential
|
||||
- git
|
||||
- xmltoman
|
||||
- autoconf
|
||||
- automake
|
||||
- libtool
|
||||
- libpopt-dev
|
||||
- libconfig-dev
|
||||
- libasound2-dev
|
||||
- avahi-daemon
|
||||
- libavahi-client-dev
|
||||
- libssl-dev
|
||||
- libsoxr-dev
|
||||
- name: Build and Install Shairport sync (may take a while)
|
||||
script: "scripts/build-shairport-sync.sh ${shairport_sync_version}"
|
||||
args:
|
||||
creates: /usr/local/bin/shairport-sync
|
||||
- name: Copy config
|
||||
template: src=configs/shairport-sync.conf dest=/etc/shairport-sync.conf
|
||||
- name: Sync alsa config
|
||||
template: src=configs/asound.conf dest=/etc/asound.conf
|
||||
- name: Modify service file to run as root
|
||||
lineinfile:
|
||||
path: /lib/systemd/system/shairport-sync.service
|
||||
regexp: "^#?User="
|
||||
line: "User=root"
|
||||
- name: Restart shairport-sync
|
||||
systemd: name=shairport-sync state=restarted enabled=yes daemon_reload=yes
|
|
@ -1,10 +1,14 @@
|
|||
---
|
||||
|
||||
- hosts: raspberrypi
|
||||
- hosts: kitchenpi
|
||||
gather_facts: false
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: Apt install squeezelite package
|
||||
apt: name=squeezelite cache_valid_time=7200 state=present
|
||||
- name: Install config file
|
||||
template: src=squeezelite.cfg dest=/etc/default/squeezelite
|
||||
template: src=configs/squeezelite.cfg dest=/etc/default/squeezelite
|
||||
- name: Sync alsa config
|
||||
template: src=configs/asound.conf dest=/etc/asound.conf
|
||||
- name: Restart squeezelite
|
||||
systemd: name=squeezelite state=restarted enabled=yes daemon_reload=yes
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
# lirc needs to be custom compiled on this kernel
|
||||
# https://gist.github.com/billpatrianakos/cb72e984d4730043fe79cbe5fc8f7941
|
||||
- hosts: kitchenpi
|
||||
gather_facts: false
|
||||
remote_user: root
|
||||
tasks:
|
||||
#- name: Apt install lirc package
|
||||
# apt: name=lirc cache_valid_time=7200 state=present
|
||||
# ignore_errors: yes
|
||||
- name: Install config file lirc_options.conf
|
||||
copy: src=configs/lirc/lirc_options.conf dest=/etc/lirc/lirc_options.conf
|
||||
- name: Install config file lircd.conf
|
||||
copy: src=configs/lirc/lircd.conf dest=/etc/lirc/lircd.conf
|
||||
- name: Install remote file
|
||||
copy: src=configs/lirc/hauppauge.conf dest=/etc/lirc/hauppauge.conf
|
||||
- name: create temporary directory
|
||||
tempfile:
|
||||
state: directory
|
||||
suffix: temp
|
||||
register: tempdir
|
||||
- name: Copy over lirc customly compiled lirc packages
|
||||
copy:
|
||||
src: configs/lirc/debs/
|
||||
dest: "{{ tempdir.path }}"
|
||||
when: tempdir.path is defined
|
||||
- name: Install custom lirc package 1
|
||||
apt:
|
||||
deb: "{{ tempdir.path }}/liblirc0_0.10.1-5.2_armhf.deb"
|
||||
when: tempdir.path is defined
|
||||
- name: Install custom lirc package 2
|
||||
apt:
|
||||
deb: "{{ tempdir.path }}/liblircclient0_0.10.1-5.2_armhf.deb"
|
||||
when: tempdir.path is defined
|
||||
- name: Install custom lirc package 3
|
||||
apt:
|
||||
deb: "{{ tempdir.path }}/lirc_0.10.1-5.2_armhf.deb"
|
||||
when: tempdir.path is defined
|
||||
- name: Activate overlay in boot config
|
||||
lineinfile:
|
||||
path: /boot/config.txt
|
||||
regexp: "^#?dtoverlay=gpio-ir"
|
||||
line: "dtoverlay=gpio-ir,gpio_pin=17"
|
||||
register: boot_overlay
|
||||
- name: Restart lircd
|
||||
systemd: name=lircd state=restarted enabled=yes daemon_reload=yes
|
||||
- name: Reboot if boot overlay changed
|
||||
reboot:
|
||||
when: boot_overlay.changed
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
|
||||
- hosts: newrpi
|
||||
gather_facts: false
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: Deactivate normal audio
|
||||
lineinfile:
|
||||
path: /boot/config.txt
|
||||
regexp: "^#?dtparam=audio=on"
|
||||
line: "#dtparam=audio=on"
|
||||
register: boot_overlay1
|
||||
- name: Activate Hifiberry
|
||||
lineinfile:
|
||||
path: /boot/config.txt
|
||||
regexp: "^#?dtoverlay=hifiberry-amp"
|
||||
line: "dtoverlay=hifiberry-amp"
|
||||
register: boot_overlay2
|
||||
#- name: Reboot if boot overlay changed
|
||||
# reboot:
|
||||
# when: boot_overlay1.changed or boot_overlay2.changed
|
||||
|
||||
|
||||
## State in /boot/config.txt
|
||||
# dtoverlay=hifiberry-amp
|
||||
# # remove old:
|
||||
# #dtparam=audio=on
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
|
||||
- hosts: kitchenpi
|
||||
gather_facts: false
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: apt install libgpiod2
|
||||
apt: name=libgpiod2 cache_valid_time=7200 state=present
|
||||
- name: pip install adafruit-circuitpython-dht
|
||||
pip:
|
||||
name: adafruit-circuitpython-dht
|
||||
executable: pip3
|
||||
- name: Install script config
|
||||
template: src=configs/dht22_sensing.json dest=/etc/dht22_sensing.json
|
||||
- name: Install script
|
||||
copy: src=configs/dht22_sensing.py dest=/usr/bin/dht22_sensing owner=root mode=u+rwx
|
||||
- name: Install systemd service file
|
||||
copy: src=configs/dht22_sensing.service dest=/lib/systemd/system/
|
||||
- name: Add script to autostart and start now
|
||||
systemd: name=dht22_sensing state=restarted enabled=yes daemon_reload=yes
|
|
@ -0,0 +1,58 @@
|
|||
pcm.soundcard {
|
||||
type hw
|
||||
card {{alsa_card_name}}
|
||||
}
|
||||
|
||||
ctl.dmixer {
|
||||
type hw
|
||||
card {{alsa_card_name}}
|
||||
}
|
||||
|
||||
pcm.dmixer {
|
||||
type dmix
|
||||
ipc_key 1024
|
||||
slave {
|
||||
pcm "soundcard"
|
||||
channels 2
|
||||
}
|
||||
}
|
||||
|
||||
pcm.dmixer_plug {
|
||||
type plug
|
||||
slave {
|
||||
pcm "dmixer"
|
||||
}
|
||||
}
|
||||
|
||||
pcm.softvol_shairport {
|
||||
type softvol
|
||||
slave {
|
||||
pcm "dmixer_plug"
|
||||
}
|
||||
control {
|
||||
name "ShairPort-Sync Volume"
|
||||
card 0
|
||||
}
|
||||
}
|
||||
|
||||
pcm.softvol_squeezelite {
|
||||
type softvol
|
||||
slave {
|
||||
pcm "dmixer_plug"
|
||||
}
|
||||
control {
|
||||
name "SqueezeLite Volume"
|
||||
card 0
|
||||
}
|
||||
}
|
||||
|
||||
pcm.softvol_effects {
|
||||
type softvol
|
||||
slave {
|
||||
pcm "dmixer_plug"
|
||||
}
|
||||
control {
|
||||
name "Effect Volume"
|
||||
card 0
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"ha_url": "https://ha.bauer.tech",
|
||||
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxNjkxMWIzZmQ4ZWU0NDI0OTg0MjA0ZDllMDhkNGRlMCIsImlhdCI6MTU3ODE3MDU5MSwiZXhwIjoxODkzNTMwNTkxfQ.i7CdXEZy9DV9KPHAl-msK0rOfIUlPYo4zwwJ4UGhXuc",
|
||||
"dht_pin": "D12",
|
||||
"polling_sleep_time_seconds": 5,
|
||||
|
||||
"ha_temp_sensor_name": "{{sensor_room_name_ascii|lower}}_dht22_temperatur",
|
||||
"ha_temp_friendly_name": "{{sensor_room_name}} Temperatur",
|
||||
|
||||
"ha_humidity_sensor_name": "{{sensor_room_name_ascii|lower}}_dht22_luftfeuchtigkeit",
|
||||
"ha_humidity_friendly_name": "{{sensor_room_name}} Luftfeuchtigkeit"
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
import board
|
||||
import adafruit_dht
|
||||
|
||||
config = json.load(open("/etc/dht22_sensing.json"))
|
||||
dht_device = adafruit_dht.DHT22(getattr(board, config['dht_pin']))
|
||||
|
||||
|
||||
def send_to_home_assistant(temperature, humidity):
|
||||
headers = {
|
||||
'x-ha-access': config['token'],
|
||||
'Authorization': "Bearer {}".format(config['token'])
|
||||
}
|
||||
|
||||
temperature_url = "{}/api/states/sensor.{}".format(config['ha_url'], config['ha_temp_sensor_name'])
|
||||
temperatur_data = {
|
||||
"state": str(temperature),
|
||||
"attributes": {
|
||||
"device_class": "temperature",
|
||||
"friendly_name": config['ha_temp_friendly_name'],
|
||||
"unit_of_measurement": "°C"
|
||||
}
|
||||
}
|
||||
requests.post(temperature_url, json=temperatur_data, headers=headers)
|
||||
|
||||
humidity_url = "{}/api/states/sensor.{}".format(config['ha_url'], config['ha_humidity_sensor_name'])
|
||||
humidity_data = {
|
||||
"state": str(humidity),
|
||||
"attributes": {
|
||||
"device_class": "humidity",
|
||||
"friendly_name": config['ha_humidity_friendly_name'],
|
||||
"unit_of_measurement": "%"
|
||||
}
|
||||
}
|
||||
requests.post(humidity_url, json=humidity_data, headers=headers)
|
||||
|
||||
|
||||
def sense():
|
||||
try:
|
||||
send_to_home_assistant(dht_device.temperature, dht_device.humidity)
|
||||
except RuntimeError as error:
|
||||
# Errors happen fairly often, DHT's are hard to read, just keep going
|
||||
print(error.args[0])
|
||||
time.sleep(config['polling_sleep_time_seconds'])
|
||||
|
||||
|
||||
while True:
|
||||
sense()
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=DHT22 Temperature Humidity Sensing
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/python3 /usr/bin/dht22_sensing
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,3 @@
|
|||
ACTION=="add", SUBSYSTEM=="lirc", DRIVERS=="gpio_ir_recv", SYMLINK+="lirc-rx"
|
||||
ACTION=="add", SUBSYSTEM=="lirc", DRIVERS=="gpio-ir-tx", SYMLINK+="lirc-tx"
|
||||
ACTION=="add", SUBSYSTEM=="lirc", DRIVERS=="pwm-ir-tx", SYMLINK+="lirc-tx"
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,79 @@
|
|||
#
|
||||
# this config file was automatically generated
|
||||
# using lirc-0.7.0(any) on Sun Nov 28 20:25:09 2004
|
||||
#
|
||||
# contributed by
|
||||
#
|
||||
# brand: Hauppauge 350
|
||||
# Created: G.J. Werler (The Netherlands)
|
||||
# Project: Mythtv Fedora Pundit-R www.mythtvportal.com
|
||||
# Date: 2004/11/28
|
||||
# model no. of remote control: Hauppauge A415-HPG
|
||||
# devices being controlled by this remote: PVR-350
|
||||
#
|
||||
|
||||
begin remote
|
||||
|
||||
name Hauppauge
|
||||
bits 13
|
||||
flags RC5|CONST_LENGTH
|
||||
eps 30
|
||||
aeps 100
|
||||
|
||||
one 969 811
|
||||
zero 969 811
|
||||
plead 1097
|
||||
gap 114605
|
||||
toggle_bit 2
|
||||
|
||||
begin codes
|
||||
KEY_GOTO 0x00000000000017BB
|
||||
KEY_POWER 0x00000000000017BD
|
||||
KEY_TV 0x000000000000179C
|
||||
KEY_VIDEO 0x0000000000001798
|
||||
KEY_MUSIC 0x0000000000001799
|
||||
KEY_PICTURES 0x000000000000179A
|
||||
KEY_EPG 0x000000000000179B
|
||||
KEY_RADIO 0x000000000000178C
|
||||
KEY_UP 0x0000000000001794
|
||||
KEY_LEFT 0x0000000000001796
|
||||
KEY_RIGHT 0x0000000000001797
|
||||
KEY_DOWN 0x0000000000001795
|
||||
KEY_OK 0x00000000000017A5
|
||||
KEY_EXIT 0x000000000000179F
|
||||
KEY_MENU 0x000000000000178D
|
||||
KEY_VOLUMEUP 0x0000000000001790
|
||||
KEY_VOLUMEDOWN 0x0000000000001791
|
||||
KEY_CHANNEL 0x0000000000001792
|
||||
KEY_MUTE 0x000000000000178F
|
||||
KEY_CHANNELUP 0x00000000000017A0
|
||||
KEY_CHANNELDOWN 0x00000000000017A1
|
||||
KEY_RECORD 0x00000000000017B7
|
||||
KEY_STOP 0x00000000000017B6
|
||||
KEY_PREVIOUS 0x00000000000017B2
|
||||
KEY_PLAY 0x00000000000017B5
|
||||
KEY_FORWARD 0x00000000000017B4
|
||||
KEY_REWIND 0x00000000000017A4
|
||||
KEY_PAUSE 0x00000000000017B0
|
||||
KEY_FASTFORWARD 0x000000000000179E
|
||||
BTN_1 0x0000000000001781
|
||||
BTN_2 0x0000000000001782
|
||||
BTN_3 0x0000000000001783
|
||||
BTN_4 0x0000000000001784
|
||||
BTN_5 0x0000000000001785
|
||||
BTN_6 0x0000000000001786
|
||||
BTN_7 0x0000000000001787
|
||||
BTN_8 0x0000000000001788
|
||||
BTN_9 0x0000000000001789
|
||||
KEY_NUMERIC_STAR 0x000000000000178A
|
||||
BTN_0 0x0000000000001780
|
||||
KEY_NUMERIC_POUND 0x000000000000178E
|
||||
KEY_RED 0x000000000000178B
|
||||
KEY_GREEN 0x00000000000017AE
|
||||
KEY_YELLOW 0x00000000000017B8
|
||||
KEY_BLUE 0x00000000000017A9
|
||||
end codes
|
||||
|
||||
end remote
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[lircd]
|
||||
nodaemon = False
|
||||
driver = default
|
||||
device = /dev/lirc0
|
||||
listen = 0.0.0.0:2222
|
||||
output = /var/run/lirc/lircd
|
||||
pidfile = /var/run/lirc/lircd.pid
|
||||
plugindir = /usr/lib/arm-linux-gnueabihf/lirc/plugins
|
||||
permission = 666
|
||||
allow-simulate = No
|
||||
repeat-max = 600
|
|
@ -0,0 +1 @@
|
|||
include "hauppauge.conf"
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
WELCOME IN THE BEDROOM
|
||||
|
||||
!__________!
|
||||
|____ ____|
|
||||
_____ {____}{____} _____
|
||||
__|_*_|__%%%%%%%%%%%%__|_*_|
|
||||
| | %%%%%%%%%%%%%% | |
|
||||
%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%
|
||||
/||||||||||||||||||||\
|
||||
||||||||||||||||||||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
WELCOME IN THE KITCHEN
|
||||
|
||||
___
|
||||
.' _ '.
|
||||
/ /` `\ \
|
||||
| | [__]
|
||||
| | {{
|
||||
| | }}
|
||||
_ | | _ {{
|
||||
___________<_>_| |_<_>}}________
|
||||
.=======^=(___)=^={{====.
|
||||
/ .----------------}}---. \
|
||||
/ / {{ \ \
|
||||
/ / }} \ \
|
||||
( '=========================' )
|
||||
'-----------------------------'
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
THIS IS A NEW RASPI - CONFIGURE IT!
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[Unit]
|
||||
Description=Turn Raspi LEDs off at boot
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/raspi-leds-off.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo none > /sys/class/leds/led0/trigger
|
||||
echo none > /sys/class/leds/led1/trigger
|
||||
|
||||
echo 0 >/sys/class/leds/led0/brightness
|
||||
echo 0 >/sys/class/leds/led1/brightness
|
|
@ -0,0 +1,9 @@
|
|||
general =
|
||||
{
|
||||
name = "{{shairport_name}}";
|
||||
};
|
||||
|
||||
alsa =
|
||||
{
|
||||
output_device = "softvol_shairport";
|
||||
};
|
|
@ -1,3 +1,3 @@
|
|||
SL_NAME="{{squeezelite_name}}"
|
||||
SL_SOUNDCARD="pulse"
|
||||
SL_SOUNDCARD="softvol_squeezelite"
|
||||
SB_SERVER_IP="192.168.178.80"
|
|
@ -7,10 +7,20 @@ all:
|
|||
children:
|
||||
iot:
|
||||
hosts:
|
||||
raspberrypi:
|
||||
bluetooth_mac_address_audio: B8:27:EB:AA:23:4E
|
||||
bluetooth_name: MyTestRaspberry
|
||||
newrpi:
|
||||
squeezelite_name: MyTestRaspberry
|
||||
shairport_name: MyTestRaspberry
|
||||
alsa_card_name: 0
|
||||
sensor_room_name_ascii: testraum
|
||||
sensor_room_name: Test Raum
|
||||
heatingpi:
|
||||
bedroompi:
|
||||
kitchenpi:
|
||||
squeezelite_name: KitchenPi
|
||||
shairport_name: KitchenPi
|
||||
alsa_card_name: 0
|
||||
sensor_room_name_ascii: kueche
|
||||
sensor_room_name: Küche
|
||||
vars:
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/etc/modules
|
||||
-> bedroompi: snd-bcm2835
|
|
@ -1,56 +0,0 @@
|
|||
#!/usr/bin/pulseaudio -nF
|
||||
#
|
||||
|
||||
### Automatically restore the volume of streams and devices
|
||||
load-module module-device-restore
|
||||
load-module module-stream-restore
|
||||
load-module module-card-restore
|
||||
|
||||
### Disabled: Automatically load driver modules depending on the hardware available
|
||||
#.ifexists module-udev-detect.so
|
||||
#load-module module-udev-detect tsched=0
|
||||
#.else
|
||||
### Use the static hardware detection module (for systems that lack udev/hal support)
|
||||
#load-module module-detect
|
||||
#.endif
|
||||
|
||||
# this is used instead
|
||||
load-module module-alsa-card device_id=0
|
||||
# Parameters to try
|
||||
# tsched=true tsched_buffer_size=1048576 tsched_buffer_watermark=262144
|
||||
|
||||
|
||||
|
||||
### Load several protocols
|
||||
.ifexists module-esound-protocol-unix.so
|
||||
load-module module-esound-protocol-unix
|
||||
.endif
|
||||
# here I added anonymous logins from local system
|
||||
load-module module-native-protocol-unix auth-anonymous=1
|
||||
|
||||
### Automatically restore the default sink/source when changed by the user
|
||||
### during runtime
|
||||
### NOTE: This should be loaded as early as possible so that subsequent modules
|
||||
### that look up the default sink/source get the right value
|
||||
load-module module-default-device-restore
|
||||
|
||||
### Automatically move streams to the default sink if the sink they are
|
||||
### connected to dies, similar for sources
|
||||
load-module module-rescue-streams
|
||||
|
||||
### Make sure we always have a sink around, even if it is a null sink.
|
||||
load-module module-always-sink
|
||||
|
||||
### Automatically suspend sinks/sources that become idle for too long
|
||||
#load-module module-suspend-on-idle
|
||||
|
||||
### Enable positioned event sounds
|
||||
load-module module-position-event-sounds
|
||||
|
||||
|
||||
# enable network streaming from IPs 192.168.178.x
|
||||
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.178.0/24 auth-anonymous=1
|
||||
|
||||
# ### Automatically load driver modules for Bluetooth hardware
|
||||
load-module module-bluetooth-policy
|
||||
load-module module-bluetooth-discover
|
|
@ -1,9 +0,0 @@
|
|||
[Unit]
|
||||
Description=PulseAudio system server
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=pulseaudio --daemonize=no --system --log-target=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -5,8 +5,14 @@ amixer cset numid=3 2 # switches to HDMI
|
|||
amixer cset numid=3 1 # switches to headphone
|
||||
|
||||
|
||||
Set up PulseAudio
|
||||
-----------------
|
||||
PulseAudio
|
||||
-----------
|
||||
|
||||
- tried network streaming, works
|
||||
- tried bluetooth - somewhat works, sometimes stuttering
|
||||
- when media is already playing on device and then connecting it usually works fine
|
||||
- playing a second source at the same time gives ugly artifacts
|
||||
-> decided to use pure ALSA instead
|
||||
|
||||
|
||||
(also available in playbook TOOD)
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
ARG1=$1
|
||||
VERSION=${ARG1:="3.3.6"}
|
||||
|
||||
# Make a new temporary directory and go there
|
||||
tmp_dir=$(mktemp -d)
|
||||
cd $tmp_dir
|
||||
|
||||
# Clone, build and install
|
||||
git clone https://github.com/mikebrady/shairport-sync.git
|
||||
git reset --hard origin/$VERSION
|
||||
cd shairport-sync
|
||||
autoreconf -fi
|
||||
./configure --sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-systemd
|
||||
make
|
||||
make install
|
||||
|
||||
# Clean up
|
||||
cd ~
|
||||
rm -rf $tmp_dir
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import requests
|
||||
|
||||
key = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxNjkxMWIzZmQ4ZWU0NDI0OTg0MjA0ZDllMDhkNGRlMCIsImlhdCI6MTU3ODE3MDU5MSwiZXhwIjoxODkzNTMwNTkxfQ.i7CdXEZy9DV9KPHAl-msK0rOfIUlPYo4zwwJ4UGhXuc"
|
||||
url = "https://ha.bauer.tech"
|
||||
|
||||
headers = {
|
||||
'x-ha-access': key,
|
||||
'Authorization': "Bearer {}".format(key)
|
||||
}
|
||||
|
||||
apiurl = url + "/api/states/sensor.schlafzimmer_temperatur"
|
||||
|
||||
data = {
|
||||
"state": "19",
|
||||
"attributes": {
|
||||
"device_class": "temperature",
|
||||
"friendly_name": "Schlafzimmer Temperatur",
|
||||
"unit_of_measurement": "°C"
|
||||
}
|
||||
}
|
||||
r = requests.post(apiurl, json=data, headers=headers)
|
||||
|
||||
print(r)
|
Loading…
Reference in New Issue