/smiirl-clock

Turn your smiirl counter into a clock

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Smiirl Clock

Transform your unused Smiirl counter into a stylish clock with a Raspberry Pi. This project updates your Smiirl counter to display the current time.

Prerequisites

  • Raspberry Pi (e.g., Raspberry Pi Zero W or newer)
  • MicroSD card (8 GB or more)
  • Computer with an SD card reader
  • Internet connection
  • Wi-Fi network credentials
  • Smiirl device ID and token

Installation

Step 1: Set Up Your Raspberry Pi

Get the Raspberry Pi OS Lite

Install Raspberry Pi OS Lite on the SD Card

  • Download and install the Raspberry Pi Imager.
  • Open the Raspberry Pi Imager.
  • Select "Raspberry Pi OS (other)" -> "Raspberry Pi OS Lite (32-bit)".
  • Choose your SD card and click "Write".

Prepare for Headless Setup

  • Once the image is written, open the SD card on your computer.
  • Enable SSH by creating an empty file named ssh in the root directory.
  • Set up Wi-Fi by creating a file named wpa_supplicant.conf with the following content:
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="YOUR_SSID"
    psk="YOUR_PASSWORD"
    key_mgmt=WPA-PSK
}

Replace YOUR_SSID and YOUR_PASSWORD with your Wi-Fi details.

Boot Up and Connect

  • Insert the SD card into your Raspberry Pi and power it on.
  • Find your Raspberry Pi’s IP address (check your router).
  • Connect via SSH:
ssh pi@raspberrypi.local

Default username: pi, password: raspberry.

Install Node.js and npm

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nodejs npm

Step 2: Install the Smiirl Clock Package

  1. Open a terminal on your Raspberry Pi.
  2. Install the Smiirl Clock package from npm:
npm install -g smiirl-clock

Step 3: Run the Smiirl Clock Script

Run the script with your Smiirl device ID and token:

smiirl-clock YOUR_DEVICE_ID YOUR_TOKEN

You can find the counter ID and Token in your Smiirl CURL Details: image

Step 4: Autostart the Script Using crontab

To ensure the script runs on startup, add it to crontab:

Edit crontab:

crontab -e

Add the Following Line:

@reboot /usr/bin/node /usr/local/bin/smiirl-clock YOUR_DEVICE_ID YOUR_TOKEN >> /home/pi/smiirl-clock/cronlog 2>&1

Ensure the path to the script (/usr/local/bin/smiirl-clock) is correct.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Author

Stefan Kunze - @stefankunze