Skip to content

Commit

Permalink
Document ineffective brightness setting
Browse files Browse the repository at this point in the history
  • Loading branch information
tdryer committed Jan 19, 2023
1 parent e8f319c commit 77866b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,15 @@ in bytes, not including this byte.

The first byte of a response is `0x02`.

The second byte of a response is `0x02` for "success" or `0x01` for "error".
The second byte of a response may be either:

The third byte of a response is the remaining length of the response measured
in bytes, not including this byte.
* `0x00` for "no response"
* `0x01` for "error"
* `0x02` for "success"

Unless the second byte represents "no response", the third byte of a response
is the remaining length of the response measured in bytes, not including this
byte.

### Saved Values

Expand Down Expand Up @@ -101,9 +106,11 @@ Type | Description
0x72 | get balance
0x73 | set default balance
... |
0x75 | set brightness (ineffective)
0x76 | set alert volume
0x77 | get default balance
... |
0x79 | get brightness
0x7A | get alert volume
... |
0x7C | get battery status
Expand Down
7 changes: 4 additions & 3 deletions eh_fifty.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _request(
raise
LOGGER.debug("Received %s response\n%s", request_type, hexdump(resp))
assert resp[0] == 0x02
assert resp[1] == _ResponseStatus.OK.value
assert resp[1] in {_ResponseStatus.NO_RESPONSE.value, _ResponseStatus.OK.value}
length = resp[2]
return bytes(resp[3 : 3 + length])

Expand Down Expand Up @@ -330,8 +330,9 @@ class _CommandType(Enum):

class _ResponseStatus(Enum):

ERROR = 0x1
OK = 0x2
NO_RESPONSE = 0
ERROR = 1
OK = 2


@dataclass
Expand Down

0 comments on commit 77866b6

Please sign in to comment.