Bed Presence for ESPHome by Elevated Sensors

Is your HA server and IoT devices (ESPhome devices) on different VLAN’s? That’s my issue and the ESPhome Dashboard never displays newly added devices if they are brought in externally (ie: not created from YAML). I had that issue with a couple of Athom Presence sensors.

Nope. One flat network.

I just turned off “use ping for status” in the ESPHome add-on and it found it.

oh nice. I haven’t tried that before because using ping was the only way for the ESPhome dashboard to see my devices as online given the VLAN setup

Yeah one of my other sensors now fails to show up as online in the esphome dashboard but I can connect to it and view the serial logs. Weird. That’s probably why I turned ping on initially.

All sorted except…

As for adding the status binary sensor, which I prefer to the uptime sensor for monitoring devices on my network, I’m not 100% sure if I can add that. Or if it will interfere with the binary sensor declaration in the package include.

So maybe this would be best asked for as a future request for a future firmware update?

If you do find that it conflicts for some reason, you can always remove the uptime sensor. The underlying package (sensor-configs/bed-presence-mk1/base.yaml at b6af5cad30f6a0196b2c253b769db3aef87f976f · ElevatedSensors/sensor-configs · GitHub) includes an id for each sensor, so you can remove it as documented here (Packages — ESPHome). For the uptime sensor, it would look something like this…

sensor:
  - id: !remove bed_presence_uptime

Not bad. I like the idea of a readily made locally controlled bed sensor. I am still missing this kind of sensor to include in my automations. I’ll wait if you will be coming up with an idea how to reliably measure presence in a box spring bed (the proper one with two thicker box spring mattresses and a thinner topper)

Thanks for the advice Stephen. I’ll give adding the status sensor a go later. What I meant by ‘interference’ was having a binary_sensor: definition in the main file and in the included package. I guess that should be ok.

The first night with the new sensor has proven very positive. No false alerts (from an unusually restless night’s sleep) and yet it was also very fast to respond to being out of bed.

Very easy to set up too. I might try another calibration as I noticed the FSR is settling a little lower now that it has had time to straighten out from the shipping kinks (curls really) under pressure of the mattress.

That was the easy bed though. I have another bed with a much denser mattress. That’s tonight’s test.

Ah, understood. I just verified you can add the status sensor to your config without causing any issues with the underlying packages. I added the following binary_sensor section after the packages section.

packages:
  remote_package:
    url: https://github.com/ElevatedSensors/sensor-configs
    ref: main
    files: [bed-presence-mk1/base.yaml]
    refresh: 1s

binary_sensor:
  - platform: status
    name: "Bed Presence Status"

Glad to hear it’s performing as expected!

You beat me to reporting it. I had already tried it and confirmed it working. :smile:

I’ve noticed that the minimum pressure % when the bed is unoccupied is slowly getting a lot closer to 0 on both my beds. Is there some sort of auto calibration or is it just the FSRs flattening out after being curled up in packing?

Either way it’s a good thing. Much better range. I just need to recalibrate the triggers once it has settled to 0.

The Pressure % sensor just reports what it sees (inversely correlates with FSR resistance), no calibration to try to move it down to 0%. So it very well could be the sensor just straightening out from shipping. It’s great to see people’s setups return to 0% when unoccupied, but it’s not expected for all beds. It seems that memory foam is the most challenging. It seems to remove most of its weight from the slats immediately after you get out of bed, but then slowly relax and put its weight back on the slats over many hours (picture below). I’ve also see the opposite, where the pressure decreases slowly while the bed is unoccupied. As long as the Trigger Pressure is set above this rebound point, it doesn’t cause problems.

As we see more bed types in the mix, we’ll learn how different bed setups respond. If you don’t mind sharing, what kind of mattresses do you have?

I have a memory foam mattress as well and was wondering the same thing as tom if there’s some kind of calibration since mine also started reporting 0% when no one was in bed, but that makes sense since it was a bit rolled up from shipping.

I know I’ll get some flak for this, but maybe the solution is pretty simple if you can resist the temptation.

Install the hardware and don’t do the software part until you’ve slept on the thing for at least week. That should solve the majority of “settling” issues, provided you resist the urge to play with your new toy :wink:

Cool thanks for the info. It is an inner-spring mattress. Even my much denser one with a memory foam pad settled to unoccupied value of 0% after a few hours.

