Inkbird IBS-M1 with IBS-P01

Does this inkbird temperture senor could work with a RFXCOM?

I have this same issue, its english using the InkBird app, but that doesnt integrate with HA. Have it installed via local Tuya but the app is in Chinese so its a circle of getting nowhere.

I eventually gave up and returned the device. Went with Yolink where the HA integration is very solid. They don’t have the same range of temperature sensors as inkbird - but they do have an outdoor temp sensor with a probe that I put in my spa. Used white gorilla outdoor waterproof tape to hold the probe line in place.

I am in the same boat as many of you here with IBS-M1 version2 (blue INKBIRD text on the front) which is not working in any of two Tuya apps (on Android). Chinese text. Anyhow I connected it to the HASS according to the instructions but the value I get in HASS is 0. Really disappointed.

The actual error in the log is the following:

 File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 1027, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/config/custom_components/localtuya/discovery.py", line 70, in datagram_received
    self.device_found(decoded)
  File "/config/custom_components/localtuya/discovery.py", line 79, in device_found
    self._callback(device)
  File "/config/custom_components/localtuya/__init__.py", line 142, in _device_discovered
    device = hass.data[DOMAIN][TUYA_DEVICES][device_id]
KeyError: 'bf9be55b_REMOVED_8i'

I wonder if there is some other doungle/device that can received the signal from IBS-P01 that works with HASS?

There might be some hope. Just found this thread with the links to the RTL_433 readers. If that works then it is just a matter of getting things into HA.

https://groups.google.com/g/rtl_433/c/oeExmwoBI0w?pli=1

1 Like

It works!!! and you skip all hassle with Tuya.

I hooked up my RTL-SDR dongle.
Installed these 2 addons. Minimal config was required. Added this to the end of config/rtl_433/rtl_433.conf.template so that the radio is not being “spammed” by other devices transmitting on the same frequency

protocol 194 # Inkbird ITH-20R temperature humidity sensor

I was up and running in under 20 min. I can have the data in HA. Themerature from Pool sensor is reported correctly but humidity shows 130% which is probably due to the fact that it does not have any humidity sensor.

Addons

Other sources to read

https://groups.google.com/g/rtl_433/c/oeExmwoBI0w?pli=1

https://wiki.jmehan.com/display/KNOW/Reverse+Engineering+the+Inkbird

1 Like

I am having the same issue with the new IBS-M2 Wifi Gateway. I opened a ticket with Tuya about this and the response was:

hi there

  1. we check the device and find that there is no device status (temperature)report from the device side
  2. there is no humidity data point defined by the manufacturer
    above all , we suggest you contact the manufacturer to know the detailed information

After further conversation they essentially explained that they can’t parse the data coming from the Inkbird gateway.

So I contact Inkbird and this was their response:

Hello,
Sorry, IBS-M2 only supports Inkbird App, which does not support the TUYA APP. Tuya app is not our app.
Cassie

The person in Tuya was helpful by showing me a way to query the device by using curl for the raw data. You need a Tuya IoT account (follow instructions on the page of the local tuya integration) and then you need to change the device from “standard instruction” to “DP instruction” (cloud → development → your project’s name → devices, find the device under “View Devices by Product” and click on “Change Control Instruction Mode”). Then note the Device ID and go to Cloud → API Explorer → Smart Home Device System → Device Management → Get device details. Put the Device ID and it will give you the curl command and the results. It is probably possible to do a curl sensor in HA and retrieve the data. The problem is that the data from the device is transformed and I can’t figure out the system they use (i.e. 22.1 degrees is "dw"m 23.0 is “eY”).

In any Case, I am following bortek’s advise and have ordered a RTL-SDR dongle. Then I don’t need the IBS-M2. Thanks.

1 Like

I can also confirm that this works. I actually had a bunch of Ambient Weather and Acurite temperature sensors that were also picked up by this. I can now have local integration with all of those temperature sensors.

Thanks @bortek ! I had a RTL-SDL dongle lying around and didn’t realize I could use it with Home Assistant.

Here is the URL to the repository you need to add: https://github.com/pbkhrv/rtl_433-hass-addons

Any RTL-SDL USB Dongle should work. I’m personally using this one

4 Likes

Thanks for reporting back guys. I’m glad that it helped. :+1:

1 Like

Got my RTL-SDR dongle, installed both plugins and all is working well. As a bonus I am getting data from the neighbor’s weather station. Thanks bortek.

2 Likes

It seems like we should be able to get a Sonoff RF Bridge to receive data from the IBS-P01R. I ask primarily because I don’t have a RTL-SDR dongle but I do have the bridge. I’ve collected raw data which I believe is from the IBS-P01R (shown below) but I have yet to sort out how to interpret it properly.

