Hello,
I have a rasp pi 3b+ (I think that’s the model). It’s a simple device, acting simply
I used pi-mqtt-gpio (under flyte in GitHub) to map a boolean sensor and a switch attached to a relay and that’s it. From Hassio, I mapped the mqtt of the device into a sensor and a switch…
Backtracking here, I am deaf. The sensor is a pressure sensing pad to sit between my mattress and box spring to tell if I am laying in bed or not and the relay is between a wall-wart AC->DC transformer and a vibrating puck that I stick between my mattress and box spring and it vibrates the bed to wake me up. The puck is common for deaf peoples alarm clocks.
So what I would like to do is I would like to activate the puck, via the mqtt to the gpio to the relay, from home assistant, only while I am in bed. I want to activate the puck if I am laying in bed when the binary sensor registers connected. If I get out of bed and the binary sensor says so then I want to stop the relay to the puck. If the vibration is still turned on to the puck and I get back in bed, which would activate the sensor, I want hassio to re-activate the puck. If I am not in bed then I want hassio to know that the puck is activated and if I get into bed, activating the sensor, then I want hassio to detect I got into bed and activate the vibrating puck.
Right now, from hassio, I can determine (from the sensor) if I am laying in bed. From hassio, I can switch the vibrating puck on and off. I want to create an event that, during the window of that event (which will typically be one hour), it will activate the vibrating puck only when it detects that I am laying in bed, from the sensor. I want this to happen if I get out of bed and get back into bed. I want it to happen if I get into bed after it’s activated but if I am not in bed when it’s activated then I don’t expect it to do anything, nor do I expect it to ever activate the puck when it knows I am not in bed.
P.S. Here’s a youtube video demonstrating the vibrating puck (which works really well to wake you up) https://www.youtube.com/watch?v=93RvM7NnpJU&ab_channel=lopeylopey1
P.P.S. I am working towards integrating a google calendar controlled alarm clock into hassio that only triggers when I am in bed and if I get out of bed and back into bed (because I can be lazy at times) that it will reactivate during the duration of the calendar event.
Looking forward to any and all responses and advice
P.P.P.S. Here is the fall sensor. The pad is connected via a RJ11 and it’s simple a switch based on pressure. It shorts the ring and tone pins on pressure and the “controller” unit it comes with isn’t used so it’s really just a pressure pad switch with a RJ11 connector (for those whom were curious): https://www.amazon.ca/Pressure-Sensitive-Chair-Patient-Alarm/dp/B002VWJZD8/ref=sr_1_268?keywords=drive+medical&qid=1550279045&s=gateway&sr=8-268