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

README.md (Check humidity parameter), broadlink_cli add --sensorsJson, protocol.md Authorisation payload #757

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ broadlink_cli --device @BEDROOM.device --temperature

#### Check humidity
```
broadlink_cli --device @BEDROOM.device --temperature
broadlink_cli --device @BEDROOM.device --humidity
```

### Smart plugs
Expand Down
11 changes: 11 additions & 0 deletions cli/broadlink_cli
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ parser.add_argument("--turnnloff", action="store_true", help="turn off nightligh
parser.add_argument("--switch", action="store_true", help="switch state from on to off and off to on")
parser.add_argument("--send", action="store_true", help="send command")
parser.add_argument("--sensors", action="store_true", help="check all sensors")
parser.add_argument("--sensorsJson", action="store_true", help="check all sensors and print in json format")
parser.add_argument("--learn", action="store_true", help="learn command")
parser.add_argument("--rfscanlearn", action="store_true", help="rf scan learning")
parser.add_argument("--learnfile", help="save learned command to a specified file")
Expand Down Expand Up @@ -123,6 +124,16 @@ if args.sensors:
data = dev.check_sensors()
for key in data:
print("{} {}".format(key, data[key]))
if args.sensorsJson:
data = dev.check_sensors()
print("{")
ftt = True
for key in data:
if not ftt:
print(",")
print(" \"{}\" : {}".format(key, data[key]))
ftt = False
print("}")
if args.send:
data = durations_to_broadlink(parse_durations(' '.join(args.data))) \
if args.durations else bytearray.fromhex(''.join(args.data))
Expand Down
2 changes: 1 addition & 1 deletion protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ You must obtain an authorisation key from the device before you can communicate.
|------|--------|
|0x00-0x03|00|
|0x04-0x12|A 15-digit value that represents this device. Broadlink's implementation uses the IMEI.|
|0x13|01|
|0x1e|0x01|
|0x14-0x2c|00|
|0x2d|0x01|
|0x30-0x7f|NULL-terminated ASCII string containing the device name|
Expand Down