Main Content

Building a bed occupancy sensor for Home Assistant

Recently after automating many of my lights with motion sensors (guide coming soon!) I found myself wanting a way to automatically switch everything off at night. The question was how to properly determine when my partner and I had went to bed for the night?

I started researching bed occupancy sensors and came across a great post from Zack at Self Hosted Home where he used an ESP8266, 4 load cells and a HX711 to build what is essentially a bed size weight scale to determine if someone was in bed or not.

However when I set about building this, I ran into a few issues that required my setup to be different:

How to connect 3 wire load cells, there are a lot of cheap 3 wire sensors out there but much of the documentation is for a proper 4 wire setup. Although to be clear, the post above does use a 3 wire setup also.
Load Cell drift – once I had the setup working, I found my values would slowly start to drift over the course of a day and I wanted a way to overcome that.
Using an exact weight rather than raw scale values – Zack uses the raw scale values in his setup rather than a calculated weight. This works great for his setup but my sport means that my weight can intentionally fluctuate quite a fair bit. For this reason I wanted to use a calculated weight in KG rather than the raw value, to make tuning my setup easier.
I also 3D printed some holders for the legs of my bed which are a little bigger than normal, these hold the sensors in place and stop the bed sliding around on them which I found was happening and causing issues with my readouts!”

Link to article