Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork wifi-connect #130

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/deploy-to-balena.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Update balena.yml
uses: balena-io-experimental/balena.yml-action@main
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ or
11. Now, you're going to enter the receiver's altitude in *meters* above sea level in a new variable named `ALT`. If you need to find the altitude, you can find it using [one of several online services](https://www.maps.ie/coordinates.html). Remember to add the approximate number of corresponding meters if your antenna is mounted above ground level.
12. Almost there! Next, we will push this code to your device through the balena cloud. We'll do that using the [balena CLI](https://github.com/balena-io/balena-cli). Follow the [official instructions](https://github.com/balena-io/balena-cli/blob/master/INSTALL.md) to download and install the CLI for your platform of choice.
13. Head into your terminal and log in to balena with the following command: `balena login`. Then follow the instructions on the screen.
14. Next, clone the balena-ads-b repository to your local computer with your Git client of choice or the standard command line tool: `git clone git@github.com:ketilmo/balena-ads-b.git --recursive`. If you want to make changes to the repo, you can also fork it. Please note that the repository uses submodules, so you must clone it recursively.
14. Next, clone the balena-ads-b repository to your local computer with your Git client of choice or the standard command line tool: `git clone git@github.com:ketilmo/balena-ads-b.git`. If you want to make changes to the repo, you can also fork it. Please note that the repository uses submodules, so you must clone it recursively.
15. Head into the folder of the newly cloned repo by typing `cd balena-ads-b`.
16. Do you remember your fleet name from earlier? Good. Now, we are ready to push the applications to balena's servers by typing `balena push YOUR–FLEET–NAME–HERE`.
17. Now, wait while the Docker containers build on balena's servers. If the process is successful, you will see a beautiful piece of ASCII art depicting a unicorn right in your terminal window:
Expand Down Expand Up @@ -354,7 +354,7 @@ In the United States, aircraft can use either the ADS-B standard, which transmit
15. Power on the device. You should now be feeding ADS-B and UAT data simultaneously to the services that support it (FlightAware, RadarBox and ADSB-Exchange).

# Part 11 – Add a digital display (Optional)
balena also produces a project that can be easily configured to display a webpage in kiosk mode on a digital display called balenaDash. By dropping that project into this one, we can automatically display a feeder page directly from the Pi. Ensure you have cloned this repository recursively (`git clone --recursive {{repository URL}}`). We can then set a `LAUNCH_URL` device variable configured to connect to `http://{{YOURIP or YOURSERVICENAME}}:YOURSERVICEPORT` (where the service/port is one of the frontends above, like `http://planefinder:30053`) and that will automatically be displayed on the attached display. The balenaDash service can be configured locally by accessing the webserver on port 8081.
balena also produces a project that can be easily configured to display a webpage in kiosk mode on a digital display called balenaDash. By dropping that project into this one, we can automatically display a feeder page directly from the Pi. We can then set a `LAUNCH_URL` device variable configured to connect to `http://{{YOURIP or YOURSERVICENAME}}:YOURSERVICEPORT` (where the service/port is one of the frontends above, like `http://planefinder:30053`) and that will automatically be displayed on the attached display. The balenaDash service can be configured locally by accessing the webserver on port 8081.

# Part 12 – Exploring flight traffic locally on your device
If the setup goes well, you should feed flight traffic data to several online services. You will receive access to the providers' premium services in return for your efforts. But in addition to this, you can explore the data straight from your device, raw and unedited. And that's part of the magic, right?
Expand Down
1 change: 0 additions & 1 deletion wifi-connect
Submodule wifi-connect deleted from fe14b5
36 changes: 36 additions & 0 deletions wifi-connect/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG BALENA_ARCH=%%BALENA_ARCH%%

FROM balenalib/$BALENA_ARCH-debian
ARG BALENA_ARCH=%%BALENA_ARCH%%


RUN install_packages dnsmasq wireless-tools

# use latest version. If specific version is required, it should be provided as vX.Y.Z, e.g v4.11.37
ARG VERSION="latest"

WORKDIR /usr/src/app

RUN \
export BASE_URL="https://github.com/balena-os/wifi-connect/releases" &&\
case $BALENA_ARCH in \
"aarch64") \
BINARY_ARCH_NAME="aarch64-unknown-linux-gnu" ;; \
"amd64") \
BINARY_ARCH_NAME="x86_64-unknown-linux-gnu" ;;\
"armv7hf") \
BINARY_ARCH_NAME="armv7-unknown-linux-gnueabihf" ;;\
*) \
echo >&2 "error: unsupported architecture ($BALENA_ARCH)"; exit 1 ;; \
esac;\
if [ ${VERSION} = "latest" ]; then \
export URL_PARTIAL="latest/download" ; \
else \
export URL_PARTIAL="download/${VERSION}" ; \
fi; \
curl -Ls "$BASE_URL/$URL_PARTIAL/wifi-connect-$BINARY_ARCH_NAME.tar.gz" \
| tar -xvz -C /usr/src/app/

COPY start.sh .

CMD ["bash", "start.sh"]
33 changes: 33 additions & 0 deletions wifi-connect/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

# Optional step - it takes couple of seconds (or longer) to establish a WiFi connection
# sometimes. In this case, following checks will fail and wifi-connect
# will be launched even if the device will be able to connect to a WiFi network.
# If this is your case, you can wait for a while and then check for the connection.
# sleep 15

# Choose a condition for running WiFi Connect according to your use case:

# 1. Is there a default gateway?
# ip route | grep default

# 2. Is there Internet connectivity?
# nmcli -t g | grep full

# 3. Is there Internet connectivity via a google ping?
# wget --spider http://google.com 2>&1

# 4. Is there an active WiFi connection?
iwgetid -r

if [ $? -eq 0 ]; then
printf 'Skipping WiFi Connect\n'
else
printf 'Starting WiFi Connect\n'
./wifi-connect
fi

# Start your application here.
sleep infinity