Bedjet integration?

I want to get one of these Bedjet cooling/heating systems. But only if I can integrate it into HA.

Why should I have to fumble for a remote when I can order HA to do it for me?

I have the dual V3 system. I love it, albeit I wish it had an API and I could tie it into Home Assistant. The Wifi functionality of it currently is limited to just updating the firmware. I would love a local API.

I also have a Bedjet and would very much like to integrate it with HA

For anyone interested, as I certainly am, I received an email from Tim @ BedJet which states the following… “We will be updating the BedJet 3 firmware towards the end of the year to integrate with Amazon Alexa and IFTTT to allow use of smart home and voice control functions. We will send notification via email to BedJet 3 owners once this is update with instructions on use.” It might be not be direct integration with HA, but it will work if you setup the IFTTT Webhook.

2 Likes

I’ve successfully gained control over my Bedjet V3 locally via Bluetooth LE on a Raspberry Pi 3b+
I did it in Node-RED, I haven’t integrated it into Home Assistant yet but I plan to and also plan to do a write-up at that point.
If you’re impatient and can’t wait for me to post my documentation (or for whatever reason I don’t get around to it) I highly suggest checking out this GitHub repo.
I owe me being able to do this to Pete, he did a great job at using the Bluetooth communication both in writes (send commands) and reads (get states), I wouldn’t have been able to get this far without his code leading the way.

The photo below is just an example of what is accessible, it currently does not do anything outside of Node-RED for me, but getting Home Assistant talking to this should be relatively easy.

Oh, worth mentioning this is the first Node-RED flow I’ve ever used, so any suggestions are more than welcome

I had very mixed results trying to get this work, but in this configuration it has been responding well. On some of my other machines I could not get this same configuration to work.

5 Likes

Very much a work in progress still, but coming along

1 Like

That looks awesome! Thanks for putting in the time on this @zimmra

I’m looking forward to the docs and I’ll check out that repo if I get antsy in the meantime

Should be this weekend

I’m certainly no professional, so aspects of it are probably janky, but it has been working well for me and I’m hoping it’s usable for others too and/or that someone else can run with it and improve it.

Just got a bit of cleanup and additional testing and then I’ll get it posted here.

2 Likes

Frustratingly my bedjet is the last smart device in my home which remains elusively out of reach. You’re awesome, looking forward to finally getting this looped into HA.

Do you have any idea if this will work on a managed instance of HA?

I guess I am not sure what you mean by ‘managed instance of HA’

I have this working currently in Supervised Home Assistant (Home Assistant OS) using the official Node-Red addon - but there’s no reason this couldn’t be ran on any Node-Red machine on the network as long as HA is configured to look at that.

It’s been working well for me, but isn’t clean enough to be published yet. I would hate to put something out there that could cause problems for someones HA instance or bedjet because of me. I’ve unfortunately become insanely busy the past two week, but still intend to clean it up and put it out there for whoever wants to use.

If you know node-red or want to learn it I would take a look at the github link I posted above - this was my first Node-Red project ever and I was able to manage so I would think someone who knows Node-Red (and gatt, which was also new for me) should be able to make this

Right, supervised, that’s what I meant :sweat_smile:

Thought it was worth mentioning I found this by /u/pjt-0620/ on reddit. Seems to be a step in the right direction GitHub - pjt0620/Home-Assistant-Bedjet: Bedjet Home Assistant Mqtt Integration

Great to see more integrations!

Found this the other day. Hopefully it’s added soon. Would be great to use a low-cost ESP32 that could easily do other tasks too (bed occupancy sensor, etc.).

1 Like

Yeah I haven’t posted any additional info on my nodered setup for it because it’s not really bullet proof. It works great most of the time but my RPi 3 that’s acting as the ‘ble hub’/nodered host has gotten into a fit a few times and required quite a bit of intervention to get working each time.
Problems with nodered interfacing with the Bluetooth chip pop up randomly

Nodered is great but these two other implementations seem much more robust