One last question. Is there a way to increase the throttle delta of the pressure sensors?

  - or:
    - delta: 0.1                  # only send if sensor changes by +/-0.1% (eliminate sensor noise)
    - throttle: 60s               # but still update every minute

I’m finding my sensor is very sensitive to movement. a value of 0.1 is resulting in constant updates every second which is just unnecessarily bloating the database. I probably need to increase this to 0.8%. See this zoomed in 40 minute occupied view:

Mine only needed a recalibration of the unoccupied pressure after 3-6 hours. It had settled to 0 by then.

1 Like

Let me look at increasing the default delta. I should also be able to add a substitution to the package so that custom yaml configs can override the default value. I’ll also add a ticket: Default sensor delta causes database bloat · Issue #24 · ElevatedSensors/sensor-configs · GitHub

2 Likes

A substitution would be great.

I just got my sensors and I will share my first impressions here: Elevated Sensors Bed sensor first impressions & teardown - Hardware - Home Assistant Community (home-assistant.io)

I still owe you some feedback. I have now been testing the sensor with my box spring bed for some time, and it works wonderfully. I extended the receiver with an extension cable, as mentioned in previous posts, allowing me to place it at the back of the bed to protect it from pressure. The sensor, however, sometimes has interruptions with my girlfriend, likely due to her low weight (see attached screenshot). Compared to my old setup, which used pressure mats combined with an Aqara humidity sensor, this new method works much better. :muscle::raised_hands:

Girlfriend:

My side of the bed:

1 Like

Glad to hear it’s working better than your old setup. Did you end up putting a “slat” between the mattress and box spring? You also might try reducing the trigger pressure for your girlfriend’s side of the bed. Taking a look at the pressure graph during those false negatives would give you an idea of what you would need to adjust the trigger value to.

Just wanted to say that I purchased one of these and so far it’s AMAZING! My bed does not have slats, the mattress just sits in kind of a ‘hole’ in the bed frame and the bottom is solid. But for the past two nights it’s been perfect. I’m very excited to be able to add automations now that I’ll be 100% certain when I’m in bed.

1 Like

Firmware Update 2024.10.0

Eliminate DB bloat, improve sensor response, add lots of options for customization. This is the first firmware update for Bed Presence Mk1. It will be the 2024.10.0 release and be available OTA to managed devices. Devices already imported into the ESPHome Dashboard will need to be recompiled to get access to the new features.

Eliminate DB Bloat

The default delta threshold and reporting interval have been updated so that the sensor only reports new values when something actually changes. This will decrease the update frequency dramatically and eliminate bloating the database.

Improved Sensor Response

The sensor now uses a window average by default. This helps smooth out any quick movements, while also slightly improving the response time for getting out of bed.

Calibrated Sensor

If you’re annoyed by a different response from each side of your bed, the Calibrated Sensor is for you. This is an additional sensor that scales your raw pressure values between the Unoccupied Pressure and Occupied Pressure.

Status Sensor

Added a binary status sensor to expose the device’s connectivity state.

Option to Use Full Range

By default, Pressure [Right/Left] is focused on the most sensitive zone of the pressure sensor (Full Range = Off). This should perform well for most setups. By turning on Full Range, you can expand it to use the full range of the sensor. Consider turning ON Full Range if slight movements in bed quickly drop the sensor value to zero, causing frequent false negatives. Recalibration is necessary after toggling Full Range

Lots of Substitutions

If you import the device into the ESPHome Dashboard, there are now lots more substitutions within the package to customize behavior. This should allow you to change the behavior quite a bit while still using our remote package. You only need to provide the substitution if you want to override the default, so you can now remove any of the original substitutions specified in the default config if you’d like to have default behavior.

See sensor-configs/bed-presence-mk1/sensor.yaml at ee13dd996fa161888cbf70d9788dbd59b9c5f76e · ElevatedSensors/sensor-configs · GitHub for substitution descriptions. Default values indicated below.

substitutions:
- trigger_percentile: '0.75'
- averaging_window_samples: '5'
- fast_delayed_on: '0ms'
- fast_delayed_off: '0ms'
- standard_delayed_on: '0s'
- standard_delayed_off: '1s'
- reporting_delta: '1.0'
- reporting_interval_max: '180s'
- calibrate_100: '408000'
- calibrate_0: '276000'
2 Likes