make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.28k stars 505 forks source link

Request support for Inkbird iBBQ-4T thermometer (nearly same as iBBQ-4BW) #750

Closed melvanderwal closed 1 year ago

melvanderwal commented 1 year ago

The device is an Inkbird iBBQ-4T wifi thermometer with 4 probes. I currently use it with the Local Tuya integration, and have previously configured the DPS values for that.

The device is extremely similar to the existing iBBQ-4BW device which is supported, but only IR Sensors and Simple Switch are listed as an option when adding the integration. The DPSes for the existing device are nearly the same as the iBBQ-4T, but it seems that there may simply be fewer DPSes in the iBBQ-4T.

https://github.com/make-all/tuya-local/blob/main/custom_components/tuya_local/devices/inkbird_ibbq4bw_thermometer.yaml

Log Message

Device matches ir_remote_sensors with quality of 20%. DPS: {"updated_at": 1685594222.5167696, "1": true, "19": "f", "101": 90, "102": 120, "104": false, "105": 0, "107": 7340, "108": 7161, "110": 7260, "111": 4}
Device matches ir_remote_sensors with quality of 20%. DPS: {"updated_at": 1685595366.6837168, "1": true, "19": "f", "101": 90, "102": 120, "104": false, "105": 0, "107": 7340, "108": 7160, "110": 7251, "111": 4}
Device matches ir_remote_sensors with quality of 18%. DPS: {"updated_at": 1685595831.594756, "1": true, "19": "f", "101": 89, "102": 120, "104": false, "105": 0, "107": 7390, "108": 7231, "109": 8740, "110": 7291, "111": 0}
Device matches ir_remote_sensors with quality of 18%. DPS: {"updated_at": 1685595911.3625407, "1": true, "19": "f", "101": 89, "102": 120, "104": false, "105": 0, "107": 7360, "108": 7280, "109": 7721, "110": 7341, "111": 0}
Report this to https://github.com/make-all/tuya-local/issues/

Another log:
Device matches ir_remote_sensors with quality of 20%. DPS: {"updated_at": 1685595366.6837168, "1": true, "19": "f", "101": 90, "102": 120, "104": false, "105": 0, "107": 7340, "108": 7160, "110": 7251, "111": 4}
Device matches ir_remote_sensors with quality of 18%. DPS: {"updated_at": 1685595831.594756, "1": true, "19": "f", "101": 89, "102": 120, "104": false, "105": 0, "107": 7390, "108": 7231, "109": 8740, "110": 7291, "111": 0}
Device matches ir_remote_sensors with quality of 18%. DPS: {"updated_at": 1685595911.3625407, "1": true, "19": "f", "101": 89, "102": 120, "104": false, "105": 0, "107": 7360, "108": 7280, "109": 7721, "110": 7341, "111": 0}
Report this to https://github.com/make-all/tuya-local/issues/
Device matches ir_remote_sensors with quality of 18%. DPS: {"updated_at": 1685597092.5415907, "1": true, "19": "f", "101": 88, "102": 120, "104": false, "105": 0, "107": 7360, "108": 7440, "109": 7601, "110": 7440, "111": 0}

Information about DPS mappings

DPSes from the YAML for the iBBQ-4BW compared to the iBBQ-4T:

- DPS 107, 108, 109, 110:  Same, temperature in degrees F that requires division by 100
- DPS 1: Same, power switch
- DPS 13: Not present - fault, perhaps only appears when there is a fault?
- DPS 19:  Similar, temperature unit but dps_val is lowercase (f instead of F, c instead of C)
- DPS 101: Same, battery percent
- DPS 102: Same, light timeout
- DPS 104: Same, switch for alarm
- DPS 111: Different, has log values of 1 and 4, may not be backlight switch
- DPS 112: Not present - internal temperature
- DPS 116, 117, 118, 119: Not present - temperature calibration

Product ID

Information about how the device functions

https://inkbird.com/products/wifi-grill-thermometer-ibbq-4t

