Open iamjmitch opened 6 months ago
Adding my logs for the same issue with this model
The error is avoided by adding a check for len(point) == 4
to the for point in path_data_arr
in v1.py (last point has len == 1)
Perfect 🙃
Dump of some data
I have made progress on decoding the path. The SL60D is using LZ4 compression for the payload
The basic idea is to change decode_path_v1
to this:
def decode_path_v1(pathdata):
header_length = BYTE_HEADER_LENGHT_PATH_V1 // 2
data_arr = _hexStringToNumber(pathdata)
isLz4 = True
if(isLz4):
encode_data_array = _hexStringToNumber(pathdata[BYTE_HEADER_LENGHT_PATH_V1:])
max_buffer_length = 4336
decode_data_array = LZ4_decompress(encode_data_array, max_buffer_length)
path_data_arr = [decode_data_array[i:i + 4] for i in range(0, len(decode_data_array), 4)]
else:
path_data_arr = [data_arr[i:i + 4] for i in range(header_length, len(data_arr), 4)]
isLz4
and max_buffer_length
should both be determined from the header, but I don't think we are currently parsing the header so I have just hardcoded the values (I copied the max_buffer_length value seen when running the same data through the Tuya Panel Demo code).
The x/y offsets are not quite right. To get the image above I had to x + 1800 and y - 3175. Also the len(point) == 4
check I mentioned earlier is not needed.
I have made progress on decoding the path. The SL60D is using LZ4 compression for the payload
The basic idea is to change
decode_path_v1
to this:def decode_path_v1(pathdata): header_length = BYTE_HEADER_LENGHT_PATH_V1 // 2 data_arr = _hexStringToNumber(pathdata) isLz4 = True if(isLz4): encode_data_array = _hexStringToNumber(pathdata[BYTE_HEADER_LENGHT_PATH_V1:]) max_buffer_length = 4336 decode_data_array = LZ4_decompress(encode_data_array, max_buffer_length) path_data_arr = [decode_data_array[i:i + 4] for i in range(0, len(decode_data_array), 4)] else: path_data_arr = [data_arr[i:i + 4] for i in range(header_length, len(data_arr), 4)]
isLz4
andmax_buffer_length
should both be determined from the header, but I don't think we are currently parsing the header so I have just hardcoded the values (I copied the max_buffer_length value seen when running the same data through the Tuya Panel Demo code).The x/y offsets are not quite right. To get the image above I had to x + 1800 and y - 3175. Also the
len(point) == 4
check I mentioned earlier is not needed.
How did you get the path on the map to work?You say to use isLz4, but how do I add it to Home Assistant?
I have made a pull request (Add support for compressed path data #43). If you are comfortable pulling in those changes you can get it working now, otherwise we need to wait for @oven-lab to merge the changes into this integration.
Buon pomeriggio anche io sto combattendo con questa card, di seguito vi elenco cosa viene fuori nei logs:
Questo errore ha avuto origine da un'integrazione personalizzata.
Registratore: custom_components.tuya_cloud_map_extractor.config_flow Fonte: custom_components/tuya_cloud_map_extractor/config_flow.py:57 Integrazione: Tuya Cloud Map Extractor (documentazione, problemi) Prima occorrenza: 15:54:19 (1 occorrenze) Ultima registrazione: 15:54:19
not enough values to unpack (expected 2, got 1) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 974, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/init.py", line 514, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 386, in decode obj, end = self.raw_decode(s) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 416, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/config/custom_components/tuya_cloud_map_extractor/tuya_vacuum_map_extractor/main.py", line 47, in parse_path data = response.json() ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/config/custom_components/tuya_cloud_map_extractor/config_flow.py", line 57, in async_step_user headers, image = await validate(self.hass, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tuya_cloud_map_extractor/config_flow.py", line 214, in validate return await hass.async_add_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tuya_cloud_map_extractor/tuya_vacuum_map_extractor/main.py", line 192, in get_map raise e File "/config/custom_components/tuya_cloud_map_extractor/tuya_vacuum_map_extractor/main.py", line 189, in get_map path = parse_path(response, scale=scale, header=header) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tuya_cloud_map_extractor/tuya_vacuum_map_extractor/main.py", line 51, in parse_path path_data = decode_path_v1(data) ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tuya_cloud_map_extractor/tuya_vacuum_map_extractor/v1.py", line 111, in decode_path_v1 x, y = [_deal_pl(_highLowToInt(high, low)) for high, low in _partition(point, 2)] ^^^^ ValueError: not enough values to unpack (expected 2, got 1)
V1.2.0 LuBlueLu SL60D Firmware: 2.6.46 MCU: 15.0.25
Having issues with "Show Path" on LuBlueLu SL60D. If I dont select "Show Path" when configuring the map loads fine however when i click "Show Path" i get no map. checking the logs i get the following error:
Full Error Log path error.txt