Bedjet integration?

Hi @madcoder,

I wanted to say a big thank you to you for creating this!

I just set up the ESPHome integration yesterday and it works, more or less, perfectly. The BedJet accepts commands and responds right away but the HA front end seems to take a little while to catch up (usually between 10-30 seconds) however this is 100% not at issue for my use case. Simply being able to issue commands is amazing!

One thing I haven’t been able to figure out is how to set the clock on the BedJet via ESPHome/Home Assistant.

I was able to implement the firmware upgrade lambda button and BLE client switch, both of which seem to work fine, and I can see in the source code that there is a “send_local_time_()” function but I can’t seem to get that working.

I have set up

  - platform: homeassistant
    id: homeassistant_time

and I’m currently using “homeassistant_time” as the time source:

  - platform: bedjet
    id: climate_bedjet_1
    name: ${friendly_name}
    ble_client_id: ble_bedjet_1
    time_id: homeassistant_time

I’m not sure if the time-setting functionality is supposed to be automatic or not but it doesn’t seem to be working for me.

I tried making a lambda similar to the firmware upgrade one but it won’t compile and says that send_local_time_() is a “protected member function”.

I was just hoping you might be able to provide some guidance.

Thanks again for making this amazing ESPHome integration!


I believe what you have done is all that’s needed.

Was wondering the same thing and checked the time on the bedjet before installing the integration and it was a minute off. Now has the proper time!

Hi, glad it’s mostly working for you.

  1. The delay in updating is something I deal with as well. There’s a couple problems leading to this, the biggest one is that the esp32 doesn’t currently have a way to configure how frequently the BTLE notification gets triggered, which means by default it becomes a “fire hose” that receives new updates as quickly as possible, usually on the order of every 100-200ms.

You’d think that means updates should happen more often and you’d be right. But I intentionally throttle the updates back to HA, in order to avoid overwhelming either the esp32 or HA. So even though it attempts to send the status update to HA as soon as the bedjet acknowledges the command, because of this rapid stream of status updates across a different service, that recent command tends to get “reverted” quickly, that revert gets sent to HA, and then the rapid stream of status notifications changes as well, but by then the reverted status was already sent, and now it’s in its “throttle” period and won’t update with the latest status until the next polling period (30sec by default, but can be configured by setting the polling interval).

A better improvement would be to make it smarter about sending status updates caused by a recent command; something like: if we recently sent a temp change, wait until the next update is received that matches that temp, before sending the current status. Or similar for mode, etc. Right now it’s just a naive throttle.

  1. I’ve also recently seen issues with the clock set, which is odd because it worked for me for a long time before it merged. But I did also install the recent firmware upgrade about a month or so back (I’m on the beta/test firmware). So it’s possible something about that firmware has changed the clock sync.

Another possibility, which is something I see on my bedjet but not on my wife’s, is that mine has issues with connectivity: it seems to drop connection every 30min (almost to the second it seems), and sometimes it takes multiple reconnect attempts before it succeeds. It does always reconnect ok, in its own, so it doesn’t bother me. Just that I notice it flap every 30 min in the connection binary sensor. The clock is synced after connecting, so I wonder if that gets lost at times because of this connectivity stability.

It also isn’t clear if there’s a distinction between setting the time on the bedjet vs on the remote, and/or if setting it over Bluetooth will show the time change on the remote. I’ll have to do some testing to know for sure.

Feel free to open GitHub issues for both of these, and I’ll take a look.

1 Like

If anyone here is a developer it may be possible to get a direct integration by helping the company.

The clock update issue seems to be fixed after upgrading ESPHome to 2022.5.1 and reflashing the ESP32.

One thing I noticed regarding stability of the connection was that it seems very dependent upon what the ESP was being powered with.

When I powered it from my laptop it stayed connected indefinitely. When I powered it from random USB chargers, I got extremely varied results. I tried various chargers from other devices that I had accumulated over time; they all power their original devices just fine but the ESP connection was very flaky when using them.

I wound up using an old Nexus 6 charger and it is very stable now; only two momentary drops in the last 24 hours.

Looks like there was a change in dev that didn’t get updated here - I know it worked when I added it! :joy: I see that Jesse fixed it so looks like that’s been released now.

I’m going to go ahead and make some changes so it can work from a lambda (like what you tried to do, but now it’ll work because it’s public), and also a separate public method that would let you set the clock manually even without a time_id component.

As for the connection stability: that is interesting, though maybe not entirely unexpected. However, in my case I’m not sure if that would be what’s affecting me, because I use a single ESP32 to communicate with both BedJet devices (mine and my wife’s). My wife’s BedJet doesn’t have the 30-min connection flapping, but mine does. Even more strange: every now and then mine seems to stabilize for a couple hours at a time, but eventually goes back to the 30-min flapping (like clockwork).

The clock sync changes were merged tonight, so latest dev version will allow you to make a template button that syncs the clock to the time_id that’s configured.

