Project - Pressure Strips For Master Bedroom via MQTT & Node-RED

Impressive project! I’m so lazy. I just use a couple of Withings sleep pads which nowadays work great on Hubitat. They used to time out all the time… I’m in Thailand behind the Great Silk Curtain, which often meant the response from my hub didn’t get back to the Withings server within the requisite 2 seconds. I think Withings made it less picky because it works almost flawlessly now. Much easier, but a bit pricey.

For motion sensing in the bedroom, I’ve put all my motion sensors at floor level. This has worked out great. It means the dim lights come on immediately a leg is dropped over the side of the bed, without having to wait for the Withings integration to check/respond (since it’s a Cloud integration it’s not instantaneous). But I can still use the sleep pads to turn lights off, arm/disarm the alarm, determine which lights to put on etc. Rules are in Node Red because I’m so sick of the continuous tinkering with Rule Machine, lack of backward compatibility which means the rules have to be entirely rewritten yet again if you want to take advantage of the new functionality, and endless bugs. It’s enough.

Very happy with my sleep pad setup now.

3 Likes

Everything has bee stable for a week now with the sensors. I did have to modify it yesterday to account for an uneven area in the bed. If you’re thinking of swapping, mine have been solid.

for zigbee i’m using
node-red-contrib-zigbee2mqtt
For Z-Wave I’m using the built-in mqtt node
The blue is magic home nodes.
node-red-contrib-magichome

Push stuff for our logging into grafana.

1 Like

Do you have modes per room or is this a global house mode? I have been wanting to implement a per room mode, but it seems like a ton of work to keep everything straight, especially if you are using NR context variables.

1 Like

My dev environment does things differently with the logic engine. But we’ve tried to keep the same mode concept as everyone is used to.

I use a global mode set. Realistically, there are only a few things that need to be responsive to certain modes. So doing a per room mode would be a lot of work. I use Home, Away, Quiet, and Night. Quiet and night are the most important for lighting and I use those modes to cover the bedrooms. So quiet for kids means that lights wouldn’t interact in those places, but you may receive a pushover notification or a change in light color if someone wanders out of their room because they “can’t sleep”.
For us, quiet means that the kitchen lights can’t go to full brightness and also means the unoccupied side of the bed will light on motion, but the bedroom lights will not come on in full brightness in respect to the sleeping other half. In home mode, everything interacts as there shouldn’t be anyone sleeping or resting. But, should one of us decide on an afternoon nappie, then quiet would be triggered just by being on the bed. It’s a nice feature.
Really, by doing it this way, you think - what do I want to happen if we’re away? What happens when quiet mode hits (someone sleeping). What do I want to happen with lights when we’re in bed in night mode. Then set your interactions accordingly. It’s really just a state. I have night mode trigger tv’s to turn off if they’re on through harmony.
Also, I do have to say that not everything reacts according to mode. Our basement lights and tv aren’t affected at all. If I do down there in the night, they will work the same no matter what time it is. Lighting is determined first, by motion, but mainly by harmony in the living room. If I’m in my office the lights in the living room will stay on as long as I’m in there, but if the tv is on per harmony, then the lights will not turn off until after the tv does and motion is quiet.
The easiest way for me to explain what I do for modes is something that I want to react in a certain way when the criteria fits of of the four modes all the time. Otherwise there’s not a need to attach it to mode. If the lights remain off when I’m not in a room, then the goal is met.

Here is my mode flow

Also, here is presence in node red

2 Likes

Very interesting, yeah the only reason I thought of doing per room modes is that I do not like changing global modes based on anything but presence (for away) and times for the rest as it does not lend itself to multiple groups populating the same house, i.e. a family dynamic. For instance, if the parents went to bed, you wouldn’t want the global mode to be night if the kids are still up and playing or working on homework. Time based mode changes seem to be the only way for global modes to work consistently in most situations. That honestly has been the toughest nut to crack with HA for me, making automations work for more than just a single repeatable schedule.

1 Like

I agree. Perhaps I can offer some insight on ways around that situation. I used qi chargers for my phones and fashioned smart qi chargers to accommodate that very same situation. Something natural that could happen when that situation arises for the room. then modes could still be in commonplace, but rooms would act accordingly. Like our kitchen lights blaze into our bedroom. That being said, when one of us is in bed, we still need lights to interact if one of us is up, but not at top level. Hence quiet mode. If you integrated a smart charger, a tasker rule or perhaps some type of pressure sensor or something specific to that room. Could do a round pressure sensor that the qi charger sits on for a trigger or the phone itself. Just a few solutions. I have a project listed here smart qi charger if you search it.

[Project] Homemade Smart Qi Charger - Automation Central / Automation Hardware - Oh-La LABS Community

I try to avoid time based rules because I really try to tell myself that I’m not a creature of habit, but we all know that you could very easily call BS on that one. I’m not good at sleeping through the night and get up at various times to walk around, so I try to be creative with these things so that I’m not waking the hubs every hour when I make my random rounds through the house.

I’d be happy to try to suggest some possible solutions if you share your use cases.

1 Like

