Skip to content

Commit 124e3cc

Browse files
committed
added rtl_433 and docker bash commands
1 parent 626fa53 commit 124e3cc

File tree

9 files changed

+134
-14
lines changed

9 files changed

+134
-14
lines changed

.bash_aliases

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
alias iotstack_up="docker-compose -f ~/IOTstack/docker-compose.yml up -d"
2+
alias iotstack_down="docker-compose -f ~/IOTstack/docker-compose.yml down"
3+
alias iotstack_start="docker-compose -f ~/IOTstack/docker-compose.yml start"
4+
alias iotstack_stop="docker-compose -f ~/IOTstack/docker-compose.yml stop"
5+
alias iotstack_update="docker-compose -f ~/IOTstack/docker-compose.yml pull"
6+
alias iotstack_build="docker-compose -f ~/IOTstack/docker-compose.yml build"
7+

.native/rtl_433.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
sudo touch /etc/modprobe.d/blacklist-rtl.conf
3+
[ $(grep -c rtl28xxu /etc/modprobe.d/blacklist-rtl.conf) -eq 0 ] && sudo echo "blacklist dvb_usb_rtl28xxu" >>/etc/modprobe.d/blacklist-rtl.conf
4+
5+
sudo touch /etc/modprobe.d/blacklist-rtl8xxxu.conf
6+
[ $(grep -c rtl8xxxu /etc/modprobe.d/blacklist-rtl8xxxu.conf) -eq 0 ] && sudo echo "blacklist rtl8xxxu" >>/etc/modprobe.d/blacklist-rtl8xxxu.conf
7+
8+
sudo apt-get update
9+
sudo apt-get install -y libtool \
10+
libusb-1.0.0-dev \
11+
librtlsdr-dev \
12+
rtl-sdr \
13+
doxygen \
14+
cmake \
15+
automake
16+
17+
git clone https://github.com/merbanan/rtl_433.git ~/rtl_433
18+
cd ~/rtl_433/
19+
mkdir build
20+
cd build
21+
cmake ../
22+
make
23+
sudo make install
24+
25+
echo "you should reboot for changes to take effect"

.templates/grafana/grafana.env

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
#TZ=Africa/Johannesburg
12
GF_PATHS_DATA=/var/lib/grafana
2-
GF_PATHS_LOGS=/var/log/grafana
3+
GF_PATHS_LOGS=/var/log/grafana
4+
# [SERVER]
5+
#GF_SERVER_ROOT_URL=http://localhost:3000/grafana
6+
#GF_SERVER_SERVE_FROM_SUB_PATH=true
7+
# [SECURITY]
8+
#GF_SECURITY_ADMIN_USER=admin
9+
#GF_SECURITY_ADMIN_PASSWORD=admin

.templates/mosquitto/service.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
- 1883:1883
88
- 9001:9001
99
volumes:
10-
- ./volumes/mosquitto/:/mosquitto/
10+
- ./volumes/mosquitto/data:/mosquitto/data
11+
- ./volumes/mosquitto/log:/mosquitto/log
1112
- ./services/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf

.templates/pihole/pihole.env

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
#TZ=America/Chicago
22
WEBPASSWORD=pihole
3-
3+
#DNS1=8.8.8.8
4+
#DNS2=8.8.4.4
5+
#DNSSEC=false
6+
#DNS_BOGUS_PRIV=True
7+
#CONDITIONAL_FORWARDING=False
8+
#CONDITIONAL_FORWARDING_IP=your_router_ip_here (only if CONDITIONAL_FORWARDING=ture)
9+
#CONDITIONAL_FORWARDING_DOMAIN=optional
10+
#CONDITIONAL_FORWARDING_REVERSE=optional
11+
#ServerIP=your_Pi's_IP_here << recommended
12+
#ServerIPv6= your_Pi's_ipv6_here << Required if using ipv6
13+
#VIRTUAL_HOST=$ServerIP
14+
#IPv6=True
15+
INTERFACE=eth0
16+
#DNSMASQ_LISTENING=local

.templates/rtl_433/Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM debian:buster-slim
2+
3+
ENV MQTT_ADDRESS mosquitto
4+
ENV MQTT_PORT 1883
5+
ENV MQTT_USER ""
6+
ENV MQTT_PASSWORD ""
7+
ENV MQTT_TOPIC RTL_433
8+
9+
RUN apt-get update && apt-get install -y git libtool libusb-1.0.0-dev librtlsdr-dev rtl-sdr cmake automake && \
10+
git clone https://github.com/merbanan/rtl_433.git /tmp/rtl_433 && \
11+
cd /tmp/rtl_433/ && \
12+
mkdir build && \
13+
cd build && \
14+
cmake ../ && \
15+
make && \
16+
make install
17+
18+
CMD ["sh", "-c", "rtl_433 -F mqtt://${MQTT_ADDRESS}:${MQTT_PORT},events=${MQTT_TOPIC},user=${MQTT_USER},pass=${MQTT_PASSWORD}"]