Regarding this first issue of taking ~30 seconds for the HA device to reflect status changes, I’ve made some changes today that should not only address that (I see updates reflected in HA within 1-2 seconds now), but also opens the door to adding other domain components, such as a fan component if you prefer that entity type over the awkward climate/thermostat “fan mode” drop-down selector. And I have a few other ideas as well.

It’s a big change, and I’ve only been running it for a few hours now. I’ll have a better idea about stability after letting it run a while longer. If you want to try it out, you can use the “external_components” block to point to my PR #3522. It is a breaking change, requiring some minor changes in the yaml, but those are explained in the docs PR. If you do try it out, I recommend backing up your current config so that you can revert back to the current version if the PR gives you trouble.

Perhaps not the right place to ask but I’m really interested in some unbiased reviews: are you happy with the bedjet and would you recommend buying it?

I like it. I use it every night. My wife hasn’t figured out the best settings for her, so she kinda rarely uses hers. I use a moderate heat, around 84-85°, which sounds like it would be hot, but when you consider body temp is 98, it still ends up being relatively cool, but not too cold.

And in winter using a biorhythm program that starts out with a high heat turbo for a few minutes is delightful. It’s like being wrapped in a blanket fresh out of the dryer.

It’s orgasmic. You have to play around for the first week to find out what’s comfortable but it’s improved my sleep quality in ways that nothing else could. You need AC running in the bedroom to cool you down anyway. It will not magically cool you in extreme heat of Summer, as it’s basically an air blower with a heater - awesome in the cold season. I rarely need AC in England so most of the time I have cheap “cooling” from the bedjet.

Thanks, @madcoder and @anon78847916 !

1 Like

The PR mentioned above is now merged and available as of 2022.8.0b1. And 2022.8.0 was released 5 days ago.

The breaking change is exemplified in the test.yaml file, and involves adding the new bedjet hub component, and replacing ble_client_id with bedjet_id in the existing climate component.


Can someone help me?

Please see the github issue I opened.

Please someone.


@madcoder First off, thank you for the integration, I’m loving it! The BedJet was the last thing in my smart house to make it into Home Assistant.

Only issue I’m having is figuring out how to initiate a biorhythm preset. Here’s what I see for the climate entity in HA:

I don’t have anything set in the BedJet app for the M1, M2, etc. and they don’t do anything when selected but I do have all 3 biorhythms set in the app and I can’t find how to call them from HA.

Any help would be appreciated, thank you!

I thought I tested this and it was working using the M* presets. In the app or remote, it only lets you set 3 presets, and it can be either a mode/time/temp preset, or a Biorhythm program. You should be able to use the remote to check your presets and configure the Biorhythm program to one of the three buttons if it’s not already. Confirm that the remote is able to start the Biorhythm program with the configured memory slot button, and then the matching M* preset should do the same thing as pressing the same button on the remote.

I’ll run through it myself when I get back home, and verify that it’s still working as intended.

I was able to confirm that if you assign your Biorhythm program to one of the memory slots, then selecting that preset (whether from the remote or in the HA climate card) will start the Biorhythm program.

It doesn’t report it as running the program, but it will automatically change as the program progresses. For example, I’ve programmed my “winter” program into memory slot 2. It starts out with turbo and then has various other steps and timers and delays. When I select M2 preset in HA, it starts the program which causes the climate device to report the Boost preset at 109° and the right fan speed. When the next step begins, the temp/fan speed/time remaining all update to reflect the next step, and so on.

It won’t actually report to HA that it is “running a Biorhythm program” or that it’s on “step x of y” or anything like that. It just starts the program and reports the current status.

FWIW, you could also make a “fake” Biorhythm program using pure HA automations or a script that executes each stage as a service call with delays between them :smirk: that’s all a Biorhythm program is going to do also. But to answer the question, all you need to do is assign your Biorhythm program to a memory slot and it will work.

1 Like

Thanks for the quick reply! I think I may have finally found the only reason to not save the $20 on getting the BedJet version without the remote… I can’t find a way to have the phone app save the biorhythms into the memory slots… it only wants to save the current temp and fan settings into the M* slots. I guess it’s time to script a rhythm!

Thanks again and keep fighting the good fight!

@madcoder , how did you save the biorhythm to the memory? Did you start the biorhythm and then hit save from the main screen?

It’s been a long time so I’m not totally sure. The app won’t pair, so I can’t check that right now. But in the remote, under the Biorhythm menu, there’s an option to “save to m key”.

If I get the app to work I’ll check that and report back. But I’m pretty sure that I used the remote to set mine to M2.

Does anyone know if there has been progress on the built-in Bedjet smart home functionality?

There was talk about Bedjet recruiting developers to make a plug-in module that uses the “USB” port (actually a serial port) on the main unit. I believe they were contemplating creating a serial API and releasing an external dongle that would perform the smart home functionality. Would love to know if the serial API has been released.