This commit is contained in:
jaydee
2022-12-14 02:23:34 +01:00
parent fdcd79983a
commit 7385b59c72
43 changed files with 1729 additions and 0 deletions

View File

@ -0,0 +1,49 @@
{
"dialogue": {
"system": "rhasspy"
},
"handle": {
"system": "hass"
},
"home_assistant": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIwZjAyMjE5ZWVlZTI0MzYyODYzNTM0YTY4NTg4NDBhMiIsImlhdCI6MTY2MzA2MzAwNywiZXhwIjoxOTc4NDIzMDA3fQ.N8Y4EzCppgKbc4tCj6S8UXu1hIUJ8W0QGOXvJTuVwwc",
"handle_type": "event",
"url": "https://ha.sectorq.eu"
},
"intent": {
"system": "fsticuffs"
},
"microphone": {
"arecord": {
"device": "default:CARD=Device"
},
"system": "arecord"
},
"mqtt": {
"enabled": "true",
"host": "192.168.77.106",
"password": "jaydee1",
"username": "jaydee"
},
"sounds": {
"aplay": {
"device": "default:CARD=Device"
},
"system": "aplay"
},
"speech_to_text": {
"system": "pocketsphinx"
},
"text_to_speech": {
"nanotts": {
"language": "en-GB"
},
"system": "nanotts"
},
"wake": {
"porcupine": {
"keyword_path": "alexa_raspberry-pi.ppn"
},
"system": "porcupine"
}
}

View File

@ -0,0 +1,31 @@
MODE="worker"
mac=`ifconfig eth0 |grep ether|awk '{ print $2 }'`
echo $mac
syst=9
case $mac in
"00:1E:06:48:CE:E7")
syst=1
MODE="master"
;;
"00:1e:06:48:cd:86")
syst=2
;;
"00:1e:06:48:d0:01")
syst=3
;;
"00:1e:06:48:d0:00")
syst=4
;;
"00:1e:06:48:cd:8e")
syst=5
;;
esac
echo "lala" > /tmp/check.log
hostnamectl hostname odroidc4-${syst}
sed -i 's/^TERM=/#TERM=/g' /etc/update-motd.d/10-armbian-header
sed -i '32 i TERM=linux toilet -f standard -F metal $(hostname)' /etc/update-motd.d/10-armbian-header
TERM=linux toilet -f standard -F metal $(hostname)
nmcli con mod "Wired connection 1" ipv4.addresses "192.168.77.16${syst}/24" ipv4.gateway "192.168.77.1" ipv4.dns "192.168.77.1" ipv4.method "manual"
iptables -F
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

View File

@ -0,0 +1,54 @@
# Import LCD library
from RPLCD import i2c
import psutil
import datetime
import os
from uptime import uptime
# Import sleep library
from time import sleep
# constants to initialise the LCD
lcdmode = 'i2c'
cols = 20
rows = 4
charmap = 'A00'
i2c_expander = 'PCF8574'
# Generally 27 is the address;Find yours using: i2cdetect -y 1
address = 0x27
port = 0 # 0 on an older Raspberry Pi
# Initialise the LCD
lcd = i2c.CharLCD(i2c_expander, address, port=port, charmap=charmap,
cols=cols, rows=rows)
while True:
myCmd = ""
# Write a string on first line and move to next line
mem_data = psutil.virtual_memory()
net_sum = psutil.net_if_addrs()["eth0"]
eth0_ip = (net_sum[0][1])
cpu_load = round(psutil.getloadavg()[0],2)
uptime_s = int(uptime())
uptime_f = str(datetime.timedelta(seconds=uptime_s))
line1 = f'{"Mem: " + str(mem_data.percent): <20}'
line2 = f'{"IP : " + str(eth0_ip): <20}'
line4 = f'{"CPU: " + str(cpu_load): <20}'
print(cpu_load)
lcd.backlight_enabled = True
lcd.cursor_pos = (0, 0)
lcd.write_string(line1)
lcd.crlf()
lcd.write_string(line2)
lcd.crlf()
lcd.write_string('Up : ' + str(uptime_f))
lcd.crlf()
lcd.write_string(line4)
sleep(5)
#lcd.clear()
# Switch off backlight
#lcd.backlight_enabled = False
#sleep(3)
# Clear the LCD screen
#lcd.close(clear=True)