I don’t really have any pains points right now outside of bedroom lighting, which I recently improved by getting contact sensors on the door which along with the motion sensors determine the occupancy of the room and turn it into manual or automatic “mode”. This could be improved further by a pressure sensor under the bed, but for now I just say goodnight to Alexa and it disables motion sensing for the room and contact sensing on the door, then the good morning command re-enables the contact sensor. And when the contact sensor opens, the motion sensor is enabled, thus turning the lights on if there is motion. Side-note, I probably could just re-enable both, but ambient light during the morning is plenty and this has the benefit of not blinding people immediately when they wake up.

The pressure sensors would take place of the alexa commands in the flow. Also instead of turning off motion sensing, I could also do a “quiet mode” where the lights are just dim as a sort of night light.

1 Like

Been messing with a doppler board lately too. You might be interested in that, maybe?

HiLetgo 5pcs RCWL-0516 RCWL 0516 Microwave Radar Sensor Human Sensor Body Sensor Module Induction Switch Module Output 3.3V: Amazon.com: Industrial & Scientific

Might be on the project list. I can think up all kinds of cool uses for it, but they are hard to point. From what I read, you can achieve this with a bit of tin foil. I’ve not tackled this yet, BUT I have one of these on my desk. I considered ultrasonic sensors, but I worry that my dog may be bothered by the frequency. It’s not quite to their hearing range, but close enough to wonder if she could hear it.
THIS could be the answer that you’re looking for. Hiding it in the right spot.

1 Like

That is very cool, I assume since it is using radar tech, it will actually be able to detect the occupancy of the room versus just motion detection of PIR which would be great. But at the same time, I wonder how well it would work as a battery powered device since I assume it is basically always on sending out waves and getting a response which sounds terrible for battery life.

Ultrasonic sensors are great, IIRC that is what most cars use for parking assistance and even autonomous parking, but all of the ones I know of are super short range, like in the 1 meter at most range which doesn’t seem like it would have a lot of applications for HA.

FYI, Amazon recently came out with a new voice for Alexa (I think called Ziggy?) that is a male variant, and it is actually pretty decent. I wonder if your dog would have the same reaction to that.

Actually the doppler has a decent range. We looked at it, but I forget what it was.

Well she is scared of google as well, but i’ll check it out. I wouldn’t mind a different voice.

Yeah I think I read that it was 5-9 meters depending on the resistor you choose to solder on the board.

1 Like

Not sure if you and markus got the same ones I’ve been using, or how you guys wired yours up, but i get about 5m on 3.3v and 9m on 5v :wink:

Yes and no… if paired with a servo motor you can create an radar style display and readout determining how far away objects are and if they are moving etc but on their own they are best for distance sensing.

I use them for automatic doorbells, package detection, and i have stuck them in my cars bumpers which alert me if i get closer than 3 inches to anything, which is really handy for parking in tight spaces.

1 Like

Ok so now this accounts for one person in bed rolling to the other side and not triggering presence for a second person. This got a mad kind of crazy.

Not sure if you’ve discussed this option, but would some kind of Bluetooth detection for smart watches be an option for additional presence detection? I’ve grappled with trying to detect my tile device without any success, so not sure if it would work any better with a watch or other Bluetooth device…

We’ve been messing with BLE as well. It’s not as interesting. connected it to my fitbit through mqtt. It wasn’t all that great and I felt that it fell a little short, actually. I have the flows and the board information if you want it. I’d have to find the other stuff. @jchurch and I worked on it together.

1 Like

I’m struggling just to work out the mac address of the tile, so haven’t even got to any automations at this stage. It shouldn’t be that hard, but thought maybe other devices or other software may have yielded a better result and could have helped in your situation. Shame…

Reach out to @jchurch . He’ll have some insight for you. It works. There was an issue, but I can’t remember exactly what that was, but we haven’t had time to work it out yet.

1 Like

Also an issue with BLE is that is it relatively long range, and I feel like it would have issue determining which exact room you are in, unless you had multiple receivers and compared their signal integrity, but that is a whole other ball game. Now if all you are trying to do is general presence for geofencing, then that might be great, especially if you want more granular control than WiFi phone detection. Here is a post to a thread I have been following but never got around to implementing:

1 Like

@sburke781 yeah I have configured BLE using Wemos D1 mini ESP32 and it worked. As to resolve the issue @Cjkeenan mentions you can tune it to only do something with things that are close by and ignore the rest but as he mentions you’d need them in each space.

Anyways I had it running using OMG here but word of warning when I ran this I started experiencing dropouts from some of my Zigbee devices I pulled it out and it immediately went away. It was weird though just some sensitive devices like my Schlage doorlock and Samsung button the Xiaomi Aqara’s didn’t care at all. Anyways good luck it’s a fun project.

2 Likes

Hi @april.brandt

You have sent me down a rabbit hole with this one :slight_smile: but as mentioned I tried the load cell method and been unhappy with its consistency. So I’m giving this a go! Your instructions have been excellent so was able to knock up a POC quitely quickly once the pressure sensors arrived in the post.

I have everything hooked up for testing but wanted to understand what outputs you get in your Analog readings. When not loaded I’m seeing fluctuating values between 1300 - 2400:
image

When under load, I see the value max out at 4095:

image

I have a resistor as per your diagram but wondering what you found once under the mattress as I have tested this to just registers 4095 without showing changes. It does sometimes dip slightly but overall it behaves as if it is under full load.

Any suggestions or did you find the same? I had a look at the ADCParam commands but they dont seem to be used to calibrate a std analog input…