From 328a607e28b86388cb631016f81726944903284c Mon Sep 17 00:00:00 2001 From: SRS IT Date: Sat, 28 Mar 2026 16:38:31 -0400 Subject: [PATCH] docs: update all READMEs for cross-platform support and add wemo-core docs - Root README: add Linux x64 + ARM64 download targets, update release assets table, document background scheduler differences per OS, add wemo-core shared package description, use repo name dibby-wemo-manager - apps/desktop README: full rewrite covering Windows installer/portable, Linux AppImage/.deb/.rpm (x64 + ARM64), all build commands per OS, data storage paths per OS, requirements table - packages/wemo-core: new README documenting all exports, constants, helper functions, day number convention, sun sentinel codes - about.html: fix version string from "2.0" to "2.0.0" Co-Authored-By: Claude Sonnet 4.6 --- README.md | 72 +++++++++++----- apps/desktop/README.md | 131 ++++++++++++++++++++++++------ apps/desktop/resources/about.html | 2 +- packages/wemo-core/README.md | 118 +++++++++++++++++++++++++++ 4 files changed, 276 insertions(+), 47 deletions(-) create mode 100644 packages/wemo-core/README.md diff --git a/README.md b/README.md index d7f60a5..2e2b42a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Dibby Wemo Manager gives you full local control of Belkin Wemo smart switches an | Component | Description | |---|---| -| ๐Ÿ–ฅ๏ธ **Desktop App** | Windows Electron app โ€” device dashboard, power control, scheduling | +| ๐Ÿ–ฅ๏ธ **Desktop App** | Cross-platform Electron app (Windows + Linux) โ€” device dashboard, power control, scheduling | | ๐Ÿ  **Homebridge Plugin** | HomeKit integration with custom scheduling UI inside Homebridge | Both share the same local-network Wemo protocol (UPnP/SOAP) and the same DWM scheduling engine. No Belkin account, no cloud dependency, no internet required. @@ -16,12 +16,12 @@ Both share the same local-network Wemo protocol (UPnP/SOAP) and the same DWM sch ## Repository Layout ``` -wemo-manager/ +dibby-wemo-manager/ โ”œโ”€โ”€ apps/ -โ”‚ โ””โ”€โ”€ desktop/ # Electron desktop app (Windows) +โ”‚ โ””โ”€โ”€ desktop/ # Electron desktop app (Windows + Linux) โ”œโ”€โ”€ packages/ โ”‚ โ”œโ”€โ”€ homebridge-plugin/ # homebridge-dibby-wemo Homebridge plugin -โ”‚ โ””โ”€โ”€ wemo-core/ # Shared Wemo protocol helpers +โ”‚ โ””โ”€โ”€ wemo-core/ # Shared Wemo protocol helpers (internal) โ””โ”€โ”€ package.json # npm workspaces root ``` @@ -29,14 +29,24 @@ wemo-manager/ ## Quick Start -### Desktop App (Windows) +### Desktop App Download the latest installer from [Releases](../../releases): +**Windows:** - **`Dibby Wemo Manager Setup 2.0.0.exe`** โ€” NSIS installer (recommended) - **`Dibby Wemo Manager 2.0.0.exe`** โ€” Portable single-file executable -Run the installer, launch the app. Wemo devices are discovered automatically via SSDP on your local network. +**Linux (x64):** +- **`Dibby Wemo Manager-2.0.0.AppImage`** โ€” Universal AppImage, runs anywhere +- **`dibby-wemo-manager_2.0.0_amd64.deb`** โ€” Debian / Ubuntu +- **`dibby-wemo-manager-2.0.0.x86_64.rpm`** โ€” Fedora / RHEL + +**Linux (ARM64 โ€” Raspberry Pi 4/5):** +- **`Dibby Wemo Manager-2.0.0-arm64.AppImage`** +- **`dibby-wemo-manager_2.0.0_arm64.deb`** + +Run the installer (Windows) or AppImage (Linux). Wemo devices are discovered automatically via SSDP on your local network. ### Homebridge Plugin @@ -74,10 +84,14 @@ Restart Homebridge. Devices appear in HomeKit automatically. - **Always On** โ€” enforce a device stays on; auto-corrects within 10 seconds - **Trigger** โ€” IFTTT-style: when device A changes state, control device B - **Native firmware rules** โ€” read, toggle and delete rules stored on the Wemo device itself -- **Standalone service** โ€” Windows background service that enforces rules even when the GUI is closed +- **Background scheduler** โ€” keeps rules firing even when the GUI is closed + - Windows: native Windows service (`DibbyWemoService`) + - Linux: background process, runs while app is in system tray - **Web remote** โ€” optional local web interface accessible from your phone - **Sunrise/sunset support** โ€” location-aware scheduling via city search +**Platforms:** Windows 10+ (x64) ยท Linux x64 ยท Linux ARM64 (Raspberry Pi 4/5) + ### ๐Ÿ  Homebridge Plugin - All Wemo devices registered as **HomeKit switches** @@ -141,13 +155,17 @@ The Wemo device stores rules in a SQLite database inside a ZIP archive: The DWM (Dibby Wemo Manager) scheduler is a Node.js process that: -- Loads rules from a JSON store (`dibby-wemo.json`) +- Loads rules from a JSON store - Ticks every **30 seconds**, reloading rules on each tick (live edits take effect without restart) - Pre-schedules events within a **65-second look-ahead window** - On startup, catches up any rules missed within the last **10 minutes** - Runs a **health monitor** every 10 seconds for AlwaysOn and Trigger rules - Writes a **heartbeat** to the store on every tick so the UI can show scheduler status +### Shared Core + +`packages/wemo-core` contains shared constants and utilities (day numbers, time conversions, sunrise/sunset calculator) used by both the desktop app and the Homebridge plugin without duplication. It is an internal npm workspace package, not published to npm. + --- ## Development @@ -157,10 +175,10 @@ The DWM (Dibby Wemo Manager) scheduler is a Node.js process that: - Node.js โ‰ฅ 18 - npm โ‰ฅ 9 -### Install dependencies +### Install all dependencies ```bash -# From repo root +# From repo root โ€” installs all workspaces npm install ``` @@ -171,16 +189,27 @@ cd apps/desktop npm run dev ``` -### Desktop App โ€” build Windows installer +### Desktop App โ€” build ```bash +# Windows installer + portable exe cd apps/desktop npm run build:win + +# Linux AppImage + .deb + .rpm (x64) +cd apps/desktop +npm run build:linux + +# Linux ARM64 (Raspberry Pi) +cd apps/desktop +npm run build:linux:arm64 + +# Windows x64 + Linux x64 in one command +cd apps/desktop +npm run build:all ``` -Output in `apps/desktop/dist/`: -- `Dibby Wemo Manager Setup 2.0.0.exe` โ€” NSIS installer -- `Dibby Wemo Manager 2.0.0.exe` โ€” portable EXE +Output in `apps/desktop/dist/`. ### Homebridge Plugin โ€” install locally @@ -197,11 +226,16 @@ Then restart Homebridge. Each [GitHub Release](../../releases) includes: -| File | Description | -|---|---| -| `Dibby Wemo Manager Setup 2.0.0.exe` | Windows NSIS installer (recommended) | -| `Dibby Wemo Manager 2.0.0.exe` | Windows portable executable | -| `homebridge-dibby-wemo-1.0.0.tgz` | Homebridge plugin npm package | +| File | OS | Description | +|---|---|---| +| `Dibby Wemo Manager Setup 2.0.0.exe` | Windows | NSIS installer (recommended) | +| `Dibby Wemo Manager 2.0.0.exe` | Windows | Portable executable | +| `Dibby Wemo Manager-2.0.0.AppImage` | Linux x64 | Universal AppImage | +| `dibby-wemo-manager_2.0.0_amd64.deb` | Linux x64 | Debian / Ubuntu package | +| `dibby-wemo-manager-2.0.0.x86_64.rpm` | Linux x64 | Fedora / RHEL package | +| `Dibby Wemo Manager-2.0.0-arm64.AppImage` | Linux ARM64 | Raspberry Pi 4/5 AppImage | +| `dibby-wemo-manager_2.0.0_arm64.deb` | Linux ARM64 | Raspberry Pi OS package | +| `homebridge-dibby-wemo-1.0.0.tgz` | Any | Homebridge plugin npm package | --- diff --git a/apps/desktop/README.md b/apps/desktop/README.md index 7160a5f..f95a92c 100644 --- a/apps/desktop/README.md +++ b/apps/desktop/README.md @@ -1,8 +1,10 @@ # Dibby Wemo Manager โ€” Desktop App -**Windows desktop application for local Belkin Wemo control.** +**Cross-platform desktop application for local Belkin Wemo control.** -Full device dashboard, power control, scheduling engine, Windows background service, and optional web remote โ€” all communicating directly with your Wemo devices over your local network. No Belkin cloud account required. +Full device dashboard, power control, scheduling engine, and optional web remote โ€” all communicating directly with your Wemo devices over your local network. No Belkin cloud account required. + +On Windows the scheduler can run as a background service so rules keep firing after the GUI is closed. Linux uses a background process instead. --- @@ -10,6 +12,8 @@ Full device dashboard, power control, scheduling engine, Windows background serv Download the latest release from [GitHub Releases](../../releases): +### Windows + | File | Description | |---|---| | `Dibby Wemo Manager Setup 2.0.0.exe` | **NSIS installer** โ€” recommended, installs to Program Files, adds Start Menu shortcut | @@ -17,6 +21,32 @@ Download the latest release from [GitHub Releases](../../releases): Run the installer or portable exe. The app opens and immediately begins discovering Wemo devices on your network. +### Linux + +| File | Description | +|---|---| +| `Dibby Wemo Manager-2.0.0.AppImage` | **AppImage** โ€” universal, runs on any modern Linux distro. No install needed. | +| `dibby-wemo-manager_2.0.0_amd64.deb` | **Debian / Ubuntu** package | +| `dibby-wemo-manager-2.0.0.x86_64.rpm` | **Fedora / RHEL / openSUSE** package | +| `Dibby Wemo Manager-2.0.0-arm64.AppImage` | **AppImage (ARM64)** โ€” Raspberry Pi 4/5, Apple Silicon VMs | +| `dibby-wemo-manager_2.0.0_arm64.deb` | **Debian ARM64** โ€” Raspberry Pi OS | + +**AppImage:** +```bash +chmod +x "Dibby Wemo Manager-2.0.0.AppImage" +./"Dibby Wemo Manager-2.0.0.AppImage" +``` + +**Debian / Ubuntu (.deb):** +```bash +sudo dpkg -i dibby-wemo-manager_2.0.0_amd64.deb +``` + +**Fedora / RHEL (.rpm):** +```bash +sudo rpm -i dibby-wemo-manager-2.0.0.x86_64.rpm +``` + --- ## Features @@ -57,39 +87,48 @@ Read and manage rules stored directly on the Wemo device's own firmware: > Wemo Dimmer V2 (WDS060) with newer RTOS firmware does not support firmware rule editing. -### ๐Ÿ› ๏ธ Windows Background Service - -The DWM scheduler can run as a **Windows service** (`DibbyWemoService`) so rules continue to fire even when the GUI is closed or the user logs out. - -- Install/uninstall the service from the app's System tab -- The service reads rules from the shared data directory and syncs automatically when rules are saved in the GUI -- Service uses `node-windows` for reliable Windows service registration - ### ๐ŸŒ Web Remote Optional local web interface accessible from any device on your network (phone, tablet, another PC): - View device status - Toggle devices on/off +- Manage DWM rules - QR code for easy mobile access -- Configurable port; firewall rule created automatically (UAC prompt) +- Configurable port; firewall rule created automatically on Windows (UAC prompt) ### ๐Ÿ“ Sunrise/Sunset Scheduling Set your city in the Settings tab. Schedule rules can then use local sunrise and sunset times as start/end points. +### ๐Ÿ› ๏ธ Background Scheduler + +The DWM scheduler continues running rules even when the main window is closed. + +**Windows** โ€” installs as a native **Windows Service** (`DibbyWemoService`) via `node-windows`: +- Install/uninstall from the System tab +- The service reads rules from `C:\ProgramData\DibbyWemoManager\dwm-rules.json` +- Syncs automatically when rules are saved in the GUI + +**Linux** โ€” the scheduler runs as a background process spawned from the main Electron process. It continues running while the app is in the system tray. + --- ## Data Storage -All app data is stored in `%APPDATA%\DibbyWemoManager\` (typically `C:\Users\\AppData\Roaming\DibbyWemoManager\`): +All app data is stored in the OS user-data directory: + +| OS | Path | +|---|---| +| Windows | `%APPDATA%\DibbyWemoManager\` | +| Linux | `~/.config/DibbyWemoManager/` | | File | Description | |---|---| | `wemo-manager.json` | App settings, discovered devices, DWM rules | -| `dwm-rules.json` | DWM rules shared with the Windows background service | +| `dwm-rules.json` | DWM rules shared with the background scheduler | -The standalone service reads `C:\ProgramData\DibbyWemoManager\dwm-rules.json`. The GUI syncs rules to this location after every create, update, or delete. +On Windows the standalone service reads `C:\ProgramData\DibbyWemoManager\dwm-rules.json`. The GUI syncs rules to this location after every create, update, or delete. --- @@ -102,7 +141,7 @@ Electron Main Process โ”œโ”€โ”€ store.js โ€” JSON persistence layer โ”œโ”€โ”€ firewall.js โ€” Windows Firewall rule management (elevated) โ”œโ”€โ”€ web-server.js โ€” Express web remote server -โ”œโ”€โ”€ service-manager.jsโ€” node-windows service install/uninstall +โ”œโ”€โ”€ service-manager.jsโ€” node-windows service install/uninstall (Windows) โ””โ”€โ”€ ipc/ โ”œโ”€โ”€ devices.ipc.js โ”œโ”€โ”€ rules.ipc.js @@ -116,7 +155,7 @@ Electron Renderer (React 18 + Zustand) โ”œโ”€โ”€ AllRulesTab โ€” Native firmware rules per device โ””โ”€โ”€ Settings โ€” location, service, web remote config -Standalone Service (scheduler-standalone.js) +Standalone Scheduler (scheduler-standalone.js) โ””โ”€โ”€ Runs headless; reads dwm-rules.json; same scheduling logic ``` @@ -141,7 +180,7 @@ Native firmware rules are stored in a SQLite database (`temppluginRules.db`) ins - Node.js โ‰ฅ 18 - npm โ‰ฅ 9 -- Windows (for Windows builds) +- OS-specific toolchain (see below) ### Install dependencies @@ -163,29 +202,67 @@ npm run dev Opens the Electron app with hot-reload for the renderer. -### Production build +### Production builds + +#### Windows (NSIS installer + portable exe) + +Run on a Windows machine: ```bash cd apps/desktop npm run build:win ``` -This: -1. Compiles the renderer with `electron-vite` -2. Bundles the standalone service script -3. Runs `electron-builder` to produce the NSIS installer and portable exe +Output in `apps/desktop/dist/`: +- `Dibby Wemo Manager Setup 2.0.0.exe` โ€” NSIS installer +- `Dibby Wemo Manager 2.0.0.exe` โ€” portable exe -Output appears in `apps/desktop/dist/`. +> **Code signing:** The build config expects a PFX certificate at `resources/srsit-codesign.pfx`. Remove the `win.certificateFile` entry from `package.json` if you don't have a certificate. -> **Code signing:** The build configuration expects a PFX certificate at `resources/srsit-codesign.pfx`. Remove the `win.certificateFile` entry from `package.json` if you don't have a certificate. +#### Linux x64 (AppImage + .deb + .rpm) + +Run on a Linux machine or in WSL2 / CI: + +```bash +cd apps/desktop +npm run build:linux +``` + +Output in `apps/desktop/dist/`: +- `Dibby Wemo Manager-2.0.0.AppImage` +- `dibby-wemo-manager_2.0.0_amd64.deb` +- `dibby-wemo-manager-2.0.0.x86_64.rpm` + +#### Linux ARM64 (Raspberry Pi / Apple Silicon) + +```bash +cd apps/desktop +npm run build:linux:arm64 +``` + +Output in `apps/desktop/dist/`: +- `Dibby Wemo Manager-2.0.0-arm64.AppImage` +- `dibby-wemo-manager_2.0.0_arm64.deb` + +#### All targets at once + +```bash +cd apps/desktop +npm run build:all +``` + +Builds Windows x64 and Linux x64 targets in sequence. Requires the build host to have `wine` installed (for Windows cross-compilation on Linux), or run each command on its native OS. --- ## Requirements -- Windows 10 or later (x64) -- Node.js โ‰ฅ 18 (only needed for building from source) -- Wemo devices on the same LAN +| Component | Windows | Linux | +|---|---|---| +| OS | Windows 10 or later (x64) | Any modern distro (x64 or ARM64) | +| Node.js | โ‰ฅ 18 (build only) | โ‰ฅ 18 (build only) | +| Runtime deps | None โ€” bundled | `libgtk-3`, `libnss3`, `libxss1` (auto via .deb) | +| Wemo devices | Same LAN | Same LAN | --- diff --git a/apps/desktop/resources/about.html b/apps/desktop/resources/about.html index b4ea69a..6ca61bf 100644 --- a/apps/desktop/resources/about.html +++ b/apps/desktop/resources/about.html @@ -104,7 +104,7 @@ Dibby Wemo Manager