View File

@ -0,0 +1,43 @@
# Import LCD library
from RPLCD import i2c
import subprocess
import sys
import os
pid = os.getpid()
cmnd = "ps -ef|grep lcd_control|grep -v grep |grep -v {}|wc -l".format(pid)
status, output = subprocess.getstatusoutput(cmnd)
print(output)
if int(output) > 0:
print("Running already!")
#sys.exit()
# constants to initialise the LCD
lcdmode = 'i2c'
cols = 20
rows = 4
charmap = 'A00'
i2c_expander = 'PCF8574'
# Generally 27 is the address;Find yours using: i2cdetect -y 1
address = 0x27
port = 0 # 0 on an older Raspberry Pi
# Initialise the LCD
lcd = i2c.CharLCD(i2c_expander, address, port=port, charmap=charmap,
cols=cols, rows=rows)
line1 = f'{"####": <20}'
line2 = f'{"Restarting.....": <20}'
line3 = f'{"####": <20}'
line4 = f'{"####": <20}'
lcd.backlight_enabled = True
lcd.cursor_pos = (0, 0)
lcd.write_string(line1)
lcd.crlf()
lcd.write_string(line2)
lcd.crlf()
lcd.write_string(line3)
lcd.crlf()
lcd.write_string(line4)

View File

@ -0,0 +1,35 @@
# Import LCD library
from RPLCD import i2c
# constants to initialise the LCD
lcdmode = 'i2c'
cols = 20
rows = 4
charmap = 'A00'
i2c_expander = 'PCF8574'
# Generally 27 is the address;Find yours using: i2cdetect -y 1
address = 0x27
port = 0 # 0 on an older Raspberry Pi
# Initialise the LCD
lcd = i2c.CharLCD(i2c_expander, address, port=port, charmap=charmap,
cols=cols, rows=rows)
lcd.clear()
line1 = f'{"####": <20}'
line2 = f'{"Starting....": <20}'
line3 = f'{"####": <20}'
line4 = f'{"####": <20}'
lcd.backlight_enabled = True
lcd.cursor_pos = (0, 0)
lcd.write_string(line1)
lcd.crlf()
lcd.write_string(line2)
lcd.crlf()
lcd.write_string(line3)
lcd.crlf()
lcd.write_string(line4)
lcd.crlf()
lcd.clear()
lcd.close(clear=True)

View File

@ -0,0 +1,13 @@
[Unit]
Description=Led Control service
Wants=network-online.target
After=network.target network-online.target
[Service]
Type=simple
User=root
#ExecStartPre=/bin/sleep 30
ExecStart=/usr/bin/python3 /usr/bin/lcd_control.py
[Install]
WantedBy=multi-user.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Run my custom task at shutdown only
DefaultDependencies=no
Before=poweroff.target halt.target shutdown.target reboot.target
Requires=poweroff.target
[Service]
Type=oneshot
ExecStartPre=systemctl stop lcd_control.service
ExecStart=/usr/bin/python3 /usr/bin/lcd_control_restart.py
RemainAfterExit=yes
[Install]
WantedBy=shutdown.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=Run my custom task at shutdown only
After=syslog.target
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /usr/bin/lcd_control_start.py
RemainAfterExit=yes
[Install]
WantedBy=basic.target

View File

@ -0,0 +1,16 @@
[Unit]
Description=Rhasspy Autostart
After=network-online.target
[Service]
Type=simple
User=jd
WorkingDirectory=/home/jd
ExecStart=/bin/bash -lc '/usr/bin/rhasspy --profile en 2>&1 | cat'
StandardOutput=inherit
StandardError=inherit
Restart=always
RestartSec=20
[Install]
WantedBy=multi-user.target