Inkbird/Engbird Thermometer and Hygrometer sensor. Need help trying to add them to HA

@Motive313 Did you ever get past that error? I have the same problem.

Been playing with the inkbird and custom component for few days now and cant seem to work out the ha functioning properly. Whatever I try, it wont load any values in HA. Figured all kinds of tools on command line which helped me on the permissions etc.
In the end, I COULD use the helper_scripts showing me through Python the readings of sensor. So i modified the test_btle.py to return only value of temperature first. command line works and returns me temp.
Then i added a command line sensor in HA that executes “python3 temp.py” and voila, i have temperature in HA.
Next step to modify the py to return a json format of all 3 values and parse them as such into HA and i’m done.
Maybe look later into the custom component itself, but for now i’m happy :slight_smile:

additional findings. Having polling a lot isn’t very stable, bt on raspberry gets unresponsive etc. Changed update interval to 3 times and hour. Got feeling that BT 2,4Ghz band has interference a lot with all the wifi around.
Adjustments in frequency do help a lot, not all updates are succesful, but it always recover.

Sorry I never noticed that you asked me. I’m still having this issue.

Anybody using @stelford add on with the Inkbird IBS-P01?

Been trying but there seems to be an issue that I am unfortunately not talented enough to address.

2021-03-09 20:22:14 ERROR (MainThread) [homeassistant.components.sensor] inkbird: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 465, in async_device_update
    await task
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/inkbird/sensor.py", line 139, in update
    self.handleDiscovery(dev)
  File "/config/custom_components/inkbird/sensor.py", line 167, in handleDiscovery
    battery = int(value[14:16], 16)
ValueError: invalid literal for int() with base 16: ''

To get @stelford add-on to work with Docker HA, need to access shell of the container to install bluepy. Also MAY need to apk add libcap, then setcap ‘cap_net_raw,cap_net_admin+eip’ on the bluepy-helper file. Likely more importantly is cap_add: NET_ADMIN for the container. This would get you past the permissions block for bluepy ‘le on’. However, I was then faced with the ValueError as described a few times in this thread.

This was resolved when the MAC address in the configuration.yaml was all lowercase.

Humidity, temperature, and battery values are all correctly pulled from IBS-TH1 v1.5.0 and v2.0.0.

I hacked out some fixes to @stelford that may correct some of the issues people have in this thread. See my fork here:

It’s probably better to use MQTT or something, but I haven’t gotten to that yet. I “don’t know how to program”, so that’s why I’m saying my fork is more a hack and this is why I can’t provide any support! First time looking at python code, first time using github. Let me know if it works for you though! Good luck

1 Like

Hi everyone,

I am trying to integrate the current model IBS-TH2 sensor into HA, and have been modifying stelford’s code to make it work. While the device is being detected and is shown on the dashboards, the temperature displayed is not correct.

I have been testing with the test_btle.py script , and after a bit of trial and error I have managed to identify the code which needs to change in order to get the correct temperature from the IBS-TH2.

At line 45 of the test_btle.py script where it reads “readings = dev.readCharacteristic(40)” this needs to be changed to “readings = dev.readCharacteristic(36)”

I have tested this multiple times and it works across a range of temperatures. And I now need to get the changes to reflect in Home Assistant, but I cannot find a similar line of code in “sensor.py”. Can someone please point me to the right script where I can make this change?

2 Likes

I just ordered the IBS-TH2. I’ve been reading through the code, test_btle.py uses a different function to get the values than the sensor.py does. Line 162 of stelford’s code is where the temperature is parsed, I suspect this is where the issue is. Once I get my sensor I’ll try to figure this out.

1 Like

I received my IBS-TH2 and it works with no modification of the code. All values match the Engbird app. I am using the code from mike0xt which did have an error in manifest.json. It needed a comma after version, line 4.

1 Like

Have I understood this correctly? As long as the HA platform has built in bluetooth or a BT adapter you only need the IBS-TH2 sensor and not the Inkbird gateway (IBS-M1) as well? I have ordered the Odroid N2+ Blue and am planning to combine it with a bluetooth adapter like the TP-link UB400 which according to others should be plug and play.

Edit 27. Sept: Forget it! Found out now that the gateway IBS-M1 does NOT support the IBS-TH2, so there is no InkBird gateway for the TH2.

I was successful in getting this up and running.
Set up
Raspberry PI 4
HA 6.5
Inkbird IBS-TH2
I used the code from mike0xt, with the modification to the manifest.json file.
First, you should download the App and pair the sensor to your phone so you can capture the MAC address.
While your copping mike0xt files via SSH pair your Bluetooth device via the bluetoothctl cmd as follows
bluetoothctl scan on
bluetoothctl pair FC:69:47:7C:9D:A3 ← replace with your sensor MAC address
bluetoothctl trust FC:69:47:7C:9D:A3 ← replace with your sensor MAC address

I had to reboot the Host in order to get the config to accept the configuration.yaml edits.

Did you get errors before rebooting?

Platform error sensor.inkbird - Integration ‘inkbird’ not found.

Do you have more details on what you did to get this to work?

Is there any way to use this code along with a BLE bridge (ESP32 with Esphome)?

For information Openmqttgateway support Inkbird sensors out of the box with an ESP32.

You can upload to the esp32 through the web installer below.
https://docs.openmqttgateway.com/upload/web-install.html

The sensors will be auto-discovered :

If you are using a Raspberry Pi, Windows, or a server on Linux you can use this:
https://theengs.github.io/gateway

2 Likes

Thanks for the tip.

I ended up returning all the IBS-TH2 as 3 out of 4 of them randomly died in the 2 weeks I had them for some reason. That didn’t instill much confidence in them.

BLE monitor is now supporting Inkbird IBS-TH1/2, iBBQ-2 and iBBQ-4 sensors.

2 Likes

Interesting, were you using those in a particular environment?