[PR #42] [MERGED] feat: add fan speed control via webhooks/CLI #89

Closed
opened 2026-03-03 16:43:31 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nickustinov/itsyhome-macos/pull/42
Author: @loganprit
Created: 2/16/2026
Status: Merged
Merged: 2/16/2026
Merged by: @nickustinov

Base: mainHead: feature/fan-speed-control


📝 Commits (1)

  • 20f20f5 feat: add fan speed control via webhooks/CLI

📊 Changes

3 files changed (+40 additions, -0 deletions)

View changed files

📝 Itsyhome/Shared/URLSchemeHandler.swift (+3 -0)
📝 macOSBridge/ActionEngine/ActionEngine.swift (+20 -0)
📝 macOSBridge/ActionEngine/ActionParser.swift (+17 -0)

📄 Description

Summary

Adds fan speed control through webhooks and URL schemes, bringing fan control in line with other percentage-based controls like brightness and position.

Changes

ActionEngine.swift

  • Added case setSpeed(Int) to the Action enum
  • Added executeSpeed() function using service.rotationSpeedId
  • Respects rotationSpeedMin/rotationSpeedMax limits when set by the device

ActionParser.swift

  • Added speed case in parseSetCommand switch
  • Added parseSpeedCommand() function for parsing set speed <value> <target>

URLSchemeHandler.swift

  • Added speed case using existing parseValueAction() helper

Usage

# Webhook
curl http://localhost:8423/speed/50/Bedroom/Ceiling%20Fan

# URL scheme  
open "itsyhome://speed/50/Bedroom/Ceiling Fan"

# Command (via ActionParser)
set speed 50 Bedroom/Ceiling Fan

Notes

  • CLI support (itsyhome speed 50 Room/Fan) would require a one-line addition to the itsyhome-cli repo:

    rootCmd.AddCommand(makeValueControlCmd("speed", "Set fan speed (0-100)", "value"))
    
  • The rotationSpeedId characteristic was already being read for state display; this PR wires up the write path.

Thanks for a great app! 🏠


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nickustinov/itsyhome-macos/pull/42 **Author:** [@loganprit](https://github.com/loganprit) **Created:** 2/16/2026 **Status:** ✅ Merged **Merged:** 2/16/2026 **Merged by:** [@nickustinov](https://github.com/nickustinov) **Base:** `main` ← **Head:** `feature/fan-speed-control` --- ### 📝 Commits (1) - [`20f20f5`](https://github.com/nickustinov/itsyhome-macos/commit/20f20f5287920ae0e2bbc540202f13c4977b678e) feat: add fan speed control via webhooks/CLI ### 📊 Changes **3 files changed** (+40 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `Itsyhome/Shared/URLSchemeHandler.swift` (+3 -0) 📝 `macOSBridge/ActionEngine/ActionEngine.swift` (+20 -0) 📝 `macOSBridge/ActionEngine/ActionParser.swift` (+17 -0) </details> ### 📄 Description ## Summary Adds fan speed control through webhooks and URL schemes, bringing fan control in line with other percentage-based controls like brightness and position. ## Changes ### ActionEngine.swift - Added `case setSpeed(Int)` to the `Action` enum - Added `executeSpeed()` function using `service.rotationSpeedId` - Respects `rotationSpeedMin`/`rotationSpeedMax` limits when set by the device ### ActionParser.swift - Added `speed` case in `parseSetCommand` switch - Added `parseSpeedCommand()` function for parsing `set speed <value> <target>` ### URLSchemeHandler.swift - Added `speed` case using existing `parseValueAction()` helper ## Usage ```bash # Webhook curl http://localhost:8423/speed/50/Bedroom/Ceiling%20Fan # URL scheme open "itsyhome://speed/50/Bedroom/Ceiling Fan" # Command (via ActionParser) set speed 50 Bedroom/Ceiling Fan ``` ## Notes - CLI support (`itsyhome speed 50 Room/Fan`) would require a one-line addition to the [itsyhome-cli](https://github.com/nickustinov/itsyhome-cli) repo: ```go rootCmd.AddCommand(makeValueControlCmd("speed", "Set fan speed (0-100)", "value")) ``` - The `rotationSpeedId` characteristic was already being read for state display; this PR wires up the write path. Thanks for a great app! 🏠 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 16:43:31 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/itsyhome-macos#89
No description provided.