added ir server, squeeze server, ...

This commit is contained in:
Martin Bauer 2020-05-16 18:35:44 +02:00
parent 93034dd0ec
commit 23a2c1fb50
20 changed files with 227 additions and 47 deletions

View File

@ -1,17 +1,27 @@
--- ---
- hosts: bedroompi, kitchenpi #- hosts: bedroompi, kitchenpi
roles: # roles:
- pi-standard-setup # - pi-standard-setup
- pi-squeezelite-custom # - pi-squeezelite-custom
- pi-shairport # - pi-shairport
- pi-lirc # - pi-lirc
- pi-dhtsensor # - pi-dhtsensor
#
#- hosts: esszimmerradio
# roles:
# - pi-standard-setup
# - pi-squeezelite-custom
# - pi-shairport
# - pi-lirc
# - pi-sispmctl
#
- hosts: esszimmerradio - hosts: musikserverwohnzimmeroben
roles: roles:
- pi-standard-setup #- pi-standard-setup
- pi-squeezelite-custom #- pi-squeezelite-custom
- pi-shairport #- pi-shairport
- pi-lirc - pi-irserver
- pi-sispmctl
#- pi-dhtsensor #- pi-dhtsensor
#- pi-squeezeserver

View File

@ -21,9 +21,17 @@ all:
sensor_room_name: Küche sensor_room_name: Küche
esszimmerradio: # oben, eltern esszimmerradio: # oben, eltern
squeezelite_name: Esszimmer squeezelite_name: Esszimmer
shairport_name: EsszimmerRadio shairport_name: EsszimmerRadioOben
wifi_ssid: BauerWLAN alsa_card_name: Device
squeezeserver: 192.168.178.100
configure_wifi: true
musikserverwohnzimmeroben: # oben, eltern
squeezelite_name: Wohnzimmer
shairport_name: WohnzimmerRadioOben
alsa_card_name: 0 alsa_card_name: 0
squeezeserver: 192.168.178.100
sensor_room_name_ascii: wohnzimmeroben
sensor_room_name: WohnzimmerOben
newrpi: newrpi:
squeezelite_name: MyTestRaspberry squeezelite_name: MyTestRaspberry
shairport_name: MyTestRaspberry shairport_name: MyTestRaspberry
@ -35,5 +43,8 @@ all:
ansible_user: root ansible_user: root
ansible_python_interpreter: /usr/bin/python3 ansible_python_interpreter: /usr/bin/python3
squeezeserver: 192.168.178.80 squeezeserver: 192.168.178.80
router_ip: 192.168.178.1
home_assistant_url: https://ha.bauer.tech home_assistant_url: https://ha.bauer.tech
home_assistant_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxNjkxMWIzZmQ4ZWU0NDI0OTg0MjA0ZDllMDhkNGRlMCIsImlhdCI6MTU3ODE3MDU5MSwiZXhwIjoxODkzNTMwNTkxfQ.i7CdXEZy9DV9KPHAl-msK0rOfIUlPYo4zwwJ4UGhXuc home_assistant_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxNjkxMWIzZmQ4ZWU0NDI0OTg0MjA0ZDllMDhkNGRlMCIsImlhdCI6MTU3ODE3MDU5MSwiZXhwIjoxODkzNTMwNTkxfQ.i7CdXEZy9DV9KPHAl-msK0rOfIUlPYo4zwwJ4UGhXuc
configure_wifi: false
wifi_ssid: BauerWLAN

View File

@ -25,6 +25,9 @@ class Filter:
return abs(val - self.mean()) < self.max_mean_deviation return abs(val - self.mean()) < self.max_mean_deviation
def add_if_valid(self, val): def add_if_valid(self, val):
if val is None:
return False
if self.is_valid_value(val): if self.is_valid_value(val):
self.values.append(val) self.values.append(val)
if len(self.values) > self._length: if len(self.values) > self._length:
@ -66,16 +69,9 @@ def send_to_home_assistant(temperature, humidity):
requests.post(humidity_url, json=humidity_data, headers=headers) requests.post(humidity_url, json=humidity_data, headers=headers)
last_values = []
def filter(value):
last_values.append(value)
if __name__ == "__main__": if __name__ == "__main__":
temp_filter = Filter(10, 5) temp_filter = Filter(2, 5)
humidity_filter = Filter(10, 5) humidity_filter = Filter(3, 5)
while True: while True:
sensor = Adafruit_DHT.DHT22 sensor = Adafruit_DHT.DHT22

View File