.templates/rtl_433/rtl_433.env

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
TZ=Africa/Johannesburg
2+
MQTT_ADDRESS=mosquitto
3+
MQTT_PORT=1883
4+
#MQTT_USER=""
5+
#MQTT_PASSWORD=""
6+
MQTT_TOPIC=RTL_433

.templates/rtl_433/service.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
rtl_433:
2+
container_name: rtl_433
3+
build: ./services/rtl_433/.
4+
env_file:
5+
- ./services/rtl_433/rtl_433.env
6+
devices:
7+
- /dev/bus/usb
8+
restart: unless-stopped

menu.sh

+46-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ timezones() {
77
TZ=$(cat /etc/timezone)
88

99
#test for TZ=
10-
[ $(grep "TZ=" $env_file) ] && sed -i "/TZ=/c\TZ=$TZ" $env_file
10+
[ $(grep -c "TZ=" $env_file) -ne 0 ] && sed -i "/TZ=/c\TZ=$TZ" $env_file
1111

1212
}
1313

@@ -85,9 +85,11 @@ mainmenu_selection=$(whiptail --title "Main Menu" --menu --notags \
8585
"install" "Install Docker" \
8686
"build" "Build Stack" \
8787
"hassio" "Install Hass.io (Requires Docker)" \
88+
"native" "Native Installs" \
8889
"commands" "Docker commands" \
8990
"backup" "Backup options" \
9091
"misc" "Miscellaneous commands" \
92+
"update" "Update IOTstack" \
9193
3>&1 1>&2 2>&3)
9294

9395
case $mainmenu_selection in
@@ -131,6 +133,7 @@ case $mainmenu_selection in
131133
"pihole" "Pi-Hole" "OFF" \
132134
"plex" "Plex media server" "OFF" \
133135
"tasmoadmin" "TasmoAdmin" "OFF" \
136+
"rtl_433" "RTL_433 to mqtt" "OFF" \
134137
3>&1 1>&2 2>&3)
135138

136139
mapfile -t containers <<<"$container_selection"
@@ -157,16 +160,19 @@ case $mainmenu_selection in
157160
#MAINMENU Docker commands -----------------------------------------------------------
158161
"commands")
159162

160-
docker_selection=$(whiptail --title "Docker commands" --menu --notags \
161-
"Shortcut to common docker commands" 20 78 12 -- \
162-
"start" "Start stack" \
163-
"restart" "Restart stack" \
164-
"stop" "Stop stack" \
165-
"stop_all" "Stop any running container regardless of stack" \
166-
"pull" "Update all containers" \
167-
"prune_volumes" "Delete all stopped containers and docker volumes" \
168-
"prune_images" "Delete all images not associated with container" \
169-
3>&1 1>&2 2>&3)
163+
docker_selection=$(
164+
whiptail --title "Docker commands" --menu --notags \
165+
"Shortcut to common docker commands" 20 78 12 -- \
166+
"aliases" "Add iotstack_up and iotstack_down aliases" \
167+
"start" "Start stack" \
168+
"restart" "Restart stack" \
169+
"stop" "Stop stack" \
170+
"stop_all" "Stop any running container regardless of stack" \
171+
"pull" "Update all containers" \
172+
"prune_volumes" "Delete all stopped containers and docker volumes" \
173+
"prune_images" "Delete all images not associated with container" \
174+
3>&1 1>&2 2>&3
175+
)
170176

171177
case $docker_selection in
172178
"start") ./scripts/start.sh ;;
@@ -176,6 +182,16 @@ case $mainmenu_selection in
176182
"pull") ./scripts/update.sh ;;
177183
"prune_volumes") ./scripts/prune-volumes.sh ;;
178184
"prune_images") ./scripts/prune-images.sh ;;
185+
"aliases")
186+
touch ~/.bash_aliases
187+
if [ $(grep -c 'IOTstack' ~/.bash_aliases) -eq 0 ]; then
188+
echo ". ~/IOTstack/.bash_aliases" >>~/.bash_aliases
189+
echo "added aliases"
190+
else
191+
echo "aliases already added"
192+
fi
193+
source ~/.bashrc
194+
;;
179195
esac
180196
;;
181197
#Backup menu ---------------------------------------------------------------------
@@ -266,6 +282,25 @@ case $mainmenu_selection in
266282
exit
267283
fi
268284
;;
285+
"update")
286+
echo "Pulling latest project file from Github.com ---------------------------------------------"
287+
git pull origin master
288+
echo "git status ------------------------------------------------------------------------------"
289+
git status
290+
;;
291+
"native")
292+
293+
native_selections=$(whiptail --title "Native installs" --menu --notags \
294+
"Install local applications" 20 78 12 -- \
295+
"rtl_433" "RTL_433" \
296+
3>&1 1>&2 2>&3)
297+
298+
case $native_selections in
299+
"rtl_433")
300+
bash ./.native/rtl_433.sh
301+
;;
302+
esac
303+
;;
269304
*) ;;
270305

271306
esac

0 commit comments

Comments
 (0)