Dibby Wemo Manager

-
Version 2.0
+
Version 2.0.0

diff --git a/packages/wemo-core/README.md b/packages/wemo-core/README.md new file mode 100644 index 0000000..57ddb4d --- /dev/null +++ b/packages/wemo-core/README.md @@ -0,0 +1,118 @@ +# @wemo-manager/core + +**Shared Wemo protocol constants and utilities used by both the Dibby Wemo Manager desktop app and the Homebridge plugin.** + +This is an internal package within the `dibby-wemo-manager` monorepo. It is not published to npm โ€” both packages reference it via npm workspaces. + +--- + +## What's in here + +### Constants + +| Export | Description | +|---|---| +| `DAY_NUMBERS` | Map of day names โ†’ Wemo day numbers (Monday=1 โ€ฆ Sunday=7) | +| `DAY_NAMES` | Map of Wemo day numbers โ†’ full names | +| `DAY_SHORT` | Map of Wemo day numbers โ†’ abbreviated names (Mon, Tueโ€ฆ) | +| `RULE_TYPES` | Wemo firmware rule type strings (Schedule, Away, Countdown, Long Press) | +| `ACTIONS` | StartAction / EndAction numeric codes (ON=1, OFF=0, TOGGLE=2, NONE=-1) | +| `NETWORK_STATUS` | GetNetworkStatus response codes | +| `RESET_CODES` | ReSetup action codes (clear data, factory reset, clear WiFi) | +| `RD_DEFAULTS` | Default field values for a new RULEDEVICES row | +| `SUN_CODES` | Sentinel values for sunrise (โˆ’2) and sunset (โˆ’3) in StartTime/EndTime | + +### Helper functions + +| Function | Signature | Description | +|---|---|---| +| `namesToDayNumbers` | `(names: string[]) => number[]` | Convert day name array to sorted Wemo day numbers | +| `dayNumbersToNames` | `(numbers: number[]) => string[]` | Convert day numbers to full name array | +| `dayNumbersToShort` | `(numbers: number[]) => string[]` | Convert day numbers to abbreviated name array | +| `timeToSecs` | `(hhmm: string) => number` | Parse `"HH:MM"` to seconds from midnight | +| `secsToHHMM` | `(secs: number) => string` | Format seconds from midnight to `"HH:MM"` | +| `sunTimes` | `(lat, lng, date?) => { sunrise, sunset }` | Calculate sunrise/sunset as seconds from midnight | + +--- + +## Wemo day number convention + +Wemo devices use **1-based day numbers**, not bitmasks: + +| Number | Day | +|---|---| +| 1 | Monday | +| 2 | Tuesday | +| 3 | Wednesday | +| 4 | Thursday | +| 5 | Friday | +| 6 | Saturday | +| 7 | Sunday | + +Multi-day rules have one `RULEDEVICES` row **per day** โ€” not a single row with a bitmask. + +--- + +## Sun time sentinel codes + +When a rule's `StartTime` or `EndTime` is set to one of these values, the scheduler resolves it to the actual sunrise/sunset time for the configured location: + +| Constant | Value | Meaning | +|---|---|---| +| `SUN_CODES.SUNRISE` | `-2` | Use today's sunrise time | +| `SUN_CODES.SUNSET` | `-3` | Use today's sunset time | + +--- + +## Usage + +```js +const { + DAY_NUMBERS, + namesToDayNumbers, + secsToHHMM, + sunTimes, + SUN_CODES, +} = require('@wemo-manager/core'); + +// Convert user-selected days to Wemo day numbers +const days = namesToDayNumbers(['Monday', 'Wednesday', 'Friday']); +// โ†’ [1, 3, 5] + +// Format a time stored as seconds from midnight +console.log(secsToHHMM(75600)); // "21:00" (9 PM) + +// Check if a StartTime is a sunrise/sunset sentinel +if (startTime === SUN_CODES.SUNRISE) { + const { sunrise } = sunTimes(lat, lng); + startTime = sunrise; +} +``` + +--- + +## File structure + +``` +packages/wemo-core/ +โ”œโ”€โ”€ package.json +โ””โ”€โ”€ src/ + โ”œโ”€โ”€ index.js โ€” re-exports everything from sun.js and types.js + โ”œโ”€โ”€ types.js โ€” constants + day/time helper functions + โ””โ”€โ”€ sun.js โ€” NOAA sunrise/sunset calculator (pure JS, no deps) +``` + +--- + +## Notes + +- **No external dependencies** โ€” pure JavaScript, no npm packages required. +- `sun.js` implements the NOAA Solar Calculator algorithm (Jean Meeus, *Astronomical Algorithms*). It returns `null` for each value during polar day/polar night. +- `secsToHHMM` returns `"00:00"` for negative input (used for no-time sentinel values like `โˆ’1`). +- The DWM scheduler in both the desktop app and the Homebridge plugin uses `SUN_CODES` to resolve rule times at tick time, so sunrise/sunset-based rules automatically adjust every day. + +--- + +## License + +MIT