-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
"reset", | ||
"wifi", | ||
"upgrade", | ||
"rfman", | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from .base_command import BaseCommand | ||
from bond.database import BondDatabase | ||
import bond.proto | ||
|
||
|
||
class RFManCommand(BaseCommand): | ||
subcmd = "rfman" | ||
help = "Configure the RF Manager [Bridge Only]" | ||
arguments = { | ||
"--silence-tx": { | ||
"help": "Stop all transmissions from the Bond Bridge (for debugging purposes)", | ||
"action": "store_true", | ||
}, | ||
"--log-signals": { | ||
"help": "Log all signals transmitted by the Bond on BPUP and MQTT transports", | ||
"action": "store_true", | ||
}, | ||
} | ||
|
||
def run(self, args): | ||
bondid = BondDatabase.get_assert_selected_bondid() | ||
rsp = bond.proto.patch( | ||
bondid, | ||
topic="debug/rfman", | ||
body={"log_signals": args.log_signals, "silence_tx": args.silence_tx}, | ||
) | ||
body = rsp.get("b", {}) | ||
print( | ||
"RF Manager settings: Log Signals (%s) | Silence Transmission (%s)" | ||
% (body.get("log_signals"), body.get("silence_tx")) | ||
) | ||
if rsp["s"] > 299: | ||
print("HTTP %d %s" % (rsp["s"], rsp["b"]["_error_msg"])) | ||
|
||
|
||
def register(): | ||
RFManCommand() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters