Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add choice to print fan speed percentage #78

Merged
merged 5 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions doc/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ resume the service

print the selected information

| Option | Optional | Choices | Default | Description |
|--------------------|----------|---------------|---------|------------------------|
| \<print_selection> | yes | current, list | current | what should be printed |
| Option | Optional | Choices | Default | Description |
|--------------------|----------|----------------------|---------|------------------------|
| \<print_selection> | yes | current, list, speed | current | what should be printed |

| Choice | Description |
|---------|----------------------------------|
| current | The current strategy being used |
| list | List available strategies |
| speed | The current fan speed percentage |
5 changes: 4 additions & 1 deletion fanctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def initParser(self):
nargs="?",
type=str,
choices=["current",
"list"],
"list",
"speed"],
default="current"
)

Expand Down Expand Up @@ -564,6 +565,8 @@ def commandManager(self, args):
return self.getCurrentStrategy().name
elif args.print_selection == "list":
return '\n'.join(self.configuration.getStrategies())
elif args.print_selection == "speed":
return str(self.speed) + '%'
return "Unknown command, unexpected."

# return mean temperature over a given time interval (in seconds)
Expand Down