lhassell commented 1 year ago

I took a look at the .yaml file and noticed the product ID is incorrect, at least compared with the data I'm getting from the iot site. Can I help? I can upload a sanitized version of the output I'm getting from the device status page if it will help.

melvanderwal commented 1 year ago

I took a look at the .yaml file and noticed the product ID is incorrect, at least compared with the data I'm getting from the iot site. Can I help? I can upload a sanitized version of the output I'm getting from the device status page if it will help.

Please do! My Tuya project is broken, so I was unable to see the info.

make-all commented 1 year ago

Yes, it looks like the product id was copied straight across from the iBBQ-4BW, and there is no correct product id listed above.

lhassell commented 1 year ago

{ "result": { "active_time": 1687225263, "biz_type": 0, "category": "wk", "create_time": 1687225263, "icon": "smart/icon/ay15157410971057cPZi/0dd6cdd5f09c1014f682a8e68fc2db15.png", "id": "##REMOVED##", "ip": "##REMOVED##", "lat": "##REMOVED##", "local_key": "##REMOVED##", "lon": "##REMOVED##", "model": "IBBQ-4T V2.x", "name": "IBBQ-4T", "online": false, "owner_id": "##REMOVED##", "product_id": "wavwesi8clrfwx68", "product_name": "IBBQ-4T", "status": [ { "code": "switch", "value": false }, { "code": "temp_unit_convert", "value": "f" } ], "sub": false, "time_zone": "-05:00", "uid": "##REMOVED##", "update_time": 1687228189, "uuid": "##REMOVED##" }, "success": true, "t": 1687297739827, "tid": "438b6c8d0fb411eebfceda94faf43880" }

Also, this spreadsheet of device datapoints for the iBBQ-4T may be of use as well: https://docs.google.com/spreadsheets/d/1hQ805Ksk2wpGK8vPj0LHx7F3GaqZKFMFnVoLVZFEPiw/edit#gid=0

lhassell commented 1 year ago

Additional info: I can confirm that in addition to the DP's in the above spreadsheet, DP 1 is a power indicator.

melvanderwal commented 1 year ago

Thanks for including this in the latest release!

Here's my initial testing observations....

Turning the thermometer off and then on again results in the integration detecting it and functioning properly.

Thank you again, much appreciated!

lhassell commented 1 year ago

Thanks for including this in the latest release!