03:24:18.444 MQT: tele/SonosRFbridge/RESULT = {"Time":"2023-02-06T03:24:18","RfRaw":{"Data":"AA B1 03 01F4 00C8 0172 280919 55"}}
03:25:23.064 MQT: tele/SonosRFbridge/RESULT = {"Time":"2023-02-06T03:25:23","RfRaw":{"Data":"AA B1 03 00AA 0064 017C A08180 55"}}
03:25:28.439 MQT: tele/SonosRFbridge/RESULT = {"Time":"2023-02-06T03:25:28","RfRaw":{"Data":"AA B1 03 006E 00FA 0320 281908 55"}}
03:27:25.403 MQT: tele/SonosRFbridge/RESULT = {"Time":"2023-02-06T03:27:25","RfRaw":{"Data":"AA B1 03 00DC 01C2 01A4 A08090 55"}}
03:28:50.424 MQT: tele/SonosRFbridge/RESULT = {"Time":"2023-02-06T03:28:50","RfRaw":{"Data":"AA B1 03 006E 00B4 0190 A08181 55"}}
03:29:02.548 MQT: tele/SonosRFbridge/RESULT = {"Time":"2023-02-06T03:29:02","RfRaw":{"Data":"AA B1 03 0154 00C8 01C2 281809 55"}}

The Inkbird app loads my M1 and IBS-P01 no problem, but I can’t link that app to the IoT platform. I’ve tried loading them both the Tuya app and the Smart Life but whenever I do, everything loads in Chinese and I can’t make sense of any of it. How can I connect the M1 to Smart Life in English, in order to get it into the IoT platform?

Hi,
Do you know if the same can be achieved using RFXtrx433XL?

Thanks

I guess you are asking if “RFXtrx433XL” transciever is supported by rtl_433-hass-addons ? If so then the supported devices are listed here Hardware tested with rtl_433 | rtl_433 and yours is not in the list. But you could give it a try. If it uses the same chip as the supported ones then it might. No guarantees. You just have to test it.

Actually I wanna know if I can use the RFXtrx to communicate with the IBS-P01R

Same question. Did you have a solution?

1 Like

My looks exactly same:

Tuya IoT Device Debugg:

Device log:

Status:

Have You figured this somehow out?

I used an RTL-SDR dongle which worked but was unreliable over time because of the distance between the dongle and my thermometer in the pool outside. As such, I found another solution that works well but requires a lot of work and is (probably unnecessarily) complicated. I did this by using a gateway (the newer IBS-M1 or IBS-M2) connected to the local network and connected to Tuya instead of the Inkbird app. In the Tuya app I get everything in Chinese like other users. I then changed the device on the Tuya IoT website from “standard instruction” to “DP instruction” and created scripts that use curl and python to query Tuya online, convert the data to temperature in Celsius and update a HA sensor via MQTT. I run the scripts on the linux host of my HA instance, not within HA, which I access via SSH. I then use an automation to run the script periodically to update the temperature. It was a while ago when I did it so I may have not remembered everything, but this is what you need to do:

  • Connect the thermometer to an Inkbird Gateway (the newer IBS-M1 or IBS-M2) which is connected to the internet. Check that it all works with the Inkbird app but then remove the thermometer from the app.

  • Link the gateway to the Tuya app to get the Chinese information

  • Open a Tuya IoT account (follow instructions here: tuyapi/SETUP.md at 189b4f2818d52cd609d6feb750f939a603920909 · codetheweb/tuyapi · GitHub)

  • In Tuya IoT, change the gateway from “standard instruction” to “DP instruction”:

    go to cloud → development → your project’s name → devices, find the device under “View Devices by Product” and click on “Change Control Instruction Mode”.

    Note the Device ID, your Tuya ClientID and ClientSecret

  • Install and setup an MQTT broker and note it’s IP – I used Mosquitto broker running as a Home Assistant Add-on. If you do this, the broker’s IP will be the same as your HA IP/host name. See: addons/DOCS.md at ae2107bf57eb2db6c5cb0d9d8b14edfbaac32102 · home-assistant/addons · GitHub

  • I used a combination of a bash script to query Tuya and a python script to convert the result to the actual temperature:

    In the Linux machine, create a file called inkird_process.py as below. You will need to change “ch_1” with the channel you use on your gateway.

import json
import sys

charcter_conversion = {
    "A": 0,
    "E": 1,
    "I": 2,
    "M": 3,
    "Q": 4,
    "U": 5,
    "Y": 6,
    "c": 7,
    "g": 8,
    "k": 9,
    "o": 10,
    "s": 11,
    "w": 12,
    "0": 13,
    "4": 14,
    "8": 15
}

device_param = json.loads(sys.argv[1])
number_of_status = len(device_param["result"][0]["status"])

for i in range(number_of_status):
    if device_param["result"][0]["status"][i]["code"] == "ch_1":
        raw_temp = device_param["result"][0]["status"][i]["value"]

raw_temp_first_charecter = raw_temp[1:2]
raw_temp_second_charecter = raw_temp[2:3]
raw_temp_third_charecter = raw_temp[3:4]

temp_by_ten = (ord(raw_temp_first_charecter) - 65)*16 + charcter_conversion[raw_temp_second_charecter]

if raw_temp_third_charecter == "B":
    temp_by_ten = temp_by_ten + 256

pool_temp = temp_by_ten/10