@ -0,0 +1,53 @@
[REMOTE]
[NAME]hauppauge
[TIMING]
[0][N]0[RC]2[RP]87[FREQ]36[RC5]
[COMMANDS]
[BTN_1][T]0[D]11011110000001
[BTN_2][T]0[D]11011110000010
[BTN_3][T]0[D]11011110000011
[BTN_4][T]0[D]11011110000100
[BTN_5][T]0[D]11011110000101
[BTN_6][T]0[D]11011110000110
[BTN_7][T]0[D]11011110000111
[BTN_8][T]0[D]11011110001000
[BTN_9][T]0[D]11011110001001
[BTN_0][T]0[D]11011110000000
[KEY_NUMERIC_STAR][T]0[D]11011110001010
[KEY_NUMERIC_POUND][T]0[D]11011110001110
[KEY_RED][T]0[D]11011110001011
[KEY_GREEN][T]0[D]11011110101110
[KEY_YELLOW][T]0[D]11011110111000
[KEY_BLUE][T]0[D]11011110101001
[KEY_PLAY][T]0[D]11011110110101
[KEY_PAUSE][T]0[D]11011110110000
[KEY_RECORD][T]0[D]11011110110111
[KEY_PREVIOUS][T]0[D]11011110110010
[KEY_FORWARD][T]0[D]11011110110100
[KEY_REWIND][T]0[D]11011110100100
[KEY_FASTFORWARD][T]0[D]11011110011110
[KEY_VOLUMEUP][T]0[D]11011110010000
[KEY_VOLUMEDOWN][T]0[D]11011110010001
[KEY_CHANNELUP][T]0[D]11011110100000
[KEY_CHANNELDOWN][T]0[D]11011110100001
[KEY_MUTE][T]0[D]11011110001111
[KEY_CHANNEL][T]0[D]11011110010010
[KEY_EXIT][T]0[D]11011110011111
[KEY_MENU][T]0[D]11011110001101
[KEY_LEFT][T]0[D]11011110010110
[KEY_RIGHT][T]0[D]11011110010111
[KEY_UP][T]0[D]11011110010100
[KEY_DOWN][T]0[D]11011110010101
[KEY_OK][T]0[D]11011110100101
[KEY_POWER][T]0[D]11011110111101
[KEY_GOTO][T]0[D]11011110111011
[KEY_TV][T]0[D]11011110011100
[KEY_VIDEOS][T]0[D]11011110011000
[KEY_MUSIC][T]0[D]11011110011001
[KEY_PICTURES][T]0[D]11011110011010
[KEY_GUIDE][T]0[D]11011110011011
[KEY_RADIO][T]0[D]11011110001100
[KEY_STOP][T]0[D]11011110110110

BIN
roles/pi-irserver/files/irserver Executable file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
downloaded from
http://www.irtrans.de/de/download/linux.php
build on raspberry pi using
make arm_noccfgcc
-> linker errors with libzip
-> installed libzip-dev and added lzip to linker parameters

View File

@ -0,0 +1,10 @@
[Unit]
Description=IR server for IR remotes
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/irserver /dev/ttyUSB0
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
---
- name: Copy irserver
copy: src=irserver dest=/usr/bin/irserver mode=u+rx
- name: Copy irserver systemd file
copy: src=irserver.service dest=/lib/systemd/system/
- name: Enable irserver autostart
systemd: name=irserver state=restarted enabled=yes daemon_reload=yes
- name: Add irserver to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: irserver

View File

@ -30,7 +30,7 @@ SystemCallArchitectures=native
UMask=177 UMask=177
Type=forking Type=forking
ExecStart=/usr/local/bin/sispmctl -p 2638 -l ExecStart=/usr/bin/sispmctl -p 2638 -l
SyslogIdentifier=sispmctl SyslogIdentifier=sispmctl
Restart=always Restart=always
RestartSec=5 RestartSec=5

View File

@ -1,6 +1,6 @@
--- ---
- name: Check if sispmctl already exists - name: Check if sispmctl already exists
stat: path=/usr/local/bin/sispmctl stat: path=/usr/bin/sispmctl
register: sispmctl_file register: sispmctl_file
- name: Install dependencies - name: Install dependencies
apt: name="libusb-dev" cache_valid_time=7200 state=present apt: name="libusb-dev" cache_valid_time=7200 state=present

View File