FYI I was able to get this working with esphome on an esp32. It looks like they are going to commit a bedjet header file in a future release. This is good news. The bad news is, it seams the bedjet can only talk to one device at a time, so I cannot use home assistant and the mobile app. I literally just got this working 5 minutes ago so I will have to do a lot more testing on this.

4 Likes

I’m the author of the esphome bedjet component linked above, which is still pending code review so has not merged yet. I’ve been using it for the last few months and it has been working great so far. I use automations linked with my sleep-tracking app’s MQTT support, to start warming the bed when my sleep tracking app sends its “get ready for bed soon” event, and when the app enters the “smart wakeup” period, it switches the BedJet from heat to cool, as an incentive to get up.

The bad news is, it seams the bedjet can only talk to one device at a time, so I cannot use home assistant and the mobile app.

This is true as a side effect of the way BLE GATT servers work, unfortunately. To allow an easy way to work around that, I added documentation specifically to call this out and to add a recommended workaround by adding a ble_client switch device, which allows you to enable/disable the BLE client in the esphome integration. That lets you turn off a switch that effectively disconnects the ESP32 from the BedJet, thus allowing the app to function normally. When you’re done with the app, you can close it and then toggle the switch back on, which will reconnect the ESP device.

For what it’s worth though, I tried to make sure that the esphome component can do most of what I need it to do, and therefore I no longer miss having the ability to use the app, because I haven’t had a need to open the app since I fixed a BLE notification bug that was causing major issues with connection stability. After fixing that, and setting up my automations the way I want, I do not miss having the app :slight_smile:

Would be great to use a low-cost ESP32 that could easily do other tasks too (bed occupancy sensor, etc.).

Something simple like an occupancy sensor might work ok. It’s worth pointing out though that the ESP32 is somewhat limited by flash size and memory. In my house, I have a single ESP32 that talks to 2 separate BedJets, and that works okay because it only has to include the bedjet component once and then sets up 2 connections with the single component.

But it starts to run into problems when you try to upload new firmware to the ESP, because of the fact that the BLE client is pretty resource intensive, especially while receiving rapid BLE notifications – the firmware times out mid-upload if 2 clients are connected at the same time.

I have a workaround for that which is also documented in the bedjet component docs at the link above, that suggests adding an esphome ota.on_begin automation that will disable the BedJet clients when a firmware upload begins. That has solved the ESP overloading issues for me when uploading the new firmware. I bring that up, because it highlights the limitations of the ESP devices, and while it may work with something that uses simple GPIO inputs like the occupancy sensor idea, anything heavier than that may not work properly and may cause intermittent crashes (for example, I don’t think that it would be possible to add MQTT support alongside the bedjet component on a single device, because MQTT is also “heavy”, and both MQTT and BLE client together may not fit on the flash device, let alone runtime resources necessary to accomplish both).

7 Likes

I’m curious to see if this happens to work with with my BedJet v2, or if the bluetooth commands are different for some reason.

Hopefully ESPHome accepts the PR soon! :slight_smile:

2 Likes

Before discovering that somebody had already done the bulk of the work to get the device working with ESPHome/HA, I did some basic reverse engineering of the android app.

The decompiled code is … messy … but there were several clear parts of the code where the BTLE data was interpreted/composed differently based on the hardware revision. The differences are not huge so it’s probable that the esphome component could be adjusted to work with V2 hardware as well.

I should add that the APK refers to a v1 and v2 but it’s not clear if the 2nd generation of hardware is classified as v2 or v1 as far as the communications are concerned.

I hope this means there is progress being made, I haven’t looked into it other than the email I got today.

Thank you for being a BedJetter!

We recently released an important firmware update for the BedJet 3 and encourage you to download it. This firmware release V1.20 (140) does not add any new functionality to your BedJet, but does include changes that will improve reliability of future firmware updates. Your BedJet will not lose any functionality if you choose to skip this update, but you could lose out on the opportunity to get future feature upgrades.

Please note that your BedJet will need to connect to a 2.4GHz WiFi network to complete this firmware update.

Has it ever updated? Mine doesn’t seem to ever complete the process… It keep showing on the remote but fails. How long did the update take on your device?