Here's my initial testing observations....

  • Added it

    • Tried adding it using 3.3 as the protocol version (I don't know what version it uses), didn't work, but auto works
    • Specified the IP address rather than using Auto
  • Power control:

    • Indicates On/Off status correctly
    • Switching it to off tells the Tuya app that the thermometer has been turned off, but doesn't turn the thermometer off
    • I don't think this is important - quite happy to simply have an On/Off sensor
  • Temperature Probes 1, 2, 3, 4: All work correctly
  • Alarm: Not tested yet
  • Screen Timeout: Works correctly
  • Temperature Unit: Works correctly
  • Battery: Appears to be working correctly
  • Fault: Shows Problem, not sure why

    • Everything appears to work properly, so it's not important to me

Turning the thermometer off and then on again results in the integration detecting it and functioning properly.

Thank you again, much appreciated!

How did you get it to be recognized as a temperature probe? Every time I try to add it, it only recognizes as an IR remote, and none of the DPs show up correctly. Is it something to do with how you name it?

melvanderwal commented 1 year ago

How did you get it to be recognized as a temperature probe? Every time I try to add it, it only recognizes as an IR remote, and none of the DPs show up correctly. Is it something to do with how you name it?

I didn't do anything special, pasted in the device id, IP address and local key, and selected Auto as the protocol version. An iBBQ-4T device was listed for selection along with the IR remote and I think maybe a switch? I had nuked the local-tuya integration that I was previously using to ensure that there wasn't a conflict. I know I'm being Captain Obvious here, but are you using version 2023.6.1?

lhassell commented 1 year ago

I just went through, removed everything and then reinstalled the integration. It's still not showing up. Going to try a reboot, but so far, it does not want to recognize my device.

lhassell commented 1 year ago

No dice. Can you check the firmware version on your device? Maybe mine got an update that killed the connection.

melvanderwal commented 1 year ago

Not sure if this is what you're looking for, but this is what I see when I click Download diagnostics. Not sure where to access the device firmware version specifically.


    "domain": "tuya_local",
    "name": "Tuya Local",
    "codeowners": [
      "@make-all"
    ],
    "config_flow": true,
    "dependencies": [],
    "documentation": "https://github.com/make-all/tuya-local",
    "integration_type": "device",
    "iot_class": "local_push",
    "issue_tracker": "https://github.com/make-all/tuya-local/issues",
    "requirements": [
      "pycryptodome~=3.18",
      "tinytuya==1.12.8"
    ],
    "version": "2023.6.1",
    "is_built_in": false
  },
  "data": {
    "name": "iBBQ-4T",
    "type": "inkbird_bbq4t_thermometer",
    "device_id": "**REDACTED**",
    "device_cid": "",
    "local_key": "**REDACTED**",
    "host": "**REDACTED**",
    "protocol_version": "auto",
    "tinytuya_version": "1.12.8",
    "api_version_set": 3.3,
    "api_version_used": 3.3,
    "api_working": true,```
make-all commented 1 year ago

@lhassell with some logs we might be able to see what is going on, but without any information all we can do is make random guesses.

lhassell commented 1 year ago

Sorry I took a few days. We had a power outage for a couple of days and I'm just getting back to this.

Here is a snippet of log from when I tried to add the device:

2023-07-02 16:41:48.994 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config inkbird_bbq4t_thermometer.yaml 2023-07-02 16:41:48.995 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Inkbird BBQ thermometer, missing required DPs: [{'107': 'int'}] 2023-07-02 16:41:49.001 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config inkbird_ibbq4bw_thermometer.yaml 2023-07-02 16:41:49.001 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Inkbird BBQ thermometer, missing required DPs: [{'107': 'int'}, {'13': 'int'}, {'108': 'int'}, {'109': 'int'}, {'110': 'int'}, {'13': 'int'}, {'112': 'int'}, {'116': 'int'}, {'117': 'int'}, {'118': 'int'}, {'119': 'int'}] 2023-07-02 16:41:49.001 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Inkbird BBQ thermometer, DPs have incorrect type: [{'111': 'bool'}] 2023-07-02 16:42:08.517 DEBUG (MainThread) [custom_components.tuya_local.device] Starting monitor loop for iBBQ-4T 2023-07-02 16:42:08.527 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for iBBQ-4T to 3.3 2023-07-02 16:42:08.553 DEBUG (MainThread) [custom_components.tuya_local.device] iBBQ-4T received {"1": true, "19": "f", "101": 100, "102": 15, "104": false, "105": 0, "111": 14, "full_poll": true} 2023-07-02 16:42:31.943 DEBUG (MainThread) [custom_components.tuya_local.device] iBBQ-4T received {"107": "OB0AAPb/CQD2/wkA9v8JAA==", "full_poll": false} 2023-07-02 16:42:58.057 DEBUG (MainThread) [custom_components.tuya_local.device] iBBQ-4T received {"107": "TB0AAfb/CQH2/wkB9v8JAQ==", "full_poll": false} 2023-07-02 16:43:24.165 DEBUG (MainThread) [custom_components.tuya_local.device] iBBQ-4T received {"107": "YB0AAPb/CQD2/wkA9v8JAA==", "full_poll": false} 2023-07-02 16:43:55.145 DEBUG (MainThread) [custom_components.tuya_local.device] iBBQ-4T received {"1": true, "19": "f", "101": 100, "102": 15, "104": false, "105": 0, "111": 14, "full_poll": true}

From the IOT site, I get the following:

{ "result": { "properties": [ { "code": "switch", "custom_name": "", "dp_id": 1, "time": 1688334105948, "value": true }, { "code": "temp_unit_convert", "custom_name": "", "dp_id": 19, "time": 1688334105948, "value": "f" }, { "code": "Battery_Percentage", "custom_name": "", "dp_id": 101, "time": 1688334105948, "value": 100 }, { "code": "Screen_Timeout", "custom_name": "", "dp_id": 102, "time": 1688334105948, "value": 15 }, { "code": "Compensation_Error", "custom_name": "", "dp_id": 103, "time": 1688326971475 }, { "code": "Ringer_Or_Silent", "custom_name": "", "dp_id": 104, "time": 1688334105948, "value": false }, { "code": "Alert_State", "custom_name": "", "dp_id": 105, "time": 1688334105948, "value": 0 }, { "code": "Preset_Temperature", "custom_name": "", "dp_id": 106, "time": 1688334104609, "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, { "code": "Temperature_1_2_3_4", "custom_name": "", "dp_id": 107, "time": 1688334413190, "value": "YB0AAfb/CQH2/wkB9v8JAQ==" }, { "code": "Probe_Fault", "custom_name": "", "dp_id": 111, "time": 1688334105948, "value": 14 }, { "code": "Probe_Preset_Extra_1", "custom_name": "", "dp_id": 112, "time": 1688326971475 }, { "code": "Probe_Preset_Extra_2", "custom_name": "", "dp_id": 113, "time": 1688326971475 }, { "code": "Probe_Preset_Extra_3", "custom_name": "", "dp_id": 114, "time": 1688326971475 }, { "code": "Probe_Preset_Extra_4", "custom_name": "", "dp_id": 115, "time": 1688326971475 } ] }, "success": true, "t": 1688334457696, "tid": "##REDACTED#" }

melvanderwal commented 1 year ago

@lhassell From the DPs, it looks like you're trying it with no probes plugged in. Do you have the same problem with the probes plugged in? Wondering if those missing DPs are the issue.

lhassell commented 1 year ago

Removed device, then plugged in all probes and re-added. Here is the log of the addition:

`2023-07-03 15:07:38.585 DEBUG (SyncWorker_3) [custom_components.tuya_local.device] new state (incl pending): {"updated_at": 1688414858.5851603} 2023-07-03 15:07:44.846 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test 2023-07-03 15:07:44.846 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3 2023-07-03 15:07:44.874 DEBUG (SyncWorker_16) [custom_components.tuya_local.device] Test refreshed device state: {"dps": {"1": true, "19": "f", "101": 100, "102": 15, "104": false, "105": 0, "111": 0}} 2023-07-03 15:07:44.874 DEBUG (SyncWorker_16) [custom_components.tuya_local.device] new state (incl pending): {"updated_at": 1688414864.8743668, "1": true, "19": "f", "101": 100, "102": 15, "104": false, "105": 0, "111": 0}

<...>

2023-07-03 15:07:45.542 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Inkbird BBQ thermometer, missing required DPs: [{'107': 'int'}] 2023-07-03 15:07:45.548 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config inkbird_ibbq4bw_thermometer.yaml 2023-07-03 15:07:45.548 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Inkbird BBQ thermometer, missing required DPs: [{'107': 'int'}, {'13': 'int'}, {'108': 'int'}, {'109': 'int'}, {'110': 'int'}, {'13': 'int'}, {'112': 'int'}, {'116': 'int'}, {'117': 'int'}, {'118': 'int'}, {'119': 'int'}] 2023-07-03 15:07:45.548 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Inkbird BBQ thermometer, DPs have incorrect type: [{'111': 'bool'}]

<...>

2023-07-03 15:07:46.397 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches simple_switch with quality of 14%. DPS: {"updated_at": 1688414864.8743668, "1": true, "19": "f", "101": 100, "102": 15, "104": false, "105": 0, "111": 0} 2023-07-03 15:07:46.399 WARNING (MainThread) [custom_components.tuya_local.config_flow] Report this to https://github.com/make-all/tuya-local/issues/ `

And here is the current return from the IOT site:

{ "result": { "properties": [ { "code": "switch", "custom_name": "", "dp_id": 1, "time": 1688414701720, "value": true }, { "code": "temp_unit_convert", "custom_name": "", "dp_id": 19, "time": 1688414701720, "value": "f" }, { "code": "Battery_Percentage", "custom_name": "", "dp_id": 101, "time": 1688415537719, "value": 99 }, { "code": "Screen_Timeout", "custom_name": "", "dp_id": 102, "time": 1688414701720, "value": 15 }, { "code": "Compensation_Error", "custom_name": "", "dp_id": 103, "time": 1688326971475 }, { "code": "Ringer_Or_Silent", "custom_name": "", "dp_id": 104, "time": 1688414701720, "value": false }, { "code": "Alert_State", "custom_name": "", "dp_id": 105, "time": 1688414701720, "value": 0 }, { "code": "Preset_Temperature", "custom_name": "", "dp_id": 106, "time": 1688414700181, "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, { "code": "Temperature_1_2_3_4", "custom_name": "", "dp_id": 107, "time": 1688415584569, "value": "XBwAAAIcAADGGwAA+BsAAA==" }, { "code": "Probe_Fault", "custom_name": "", "dp_id": 111, "time": 1688414701720, "value": 0 }, { "code": "Probe_Preset_Extra_1", "custom_name": "", "dp_id": 112, "time": 1688326971475 }, { "code": "Probe_Preset_Extra_2", "custom_name": "", "dp_id": 113, "time": 1688326971475 }, { "code": "Probe_Preset_Extra_3", "custom_name": "", "dp_id": 114, "time": 1688326971475 }, { "code": "Probe_Preset_Extra_4", "custom_name": "", "dp_id": 115, "time": 1688326971475 } ] }, "success": true, "t": 1688415610488, "tid": "##Removed##" }

amgarr commented 1 year ago

@lhassell I am getting similar results. I noticed that if you use it with the tuya app, the tuya app doesn't display info and options correctly. If you try to pair with the Inkbird app it does display all info and options correctly.

lhassell commented 1 year ago

True. But of course the inkbird app does not give you the key to connect it to hone assistant. For now, I'm just using the inkbird app, but I wish I could hook it into my setup.

make-all commented 1 year ago

There seem to be two different versions of this device, one with temperature readings on dps 107, 108, 109, 110, and another with all 4 readings encoded into a single value on dp 107.

The current config is made for the first type, but I suspect that the product id in the config is actually for the second type, as it was provided by @lhassell previously. Could someone with a working device look up their product id on the iot.tuya.com site so I can get these right?

melvanderwal commented 1 year ago

The current config is made for the first type, but I suspect that the product id in the config is actually for the second type, as it was provided by @lhassell previously. Could someone with a working device look up their product id on the iot.tuya.com site so I can get these right?

Since I originally posted, I've fixed up my Tuya project. "product_id": "x6oarivkdgru1upf"

 {
  "result": [
    {
      "active_time": 1687496520,
      "category": "wk",
      "create_time": 1591600283,
      "custom_name": "Mel's Thermometer",
      "icon": "smart/icon/ay15157410971057cPZi/494ec818cfe9118e0c10e21e8f93c740.png",
      "id": <redacted>,
      "ip": <redacted>,
      "is_online": false,
      "lat": Straya mate",
      "local_key": <redacted>,
      "lon": "Straya mate",
      "model": "IBBQ-4T",
      "name": "IBBQ-4T",
      "product_id": "x6oarivkdgru1upf",
      "product_name": "IBBQ-4T",
      "sub": false,
      "time_zone": "+10:00",
      "update_time": 1687496532,
      "uuid": "0460748598f4abfde6df"
    }
  ],
  "success": true,
  "t": 1691911271451,
  "tid": "faba8daa39a911eeb3f09e6a0abc163a"
}