Pi Zero Easy IoT

安価で簡単に IoT を始めよう! - Raspberry Pi Zero によるプログラミングレス IoT 環境データ収集

bootWifi

bootWifi is a systemd service (bootWifi.service) for Raspbian Buster. This service task is to resetting a wifi connections (especially when os system starting) with a specific configuration file on Raspbian Buster.

For example, if you make a bootWifi configuration file in /boot/ (this area is able to read and write by using Windows or MacOS) and edit it, and insart microSD card into Raspberry Pi Zero and power on it, you can reset with new wifi settings without user login to Raspbian Buster.

Installation

cd bootWifi
sudo ./install

install command options

Example for install with customized env.sh

sudo ./install -c "configuration file path"  -s "status file path"

Example for initialize the env.sh

sudo ./install -i

Configuration

For resettng wifi connections by bootWifi, edit bootWifiConfig.js. ( if installed with -c "another file path" , edit it. ) This configuration file is javascript source. (required by bootWifi.js)

Example

bootWifiConfig.js

module.exports = [
    {ssid: "ABC", passphrase: "DEF"}
    ,
    {ssid: "ghi", passphrase: "jkl"}
    ,
    {}
    ,
    {}
];

As javascript source, exports array of objects (each object has 2 properties ssid and passphrase).

priority

From upper line (head of array) to last line (tail of array), will set the priority values to each wifi connections.

Usage

sudo systemctl start bootWifi.service
sudo systemctl enable bootWifi.service

How to work

bootWifi.service --ExecStart--> bootWifi.sh

bootWifi.sh --call--> check.js
            --call--> generateWpa



Finally, bootWifi.service is in service-activity(dead) successfully.