Bed Occupancy Sensor Help
So i am trying to create the same bed occupancy sensor as seen here, https://github.com/eoncire/HA_bed_presence
My problem is it seems to be kind of working except the voltage always starts at 3.9v and decreases as pressure is applied to the sensors. Not too sure what i might have wrong. Looking for some input. it correctly turns on/off the home assistant sensors it is just backwards. I could probably just use it backwards as is and reverse everything but for my sanity would like it to be correct.
Image to current wiring. I then feed the wires from the strips to the terminals, just currently have them disconnected. One "red" wire to each of the top 2 terminals, then their "black" wires share the 3rd terminal. https://i.imgur.com/WztcG6W.jpg
Have tried multiple different resistors inline but that doesn't seem to be the issue, i get the same results.
ESPHome YAML:
esphome:
name: bed_sensor_2
platform: ESP32
board: nodemcu-32s
# Change this to your Wi-Fi config
wifi:
ssid: "MySSID"
password: "MyPassword"
ap:
ssid: “Bed Sensor Fallback Hotspot”
# Set a password in case Wi-Fi fails
password: "fallback_password"
# Fallback portal
captive_portal:
# Logging
logger:
# Uncomment this if you use Home Assistant
api:
# Over-The-Air updates
ota:
# Setting up the pressure mats
sensor:
- platform: adc
pin: GPIO34
name: "Pressure 1"
update_interval: 5s
attenuation: 11db
on_value_range:
- above: 0.5
then:
- homeassistant.service:
service: input_boolean.turn_on
data:
entity_id: input_boolean.pressure1
- logger.log: Pressure1 On
- below: 0.49999
then:
- homeassistant.service:
service: input_boolean.turn_off
data:
entity_id: input_boolean.pressure1
- logger.log: Pressure1 Off
- platform: adc
pin: GPIO35
name: "Pressure 2"
update_interval: 5s
attenuation: 11db
on_value_range:
- above: 0.5
then:
- homeassistant.service:
service: input_boolean.turn_on
data:
entity_id: input_boolean.pressure2
- logger.log: Pressure2 On
- below: 0.49999
then:
- homeassistant.service:
service: input_boolean.turn_off
data:
entity_id: input_boolean.pressure2
- logger.log: Pressure2 Off
Posted Jun 16, 2021, 7:59 PM UTC
The voltage is gonna decrease. You can't change. Just change the above : 0.5 to a below :. 5 and it should work.
Hm. I'm fine with that being the case. In the videos posted there they have it going up when pressure was applied and just based on the example code so figured I was doing something wrong. But it is what it is, I will adjust the code. Thanks.