Skip to content

Commit

Permalink
[python] Fix missing support for writeing boolean attributes (project…
Browse files Browse the repository at this point in the history
  • Loading branch information
erjiaqing authored Aug 17, 2021
1 parent 95b568d commit b02a6ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/guides/python_chip_controller_building.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ example, `networkId=hex:0123456789abcdef` (for
`[0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]`), `ssid=str:Test` (for
`['T', 'e', 's', 't', 0x00]`).
For boolean type, use `key=True` or `key=False`.
### `zcl ?`
List available clusters:
Expand Down Expand Up @@ -558,6 +560,20 @@ Read the value of ZCL attribute. For example:
chip-device-ctrl > zclread Basic VendorName 1234 1 0
```
### `zclwrite <cluster> <attribute> <nodeid> <endpoint> <groupid> <value>`
Write the value to a ZCL attribute. For example:
```
chip-device-ctrl > zclwrite TestCluster Int8u 1 1 0 1
chip-device-ctrl > zclwrite TestCluster Boolean 1 1 0 True
chip-device-ctrl > zclwrite TestCluster OctetString 1 1 0 str:123123
chip-device-ctrl > zclwrite TestCluster CharString 1 1 0 233233
```
Note: The format of the value is the same as the format of argument values for
ZCL cluster commands.
### `zclconfigure <Cluster> <Attribute> <Nodeid> <Endpoint> <MinInterval> <MaxInterval> <Change>`
Configure ZCL attribute reporting settings. For example:
Expand Down
2 changes: 2 additions & 0 deletions src/controller/python/chip-device-ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def ParseValueWithType(value, type):
return value
elif type == 'bytes':
return ParseEncodedString(value)
elif type == 'bool':
return (value.upper() not in ['F', 'FALSE', '0'])
else:
raise ParsingError('cannot recognize type: {}'.format(type))

Expand Down

0 comments on commit b02a6ef

Please sign in to comment.