Documentation

Always On: Run Monitoring and Logging 24/7

For real-time monitoring and logging, the computer must run the app all the time: after a reboot, after a Windows update, after a power cut, and even if someone presses the power button. Every ControlsLens app can do this: ModLens, ModLens Sim, BacLens, PeakLens, BacLens Sim Studio and BacLens Sim.

Contents

  1. What "always on" does
  2. Windows: one click
  3. Raspberry Pi and Linux: the installer does it
  4. After a power cut
  5. Check that it works
  6. Turn it off
  7. Questions

1. What "always on" does

Windows PC Raspberry Pi / Linux
The app starts with the computer, before anyone logs in ✓ startup task ✓ service
Started again if it stops or crashes ✓ every minute ✓ after 5 s
Started again if it stops answering (watchdog) ✓ ✓
The computer never sleeps or hibernates ✓ ✓
A short press on the power button does nothing ✓ ✓ (Raspberry Pi 5, PCs)
The system restarts if it freezes (hardware watchdog) — ✓
Waits for the right time before logging after a power cut Windows clock ✓ (up to 90 s)
The computer switches on when power comes back BIOS setting (see 4) ✓ Raspberry Pi, BIOS setting on a PC
Firewall opened for the app ✓ —

Your data stays where it is: the always-on app uses the same devices, settings and logs as the app you opened.


2. Windows: one click

ModLens: Settings → Run in the background (24/7) → Make this PC always on. ModLens Sim: the manager page → Settings → Run 24/7 → Make this PC always on. BacLens / PeakLens / BacLens Sim Studio: Settings → Always on (monitoring PC) → Make this computer always on. BacLens Sim (console): open a Command Prompt in its folder and type BacLensSim.exe --always-on (add your usual options after it, for example BacLensSim.exe --always-on --port 47809).

Windows then shows its administrator prompt ("Do you want to allow this app to make changes?"): click Yes. That's all: everything else is set up by itself. If your company PC asks for an administrator password, ask your IT department to click Yes for you once.

For IT: PeakLens and BacLens Sim Studio also include install-always-on.ps1 to set up many PCs without opening the app (powershell -ExecutionPolicy Bypass -File install-always-on.ps1 -OpenToNetwork).


3. Raspberry Pi and Linux: the installer does it

Nothing to choose: the installers make the computer always on.

sudo bash tools/pi/install.sh                  # ModLens (add --sim for ModLens Sim)
sudo bash tools/pi/install_baclens.sh --peak   # PeakLens (and/or --sim, --full)

The dashboards then open from any PC of the network. Updating with the same command keeps your data.


4. After a power cut

  • Raspberry Pi: it starts by itself when the power comes back, then the apps start. A Raspberry Pi has no clock battery: it waits up to 90 s for the network time before logging. On a site network without internet, fit an RTC battery (Raspberry Pi 5) or give it an NTP server, so timestamps are right.
  • Windows or Linux PC: only the BIOS/UEFI can switch a PC on when the power comes back. Once: 1. restart the PC and press Del or F2 (sometimes F10 or Esc) while it starts; 2. find Restore on AC power loss (also called AC back, After power failure, Power on after power fail), usually under Power or Advanced; 3. set it to Power On, then Save and exit.
  • A UPS (or a UPS HAT on a Raspberry Pi) is the best protection: no lost minute, and no damaged SD card.

What is lost in a power cut: at most the last minute of statistics. Logging resumes by itself after the restart.


5. Check that it works

  1. Restart the computer without logging in (or unplug it, wait 10 s, plug it back).
  2. From another PC, open the dashboard (e.g. http://<computer IP>:8502 for ModLens, :8622 for PeakLens).
  3. The values are live and the log continues. In the app's settings, the always-on status shows ✓ On.

6. Turn it off

Same button (Turn always on off), or on Linux: sudo systemctl disable --now <service> (modlens, modsim, peaklens, baclens-sim-studio, baclens). For BacLens Sim: BacLensSim.exe --always-on-off.


7. Questions

Question Answer
Can someone still turn it off? Holding the power button for several seconds always forces a computer off: that is the hardware, no software can prevent it. Keep the computer in a closed cabinet.
I opened the app and it says the port is in use The always-on app is already running: just open its dashboard in the browser.
The Microsoft Store version of ModLens Always on needs the downloaded version (controlslens.com/download). The Store version can still start with Windows.
Which port, which network card? Any. 47808 (BACnet) and 502 (Modbus) are only the standard ports: choose the cards and ports in each app's settings, several at once if needed.