Updates & fixes

This commit is contained in:
Martin Bauer 2021-07-20 15:35:12 +02:00
parent 6c421a4ae1
commit f1d104a224
14 changed files with 324 additions and 292 deletions

View File

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

View File

@ -7,6 +7,10 @@ all:
children: children:
iot: iot:
hosts: hosts:
octopi:
sensor_room_name_ascii: prusaprinter
sensor_room_name: prusaprinter
dht_pin: 26
bedroompi: bedroompi:
squeezelite_name: BedroomPi squeezelite_name: BedroomPi
shairport_name: BedroomPi shairport_name: BedroomPi
@ -19,19 +23,21 @@ all:
alsa_card_name: 0 alsa_card_name: 0
sensor_room_name_ascii: kueche sensor_room_name_ascii: kueche
sensor_room_name: Küche sensor_room_name: Küche
hifiberry_overlay: hifiberry-amp
esszimmerradio: # oben, eltern esszimmerradio: # oben, eltern
squeezelite_name: Esszimmer squeezelite_name: Esszimmer
shairport_name: EsszimmerRadioOben shairport_name: _Oben_Esszimmer
alsa_card_name: Device alsa_card_name: Device
squeezeserver: 192.168.178.100 squeezeserver: 192.168.178.100
configure_wifi: true configure_wifi: true
musikserverwohnzimmeroben: # oben, eltern musikserverwohnzimmeroben: # oben, eltern
squeezelite_name: Wohnzimmer squeezelite_name: Wohnzimmer
shairport_name: WohnzimmerRadioOben shairport_name: _Oben_Wohnzimmer
alsa_card_name: 0 alsa_card_name: 0
squeezeserver: 192.168.178.100 squeezeserver: 192.168.178.100
sensor_room_name_ascii: wohnzimmeroben sensor_room_name_ascii: wohnzimmeroben
sensor_room_name: WohnzimmerOben sensor_room_name: WohnzimmerOben
hifiberry_overlay: hifiberry-dacplus
newrpi: newrpi:
squeezelite_name: MyTestRaspberry squeezelite_name: MyTestRaspberry
shairport_name: MyTestRaspberry shairport_name: MyTestRaspberry

Binary file not shown.

View File

@ -2,7 +2,7 @@
from ansible.errors import AnsibleError from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
from keepasshttplib import keepasshttplib, encrypter from keepasshttplib import keepasshttplib, encrypter
import requests
DOCUMENTATION = """ DOCUMENTATION = """
lookup: keepass lookup: keepass
@ -39,12 +39,12 @@ class LookupModule(LookupBase):
else: else:
entry_path, entry_attr = terms[0], terms[1] entry_path, entry_attr = terms[0], terms[1]
if not self._test_connection(): #if not self._test_connection():
raise AnsibleError('Keepass is closed!') # raise AnsibleError('Keepass is closed!')
try: try:
auth = self.k.get_credentials(entry_path) auth = self.k.get_credentials(entry_path)
except Exception as e: except Exception as e:
raise AnsibleError('Keepass error obtaining entry {}: {}'.format(host_name, e)) raise AnsibleError('Keepass error obtaining entry {}: {}'.format(entry_path, e))
if auth: if auth:
if entry_attr not in ('username', 'user', 'pass', 'passwd', 'password'): if entry_attr not in ('username', 'user', 'pass', 'passwd', 'password'):
raise AnsibleError("Keepass wrong entry") raise AnsibleError("Keepass wrong entry")

View File