print(pool_temp)
  • Also in the linux machine, create a file call inkird_query.sh with the following content, replacing ClientID, ClientSecret, Device ID, path to inkbird_process.py, your MQTT broker IP/Host name, MQTT username and MQTT password with your own values. Anything in the code that is surrounded by << >> needs to be replaced(I found the code online and changed it):
#!/bin/bash
debug=true

# Declare constants

ClientID="<<ENTER CLIENT ID HERE>>"
ClientSecret="<<ENTER CLIENT SECRET HERE>>"
BaseUrl="https://openapi.tuyaeu.com"
EmptyBodyEncoded="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
tuyatime=`(date +%s)`
tuyatime=$tuyatime"000"
if ($debug) then echo Tuyatime is now $tuyatime; fi;


# Get Access Token

URL="/v1.0/token?grant_type=1"

StringToSign="${ClientID}${tuyatime}GET\n${EmptyBodyEncoded}\n\n${URL}"
if ($debug) then echo StringToSign is now $StringToSign; fi;

AccessTokenSign=$(printf $StringToSign | openssl sha256 -hmac  "$ClientSecret" | tr '[:lower:]' '[:upper:]' |sed "s/.* //g")
if ($debug) then echo AccessTokenSign is now $AccessTokenSign; fi;

AccessTokenResponse=$(curl -sSLkX GET "$BaseUrl$URL" -H "sign_method: HMAC-SHA256" -H "client_id: $ClientID" -H "t: $tuyatime"  -H "mode: cors" -H "Content-Type: application/json" -H "sign: $AccessTokenSign")
if ($debug) then echo AccessTokenResponse is now $AccessTokenResponse; fi;

AccessToken=$(echo $AccessTokenResponse | sed "s/.*\"access_token\":\"//g"  |sed "s/\".*//g")
if ($debug) then echo Access token is now $AccessToken; fi;

# Send Device status request

URL="/v1.0/iot-03/devices/status?device_ids=<<ENTER DEVICE IDs HERE>>"

StringToSign="${ClientID}${AccessToken}${tuyatime}GET\n${EmptyBodyEncoded}\n\n${URL}"
if ($debug) then echo StringToSign is now $StringToSign; fi;

RequestSign=$(printf $StringToSign | openssl sha256 -hmac  "$ClientSecret" | tr '[:lower:]' '[:upper:]' |sed "s/.* //g")
if ($debug) then echo RequestSign is now $RequestSign; fi;

RequestResponse=$(curl -sSLkX GET "$BaseUrl$URL" -H "sign_method: HMAC-SHA256" -H "client_id: $ClientID" -H "t: $tuyatime"  -H "mode: cors" -H "Content-Type: application/json" -H "sign: $RequestSign" -H "access_token: $AccessToken")
if ($debug) then echo RequestResponse is now $RequestResponse; fi;

# echo $RequestResponse

Pool_temp=$(python <<PATH>>/inkbird_process.py $RequestResponse)

mosquitto_pub -h <<mosquito IP/Hostname>> -u '<<MQTT username>>' -P '<<MQTT password>>' -t pool/pool_temp -m {"\"temp\": $Pool_temp"} -r

# echo pool temp is $Pool_temp
  • The Linux machine that runs the scripts should have python and mosquito broker running locally

  • Uncomment the last line and run the script locally to check it works:

 ./inkird_query.sh
  • You will need to be able to connect via SSH from your HA to the Linux machine were you are going to have the scripts via the AH shell_command integration. For that you will need to create a key so you can connect without entering a password. I followed the very useful instructions here: https://siytek.com/home-assistant-shell/

  • In HA configuration.yaml add the following, replacing the username for the linux machine, the linux machine’s IP or hostname and the path for inkbird_query.sh:

shell_command:
  update_pool_temp: ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' <<user@linux machine IP/hostname>> '<<path>>/inkbird_query.sh'
  • Also in configuration.yaml, define the mqtt sensor:
mqtt:
    sensor:
      - name: "Pool Temperature"
        state_topic: "pool/pool_temp"
        unit_of_measurement: "°C"
        device_class: temperature
        value_template: "{{ value_json.temp }}"
        json_attributes_topic: "pool/pool_temp"
        unique_id: tuya_mqtt_pool_temp_sensor
        object_id: pool_temp
  • In automations.yaml, create an automation to update the sensor every time interval. Below automation updates it every 30 seconds, which is probably excessive
- id: update_pool_temp_every_minute
  alias: update_pool_temp_every_minute
  trigger:
  - platform: time_pattern
    seconds: "/30"
  action:
  - service: shell_command.update_pool_temp
  • Restart HA and you should now have a sensor called pool_temp that has the current temperature.

As I said, very complicated. There is probably an easier way to run the script and update the sensor but this worked so I just left it like that. I hope I didn’t forget any steps.

3 Likes

Great work.

I wonder if after changing to DP instruction you can then use the standard local tuya tools to access.

I’m certainly going to give it a go.

I think I tried it with local tuya, but I’m not sure. Let us know.