DIY chair occupancy sensor
Based on a leak or contact sensor and a car seat pressure sensor
Introduction

To detect that, it’s possible to use a motion sensor,
but to detect when you also sit still on a chair, it’s better to use a presence sensor.
The downside with one of those is, they will also detect animals or blowing fans and are more expensive.
They detect a wider range and not only the chair occupancy.
I also use this room when I’m not at my desk, then I don’t need all these things powered up.
Of course, with a regular button you can activate these devices also, but now my “bottom presses the button”.
Also, when I walk away from my desk, it’s automatically detected, then my heater goes off, and if I’m after X minutes not returned, everything shuts down automatically.
My solution
So I found the solution with this “hack”. It uses a contact (or leak) sensor connected to a car seat pressure sensor to detect if a chair is occupied, exactly what I needed!
Other purposes for this sensor are:
- In the cat/dog basket
- In the couch/sofa/relax chair
- Under your mattress to detect bed occupancy (only works if there is enough pressure through the mattress)
- Under a mat on the floor (to detect if someone entering a space)
Table of Contents
Automations

With this new sensor, it’s possible to create all kind different automations, like:
-
When the light still needs to be on.
-
Power up all the computer peripherals (monitor, lights, chargers, heater).
-
Shutdown the computer and peripherals automatically when you don’t sit behind your desk for a while.
-
When it’s time to take a break to stand up and stretch your legs.
-
When it’s time to end your working day.
-
Control the room temperature because it’s occupied.
-
Send notifications with incorrect office health state values only when you’re there (CO2, temperature, humidity, PM2.5, VOC, or Formaldehyde).
Required hardware
This project only requires these two devices: A boolean sensor to detect true or false and a pressure sensor.
I have a Zigbee network, so I use a Zigbee contact sensors, but any other protocol sensor can also do the trick.
The first device needs to detect anything or nothing. This can be achieved with two different types of sensors. A water leak sensor or a contact sensor. Both work with a boolean (true of false) state.
1a. Aqara Zigbee water leak sensor (No soldering required)
The Aqara Zigbee leak sensor has two metal screw contacts on the back of the sensor where you can connect direct the two wires of the pressure sensor behind.

1b. Or use any Zigbee Contact sensor (or WiFi version).
Soldering is required if you use this way.
A contact sensor is (mostly) cheaper than the water leak, but it requires soldering.
On this page I describe how it works with this contact sensor.

1c. Or use an alternative (Zigbee/WiFi) leak sensor (No soldering required)
This alternative leak sensor has external contact point, really easy to connect to the two seat sensor wires.
See 3a how to connect the wires from the leak- and pressure sensor with each other.

- A Car seat pressure sensor (smaller or bigger versions are available)



3a. To connect the alternative leak sensor and the pressure sensor, you can use different kinds of clips to avoid soldering.


3b. To connect it to the contact sensor, you need soldering tools:
3c. Or use hot glue. That can also be possible as long as the metals make contact!
Wire them together
With an Aqara water leak sensor
With the Aqara Zigbee water leak sensor, you only need to unscrew the screws, wrap the blank wires from the pressure sensor around it. Screw them tight again and done!!
You can skip the contact sensor description and continue with the Home Assistant section if you use the leak sensor.
With a contact sensor
A contact sensor is a boolean sensor, the circuit can be opened or closed.
That’s also exact what the car seat pressure sensor returns.
The thing that has to be done is connecting the pressure sensor wires to the (reed) contacts of the contact sensor.
First open the contact sensor.

You can remove the reed contact, but you can also leave it like it is. Because there is no magnet nearby, those ends don’t make contact. The sensor is set parallel over this switch.

Drill a hole in the side of the contact sensor so the cables can go inside.

Solder the wires to each side of the (reed) contact.

You can also use two pressure sensors if you want to cover more space with just one sensor.
You connect both sensors together on the same reed contacts ends.

Now you can place the sensor inside a pillow on the chair of inside the chair itself if you can zip the seat open.

When you now sit on it, the state of the contact sensor will change.
Now you can create automations based on it!
Home Assistant
Create a new custom chair sensor
By default, the contact status is inverted as preferred.
With this addition in the configuration.yaml
file, it creates a new sensor that shows the correct status in the dashboard.

# Sourcecode by vdbrink.github.io
# configuration.yaml
binary_sensor:
- platform: template
sensors:
chair:
friendly_name: "chair"
value_template: >-
{% if is_state('binary_sensor.contact1_contact', 'off') %}
on
{% else %}
off
{% endif %}
homeassistant:
customize:
binary_sensor.chair:
icon: mdi:chair-rolling
Occupancy time sensor
With the history stats it’s possible to create new sensors which indicate how long something takes.
In this case we want to track how long the chair is occupied on each day.
The start/reset is on a new day and end time is the current time and within this timeframe how long has entity binary_sensor.chair_work
the state on
.
This is the code to add in the configuration.yaml
.
This will generate a new sensor called sensor.chair_occupancy
.
# Sourcecode by vdbrink.github.io
# configuration.yaml
- platform: history_stats
name: chair occupancy
entity_id: binary_sensor.chair_work
state: 'on'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
Graphs
Now we have the data, it’s possible to present this on the dashboard!
Total time as text
Show the amount of time on the chair as an entity.
8 hours, 12 minutes and 36 seconds.

# Sourcecode by vdbrink.github.io
type: entities
entities:
- entity: sensor.chair_occupancy
Occupied in time as graph
Or show the occupied time in a line graph over time.
It shows exactly where I took some breaks, the line is flat at that time.

A History graph Card is used for this.
# Sourcecode by vdbrink.github.io
type: history-graph
entities:
- entity: sensor.chair_occupancy
logarithmic_scale: false
hours_to_show: 24
title: Office chair
Total time in a bar
Use the same History graph Card with binary sensors, then it’s presented as a bar.
Here I add the chair occupancy sensor next to the value of a pir motion sensor in the same room. As you can see, the chair sensor is much more reliable if you sit still!

# Sourcecode by vdbrink.github.io
type: history-graph
entities:
- entity: binary_sensor.chair_occupancy
- entity: binary_sensor.motion_occupancy
hours_to_show: 24
Is occupied
Indicate if someone is sitting on the chair.

# Sourcecode by vdbrink.github.io
type: entities
entities:
- entity: binary_sensor.chair_occupancy
That’s it, a very useful and reliable DIY chair occupancy sensor (for me at least!).
<< See also my other Zigbee related content
Top | Homepage | Best Buy Tips | Shirts, mugs, stickers with IT quotes