make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.43k stars 552 forks source link

IBBQ-4T V2 #1439

Closed TurboTronix closed 11 months ago

TurboTronix commented 11 months ago

This form is for reporting bugs. If you have encountered a bug, you should generally have some log messages or device diagnostics to show something is going wrong. If your problem is more of a question or a request for help, then Discussions is probably a more suitable venue.

Describe the bug

To Reproduce Steps to reproduce the behavior including the device the issue was observed with:

Step 1: use the following device

      "model": "IBBQ-4T  V2.x",
      "name": "IBBQ-4T",
      "product_id": "wavwesi8clrfwx68",

Step 2: this will use the following yaml: inkbird_bbq4t_thermometerv2.yaml

Expected behavior The code in inkbird_bbq4t_thermometerv2.yaml needs to be modified for probe 2-3-4 (change type to base64):

- entity: sensor
    name: Temperature probe 2
    class: temperature
    dps:
      - id: 107
        type: base64

Additional context I also noted that probe 1 and 3 don't give the accurate temps, I can't figure out why. I've tried several things but can't pin point the reason.

The following picture shows that Probe 1 and Probe 3 seem to give the same faulty value of -16.36 (they seem to be the same value as well, not 2 diff values but a duplication of the same value). However these temps should be similar to those given by Probe 1 and Probe 4.

image

Debug log: tuya_local-d64ae89f06e1f8c04fc2f9ccc6c9fb9b-BBQ thermometer-ad5f5d681fb06a690e5c35076defe4da.json.txt

If the bug involves a device, then please include device diagnostics from Settings / Devices & Services / Tuya Local (your device) / "1 device"

Please check if there are messages from Tuya Local in the Home Assistant log (Settings / System / Logs), and include those too.

If applicable, add screenshots to help explain your problem.

make-all commented 11 months ago

Thanks for pointing out the incorrect types. The temperatures seem to be encoded as 3 bytes per probe, with another 1 byte of flags. The previous masks were based on 2 bytes per probe, so the odd numbered probes were actually picking up the leading byte and the flags, and probes 2 and 4 were showing the temperatures of probes 1 and 2 (or maybe 3 and 4).

Do you think you can do some experimenting to check if the probes are ordered correctly? DONE: probe order is confirmed to be correct

Also, the "preset temperature" settings are also currently masked to 2 bytes per probe, but that dp seems to have 28 bytes in total. I am not sure whether it is 7 bytes per probe, or some smaller number per probe, with some more general settings in there as well. Currently the only capture of that DP is in a comment in the original issue that has all 28 bytes set to 0, so some experimenting with those presets from the app and capturing the base64 values will help try to figure them out. TODO

TurboTronix commented 11 months ago

OK will do some testing this coming weekend to see if I can help out.

TurboTronix commented 11 months ago

My findings:

image

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

Probe 1 in hot water | DP107 | UEYAAKIcAAAqHAAANBwAAA== | 82 | 23 | 22 | 22 -- | -- | -- | -- | -- | -- | -- Probe 2 in hot water | DP107 | GiIAAP5CAAAqHAAANBwAAA== | 31 | 78 | 22 | 22 Probe 3 in hot water | DP107 | PB4AAE4gAAB0QAAA5BsAAA== | 26 | 28 | 74 | 22 Probe 4 in hot water | DP107 | ehwAAN4cAABKHwAABD0AAA== | 23 | 23 | 27 | 69

TurboTronix commented 11 months ago

I can't seem to change the presets, in my Tuya dev these inputs are missing and in Hassio they are not properly connected.

These are the only things I can control from Tuya dev: image

TurboTronix commented 11 months ago

Another unrelated issue is the temp unit changing from F to C and vise versa does not work in hassio. In your code you use DP19 which is Temperature Scale. But in Tuya loT I noticed it uses the following when I send a command to change the temp unit: image

image

So this is what I noticed: When I change the temp unit in Tuya loT, it does change it in Tuya Local (in hassio) and on the actual device (IBBQ-4T). But when I change it in Tuya Local (in hassio) it does not change anything.

In Tuya Local this field is called: select.bbq_thermometer_display_unit

Update: OK it seem it is the correct DP# but not sure why it doesn't work:

 {
        "code": "temp_unit_convert",
        "custom_name": "",
        "dp_id": 19,
        "time": 1703342455839,
        "value": "c"
      },
TurboTronix commented 11 months ago

I am still trying to decypher this...can't figure it out.

image probe_debug.xlsx

make-all commented 11 months ago

The readings are in Fahrenheit. You need to break down the HEX into groups of 4, then because it is little endian reverse the bytes in each (not every hex digit, as two hex digits make up a byte):

So the order is correct - left to right in blocks of 4 (not reversing the whole string, which would result in a 4 to 1 probe order).

TurboTronix commented 11 months ago

I tried that but the other 3 probes don't match. the first one is indeed 180 F which matches but the rest give all over the place numbers.

make-all commented 11 months ago

From the latest config and the values above, I'm getting

Probe 1 in hot water

sensor_temperature_probe_1: 180.0 sensor_temperature_probe_2: 73.3 sensor_temperature_probe_3: 72.1 sensor_temperature_probe_4: 72.2

Probe 2 in hot water sensor_temperature_probe_1: 87.3 sensor_temperature_probe_2: 171.5 sensor_temperature_probe_3: 72.1 sensor_temperature_probe_4: 72.2

Probe 3 in hot water sensor_temperature_probe_1: 77.4 sensor_temperature_probe_2: 82.7 sensor_temperature_probe_3: 165.0 sensor_temperature_probe_4: 71.4

Probe 4 in hot water sensor_temperature_probe_1: 72.9 sensor_temperature_probe_2: 73.9 sensor_temperature_probe_3: 80.1 sensor_temperature_probe_4: 156.2

These seem to have a small offset from the values you quoted, but are not wildly out of the expected range.

TurboTronix commented 11 months ago

Oh cool, so the latest release should have the changes?

TurboTronix commented 11 months ago

Ok nevermind, noticed last release was 3 weeks ago. It's no rush, I will keep monitoring for updates. Thanks for your hard work!