@ -1,7 +1,16 @@
--- ---
- name: Uninstall system package of squeezelite - name: Uninstall system package of squeezelite
apt: name=squeezelite state=absent apt: name=squeezelite state=absent
- name: Install dependencies
apt:
name:
- libmad0
- libmpg123-0
- libflac8
- libvorbisfile3
- libfaad2
state: present
cache_valid_time: 7200
- name: Remove old config file if present - name: Remove old config file if present
file: path=/etc/default/squeezelite state=absent file: path=/etc/default/squeezelite state=absent
- name: Copy over custom compile version of squeezelite - name: Copy over custom compile version of squeezelite

View File

@ -0,0 +1 @@
http://downloads.slimdevices.com/LogitechMediaServer_v7.9.2/logitechmediaserver_7.9.2_arm.deb

View File

@ -0,0 +1,39 @@
---
- name: Install packages required for squeeze server
apt:
name:
- libsox-fmt-all
- libflac-dev
- libfaad2
- libmad0
- perl-openssl-abi-1.1
- libnet-ssleay-perl
- libio-socket-ssl-perl
- nasm
- build-essential
- iptables-persistent
cache_valid_time: 7200
state: present
- name: copy squeezeserver package
copy: src=logitechmediaserver_7.9.2_arm.deb dest=/tmp
- name: install squeezeserver package
apt: deb=/tmp/logitechmediaserver_7.9.2_arm.deb
- name: Enable sysdweb autostart
systemd: name=logitechmediaserver state=started enabled=yes
- name: Add to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: logitechmediaserver
- name: Forward port 80 to 9000
iptables:
table: nat
chain: PREROUTING
in_interface: eth0
protocol: tcp
match: tcp
destination_port: "80"
jump: REDIRECT
to_ports: "9000"
comment: Redirect web traffic to port 9000

View File

@ -0,0 +1,7 @@
Musik Server Wohnzimmer oben
|~~~~~~~~~~~~~~~|
|~~~~~~~~~~~~~~~|
| |
/~~\| /~~\|
\__/ \__/

View File

@ -70,19 +70,25 @@
ignore_errors: yes #to avoid error when WiFi is not present ignore_errors: yes #to avoid error when WiFi is not present
- name: Change WiFi country - name: Change WiFi country
command: "raspi-config nonint do_wifi_country {{ wifi_country }}" command: "raspi-config nonint do_wifi_country {{ wifi_country }}"
when: wifi_ssid | bool when: configure_wifi
- name: Set WiFi credentials - name: Set WiFi credentials
command: "raspi-config nonint do_wifi_ssid_passphrase {{ wifi_ssid }} {{ lookup('keepass', bauer_wifi) }}" command: "raspi-config nonint do_wifi_ssid_passphrase {{ wifi_ssid }} {{ lookup('keepass', 'bauer_wifi') }}"
when: wifi_ssid | bool when: configure_wifi
- name: Copy WIFI watchdog script - name: Install watchdog
copy: src=wifi-watchdog.sh dest=/usr/sbin/wifi-watchdog.sh apt: name=watchdog cache_valid_time=7200 state=present
when: wifi_ssid | bool when: not wifi_ssid is defined
- name: Run WIFI watchdog script periodically - name: Configure watchdog
cron: blockinfile:
name: "WIFI Watchdog" path: /etc/watchdog.conf
minute: "*/15" block: |
job: /usr/sbin/wifi-watchdog.sh interface = wlan0
when: wifi_ssid | bool retry-timeout = 90
ping = {{router_ip}}
interval = 15
when: configure_wifi
- name: Start watchdog
systemd: name=watchdog state=restarted enabled=yes daemon_reload=yes
when: configure_wifi
# Message of the day # Message of the day
- name: Set Message of the day - name: Set Message of the day
copy: src=motd/{{ pi_hostname.stdout }} dest=/etc/motd copy: src=motd/{{ pi_hostname.stdout }} dest=/etc/motd

View File

@ -1,8 +0,0 @@
---
- hosts: bedroompi, kitchenpi
roles:
- pi-standard-setup
- pi-squeezelite-custom
- pi-shairport
- pi-lirc
- pi-dhtsensor

25
todo.md Normal file
View File

@ -0,0 +1,25 @@
KNXd
HomeMatic
---------
git clone https://github.com/knxd/knxd.git
cd knxd
git checkout stable
apt-get install debhelper cdbs automake libtool libusb-1.0-0-dev git-core build-essential libsystemd-dev dh-systemd libev-dev cmake
dpkg-buildpackage -b -uc
- ansible script
- checkout backup & restore for debmatic
- ansible playbook for debmatic setup
- AEON LED off
/var/lib/bluetooth/<adaptor_mac>/settings
[General]
Discoverable=false
Alias=bla