@ -47,7 +47,7 @@ def send_to_home_assistant(temperature, humidity):
temperature_url = "{}/api/states/sensor.{}".format( temperature_url = "{}/api/states/sensor.{}".format(
config['ha_url'], config['ha_temp_sensor_name']) config['ha_url'], config['ha_temp_sensor_name'])
temperatur_data = { temperatur_data = {
"state": str(temperature), "state": "{:.1f}".format(temperature),
"attributes": { "attributes": {
"device_class": "temperature", "device_class": "temperature",
"friendly_name": config['ha_temp_friendly_name'], "friendly_name": config['ha_temp_friendly_name'],
@ -59,7 +59,7 @@ def send_to_home_assistant(temperature, humidity):
humidity_url = "{}/api/states/sensor.{}".format( humidity_url = "{}/api/states/sensor.{}".format(
config['ha_url'], config['ha_humidity_sensor_name']) config['ha_url'], config['ha_humidity_sensor_name'])
humidity_data = { humidity_data = {
"state": str(humidity), "state": "{:.1f}".format(humidity),
"attributes": { "attributes": {
"device_class": "humidity", "device_class": "humidity",
"friendly_name": config['ha_humidity_friendly_name'], "friendly_name": config['ha_humidity_friendly_name'],
@ -70,8 +70,8 @@ def send_to_home_assistant(temperature, humidity):
if __name__ == "__main__": if __name__ == "__main__":
temp_filter = Filter(2, 5) temp_filter = Filter(4, 10)
humidity_filter = Filter(3, 5) humidity_filter = Filter(4, 10)
while True: while True:
sensor = Adafruit_DHT.DHT22 sensor = Adafruit_DHT.DHT22

View File

@ -9,5 +9,5 @@
lineinfile: lineinfile:
path: /boot/config.txt path: /boot/config.txt
regexp: "^#?dtoverlay=hifiberry-amp" regexp: "^#?dtoverlay=hifiberry-amp"
line: "dtoverlay=hifiberry-amp" line: "dtoverlay={{hifiberry_overlay}}"
notify: reboot notify: reboot

View File

@ -1,6 +1,10 @@
--- ---
- name: Copy irserver - name: Copy irserver
copy: src=irserver dest=/usr/bin/irserver mode=u+rx copy: src=irserver dest=/usr/bin/irserver mode=u+rx
- name: Make config dir for remotes
file: path=/usr/bin/remotes state=directory
- name: Copy hauppauge remote
copy: src=hauppauge.rem dest=/usr/bin/remotes/
- name: Copy irserver systemd file - name: Copy irserver systemd file
copy: src=irserver.service dest=/lib/systemd/system/ copy: src=irserver.service dest=/lib/systemd/system/
- name: Enable irserver autostart - name: Enable irserver autostart

View File

@ -22,14 +22,17 @@
when: tempdir.path is defined when: tempdir.path is defined
- name: Install custom lirc package 1 - name: Install custom lirc package 1
apt: apt:
force: True
deb: "{{ tempdir.path }}/liblirc0_0.10.1-5.2_armhf.deb" deb: "{{ tempdir.path }}/liblirc0_0.10.1-5.2_armhf.deb"
when: tempdir.path is defined when: tempdir.path is defined
- name: Install custom lirc package 2 - name: Install custom lirc package 2
apt: apt:
force: True
deb: "{{ tempdir.path }}/liblircclient0_0.10.1-5.2_armhf.deb" deb: "{{ tempdir.path }}/liblircclient0_0.10.1-5.2_armhf.deb"
when: tempdir.path is defined when: tempdir.path is defined
- name: Install custom lirc package 3 - name: Install custom lirc package 3
apt: apt:
force: True
deb: "{{ tempdir.path }}/lirc_0.10.1-5.2_armhf.deb" deb: "{{ tempdir.path }}/lirc_0.10.1-5.2_armhf.deb"
when: tempdir.path is defined when: tempdir.path is defined
- name: Activate overlay in boot config - name: Activate overlay in boot config

View File

@ -1,3 +1,4 @@
Musik Server Wohnzimmer oben Musik Server Wohnzimmer oben
|~~~~~~~~~~~~~~~| |~~~~~~~~~~~~~~~|
@ -5,3 +6,5 @@
| | | |
/~~\| /~~\| /~~\| /~~\|
\__/ \__/ \__/ \__/

View File

@ -0,0 +1,3 @@
=================
WELCOME TO OCTOPI
=================

View File

@ -56,6 +56,7 @@
- python3 - python3
- python3-pip - python3-pip
- python3-wheel - python3-wheel
- telnet
cache_valid_time: 7200 cache_valid_time: 7200
state: present state: present
- name: Copy vim config - name: Copy vim config
@ -87,7 +88,7 @@
interval = 15 interval = 15
when: configure_wifi when: configure_wifi
- name: Start watchdog - name: Start watchdog
systemd: name=watchdog state=restarted enabled=yes daemon_reload=yes systemd: name=watchdog state=started enabled=yes daemon_reload=yes # state=restarted not working, also not manually
when: configure_wifi when: configure_wifi
# Message of the day # Message of the day
- name: Set Message of the day - name: Set Message of the day