Some time ago I got a Withings sleep sensor. Not cheap. I am not really sure it helps me understand my sleep well. It does a lot - tracks sleep, types of sleep, snoring, sleep apnea, heart rate. Clever bugger.
However, it does not allow you to use it without consenting to your data being used for other things, which, seems to me, to be a clear breach of GDPR. Obviously I reported it, and ICO were obviously inept, though they got as far as referring to EU, and then Brexit happened, so no idea where the case is now. I think it has fallen down the cracks and Withings just ignore GDPR, it seems.
Apart from some interest in what it says about my sleeping, my main use for this is reporting to my home automation when I go to bed and when I get up. I then link this to various things from simple lights, to air-con, directing the vents for lossnay (fresh air), illumination settings on environmental sensors, and so on. I rather like that lying down turns off the lights, and that getting up in the night turns on one light on a mirror in the en-suite bathroom. If I get up in the morning for 5 minutes it turns on the rest of the lights, and my office air-con, and so on. The possibilities are endless and there are people that are way more in to this than I am.
The problem is that the way this works is convoluted!
- Sensor detects in/out of bed.
- Sends to Withings which is in France I think
- That is linked IFTTT - no idea where that is
- IFTTT does a get on my server in my loft
- My server pokes MQTT for various things to happen
It can take a few seconds to a few minutes, or not at all if any servers or internet access is not working.
The solution
Recently I realised that a simple bed sensor mat is something one can buy cheaply. I mean I realise now that obviously such things must exist, but it had not occurred to me before.
I got one of them - a larger one for a bed (amazon, or cheaper direct). They also sell smaller ones. They could be used on a bed, a wheel chair, even under a door mat. They are sold for healthcare to track someone getting out of bed, or falling out of wheelchair, etc.
I was surprised to find it copes with my thick memory foam mattress, and slats. The Withings one has a pump to pump it up with air to adjust for weight of things like a mattress, but it is doing more than just detecting I am on the bed (e.g. heart rate, etc).
Withings (top, grey) and new sensor (bottom, white) |
The trick is what they connect to - alarm devices are sold to work with them. I decided to give it a try, and found it was actually easy to make this work with my home automation. The trick was to use a Shelly Plus i4 DC (here). The reason for the DC model is that I don't want mains under my bed really, and the switch inputs on most Shelly are mains. They do an isolator which has digital and analogue inputs which would allow a Shelly Plus 1 to be used, but the DC i4 is easier. The other feature is it can work from 5V to 24V, and so can be powered from a USB socket. I got a USB lead (amazon).
Too many USB devices already! |
The wiring was simple - the sensor appears to be a simple passive sensor. The 4 wires are actually two wires connected and two wires connected, so only effectively two wires, between which is open circuit when no pressure. When pressure applied they go to around 2kΩ, but I suspect it changes with the level of pressure. Thankfully it is low enough to trigger the input on the Shelly Plus i4 DC.
The sensor operates like a switch input, and so can be linked in to any home automation that can work with a Shelly. There is HomeKit stuff for that, but I re-flash with tasmota personally. Obviously this could work up to 4 such sensors, ideal for his/her side of bed, or floor mats as well, etc.
The nice thing is that it is instant in reacting, though obviously I can add a delay if I want. The important thing is it is not a random 10 seconds or several minutes delay as before.
No comments:
Post a Comment
Comments are moderated purely to filter out obvious spam, but it means they may not show immediately.