Unhappy would sound to harsh, I love this project! It works great for me, the data that is collected is accurat (in my case) and reliable. At least as long as you check the threshold every few weeks/months.
The sensor itself works like a charme, it sends data since I installed it - no errors or things like that.
But the amount of data, the frequency for each sensor if you will, is huge. I get two to three values per sensor per second. That amounts to twelve values every second for one bed. I’m quite sure there would be ways to control that via esphome, but I didn’t had the time or muse to take a look at it.
Right now it doesn’t disturb anything, so I’m not to bothered, but in the future I need to resolve this, it’s simply not nice. My idea would be to hide the real sensors for HA and only send the lamda value every 30 seconds to HA. That should bring some relief.
Yes, exactly. I have three mats. If I run any one of them (by commenting out the others), it is stable and works perfectly. However, if I run any two of them, every sensor on the chip becomes unavailable most of the time. I can vary how bad the problem is by changing settings for
esp32_touch:
# Delete this after you are done with the setup process
# setup_mode: true
iir_filter: 10ms
sleep_duration: 400ms
or
- platform: esp32_touch
name: "Master Bed Top Right"
pin: GPIO27
threshold: 40
filters:
- delayed_off: 1000ms
id: top_right
But it is always unstable. If I run all three there is nothing but errors. I notice in your yaml script that you are using a different module. IN particular, you are using the ESP32-S2 chip, whereas I am using ESP32. I wonder if/why that would make a difference.
I’d suggest you start minimal. No delays or filters, just the basics and see how far that goes.
What I’d check as well are the used GPIOs. Are they really able to work with the touch input (as this is what we use here)? With my board eg GPIO27 is touch, GPIO26 is not.
And is your ground correct? I wired all four sensors together to have one good ground.
Yeah, I began simple, and used the right pins, supposedly (27,32,33). In fact, this is confirmed by the fact that each one works individually. I tried without delays and filters, etc, but it always fails. Changing things systematically is what has led me to suspect that it is the chip. I wanted to use a chip that also has bluetooth to detect presence, but that might not be possible.
That is going to depend on what spacer you use. The open-celled foams will have a very long relaxation time that makes them problematic. A good closed-cell foam shouldn’t have this problem, but my other issue is preventing me from checking that right now.
As the entry in this thread shows, I had installed this sensors at the end of June 2020. Since then I had to adjust the values once. I’d speculate it depends on the temperature. The change in values was just around the time where we fell under 10°C to 15°C outside temperature.
And I changed the bed frame in the meantime (without needing to adjust the sensors), so I’d say it is not very often. What I do, but I guess that’s my inner “Monk”, I check the sensors every few weeks as a “preventative maintenance”.
Indeed! That looks just like my problem, but you are also using the ESP32-S2 chip. So how is @paddy0174 getting his to work ?? You also are using the iir filter. I thought that had checked that, but let me double check…it is the filter. I turned off ‘iir_filter’ and it is more stable. @paddy0174 was right! I can leave the ‘sleep_duration’ setting, which might help with the spamming problem.
I know that this post is focused on parts you have. However, I think that it might be useful to some people to know other options as well. I used the following sensor:
You just need to connect it to a pin and ground and set it up as a binary sensor on esphome. It works great.
Unfortunately, that one says “No longer available”. I saw something similar for a bed on Amazon for like $25, but aside from being much more expensive than this one, it seemed binary, so wasn’t sure if it would always work. Does it just act like a contact switch? How do you know that the weight of your mattress won’t set it off. Seems like this one is similar:
Yes, that’s exactly what I bought. Yes, basically it’s a contact switch. It is sensitive and activates with little weight/pressure. It worked very well for me, I installed two on a the support of a queen bed, one for each side of the bed. The weight of the mattress does not trigger it even though it’s a 10-inch memory-foam mattress . I guess that might depend on how the mattress is sitting on the supporting platform. As soon as me or my wife get on the bed, only the correct side/sensor gets triggered. I didn’t play with it very long before installing it, but it seems that several of the pressure points need to make contact. I ordered more to install it on my office chair to use it as presence and automate my standing desk and other devices. I will preform more tests when I do that.
Thanks for the link to the “not so binary” automation. I adapted it to my sensor. Eventually, I would like to program all of this on the ESP module. Here is what I have (for @Dorko) in automations.yaml:
# MasterBed status
- alias: Mark masterbed as Just Occupied
trigger:
- platform: state
entity_id: binary_sensor.master_bed_sensor
from: "off"
to: "on"
action:
- service: input_select.select_option
data:
entity_id: input_select.masterbed_status_dropdown
option: Just Occupied
- alias: Mark masterbed as Occupied
trigger:
- platform: state
entity_id: input_select.masterbed_status_dropdown
to: "Just Occupied"
for:
minutes: 2
- platform: state
entity_id: input_select.masterbed_status_dropdown
from: "Just Left"
to: "Just Occupied"
# condition:
action:
- service: input_select.select_option
data:
entity_id: input_select.masterbed_status_dropdown
option: Occupied
- alias: Mark masterbed as Just Left
trigger:
- platform: state
entity_id: binary_sensor.master_bed_sensor
from: "on"
to: "off"
action:
- service: input_select.select_option
data:
entity_id: input_select.masterbed_status_dropdown
option: Just Left
- alias: Mark masterbed as Empty
trigger:
- platform: state
entity_id: input_select.masterbed_status_dropdown
to: "Just Left"
for:
minutes: 2
action:
- service: input_select.select_option
data:
entity_id: input_select.masterbed_status_dropdown
option: Empty
- alias: Mark masterbed as Extended Empty
trigger:
- platform: state
entity_id: input_select.masterbed_status_dropdown
to: "Empty"
for:
hours: 24
action:
- service: input_select.select_option
data_template:
entity_id: input_select.masterbed_status_dropdown
option: Extended Empty
And what is in configuration.yaml:
input_select:
masterbed_status_dropdown:
name: Masterbed
options:
- Occupied
- Just Occupied
- Just Left
- Empty
- Extended Empty
initial: Empty
And, finally, the button on put on Lovelace to indicate the current state. It is color-coded with the state, and the icon changes when occupied. If the bed is just left, empty or extended empty, the background is white. If it is Occupied or Just Occupied, the background is blue. The text color changes with status, too: