|
7 | 7 | import collections |
8 | 8 | from typing import Any |
9 | 9 |
|
10 | | -from elro.device import DeviceType, DEVICE_STATE |
| 10 | +from elro.device import DEVICE_VALUE, DeviceType, DEVICE_STATE |
11 | 11 |
|
12 | 12 |
|
13 | 13 | # From the ByteUtil class, needed by CRC_maker |
@@ -281,15 +281,19 @@ def get_device_states(content: list) -> dict[str, Any]: |
281 | 281 | # Unsupported record, skip and continue silently |
282 | 282 | continue |
283 | 283 | device_state = hexdata["device_status"][4:6] |
| 284 | + device_value_data = int(hexdata["device_status"][6:8], 16) |
284 | 285 | return_dict[hexdata["device_ID"]] = { |
285 | 286 | "device_type": device_type, |
286 | 287 | "signal": int(hexdata["device_status"][0:2], 16), |
287 | 288 | "battery": int(hexdata["device_status"][2:4], 16), |
288 | 289 | "device_state": DEVICE_STATE.get( |
289 | 290 | device_state, device_state |
290 | 291 | ), # return hex device state if it is not known |
| 292 | + "device_value": DEVICE_VALUE.get( |
| 293 | + device_value_data, hex(device_value_data) |
| 294 | + ), # return hex device value if it is not known |
291 | 295 | "device_status_data": hexdata, |
292 | | - "device_value_data": int(hexdata["device_status"][6:8], 16), |
| 296 | + "device_value_data": device_value_data, |
293 | 297 | } |
294 | 298 | return return_dict |
295 | 299 |
|
|
0 commit comments