Skip to content

gmol/breakalert

Repository files navigation

breakalert project

Raspberry Pi Zero Setup

Setting up wireless networking

Source: https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
Put this file onto the boot partition of the SD card wpa_supplicant.conf.
⚠️ 5G wireless does not work!
⚠️ The file needs to have LF line breaks!

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=IE

network={
 ssid="<Name of your wireless LAN>"
 psk="<Password for your wireless LAN>"
}

Setting up more than one wireless network

Source: https://raspberrypi.stackexchange.com/questions/11631/how-to-setup-multiple-wifi-networks

Edit /etc/wpa_supplicant/wpa_supplicant.conf and add id_str="home" under the schools wpa info and id_str="work". :warning: The file needs to have LF line breaks!

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=IE

network={
    ssid="HOME NETWORK NAME"
    psk="HOME PASSWORD"
    id_str="home"
}

network={
    ssid="WORK NETWORK NAME"
    psk="WORK PASSWORD"
    id_str="work"
}

Enable SSH on a headless Raspberry Pi (add file to SD card on another machine)

Source: https://www.raspberrypi.org/documentation/remote-access/ssh/README.md
For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card from another computer. The content of the file does not matter; it could contain text, or nothing at all.

Password-less SSH access

ssh-copy-id -i ~/.ssh/id_rsa.pub pi@192.168.1.10

Configure I2C

Type sudo raspi-config

Choose interface
raspi-config
Enable i2c
i2c

TMUX

Software

How to install dependencies

Look at the Makefile file.

Run app

Windows

cd breakalert
REM Set PYTHONPATH
set PYTHONPATH=.
REM Run app using python from ven
.\venv\Scripts\python.exe main.py

Linux

sudo apt-get install python3-venv
cd breakalert
python -m venv venv
./venv/bin/python main.py

Run unit tests

Run command from the root directory:

  pytest

Get coverage report

Activate venv and run the following commands:

    (venv) C:\git\python\breakalert>coverage run -m pytest
    (venv) C:\git\python\breakalert>coverage html

TODO

  • Update/restore get_distance method by adding while loop and not returning None(s)
  • Remove color enum
  • Fix IP address light brightness
  • Add workflow to generate plantuml files
  • Go back to idle when Workstate was very short. For example <5min
  • Add movement detection for Distant Threshold Detection Strategy
    • when probability 1.0, normalize distance values and check how the distance has been changed
  • Statistics (how much time in front of computer in total so far during the day)
  • Last 3 LEDs to count break time
  • Add standby mode (turn off Idle light)
  • Add AlertState
  • Unify light config

todo

Components

compenents

Configuration

configuration

Cancelable repetitive task

Note Link
Cancelable repetitive task https://stackoverflow.com/questions/22498038/improve-current-implementation-of-a-setinterval/22498708#22498708
metronome like ticks https://stackoverflow.com/a/25251804/4279

Platform

Shell

Command to activate virtual environment

POSIX

bash/zsh

$ source <venv>/bin/activate

fish

$ source <venv>/bin/activate.fish

csh/tcsh

$ source <venv>/bin/activate.csh

PowerShell

$ <venv>/bin/Activate.ps1

Windows

cmd.exe

C:\> <venv>\Scripts\activate.bat

PowerShell

PS C:\> <venv>\Scripts\Activate.ps1

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors