This is a follow up topic to my MQTT post here...
https://forums.homeseer.com/forum/hs...-mini-d1-esp32
Use weight sensors under your mattress to determine if people are in bed. I have one on my wife's side and one of my side.
I am using this to set my alarm and turn off all the lights after both my wife and I are in bed for 5 min. My house alarm is based on motion and open/close sensors. If I go downstairs for a snack or something in the middle of the night, I can forget to reset the alarm after. This now prevents that
Steps
1. Follow my previous post to create the ESP32 (or ESP8266) tasmota weight sensors. Using your preferred MQTT broker
2. Create 2 virtual devices in HS4
3. Create the node red flow...

4. Create an event in HS4
https://forums.homeseer.com/forum/hs...-mini-d1-esp32
Use weight sensors under your mattress to determine if people are in bed. I have one on my wife's side and one of my side.
I am using this to set my alarm and turn off all the lights after both my wife and I are in bed for 5 min. My house alarm is based on motion and open/close sensors. If I go downstairs for a snack or something in the middle of the night, I can forget to reset the alarm after. This now prevents that
Steps
1. Follow my previous post to create the ESP32 (or ESP8266) tasmota weight sensors. Using your preferred MQTT broker
2. Create 2 virtual devices in HS4
3. Create the node red flow...
Code:
[{"id":"4b5a5a36.3e60d4","type":"mqtt in","z":"3bbf546c.9462dc","name":"","topic":"tele/BedSensorOne/SENSOR","qos":"2","datatype":"json","broker":"","x":160,"y":160,"wires":[["df2d0ea9.4b53b"]]},{"id":"8708b838.213c08","type":"mqtt in","z":"3bbf546c.9462dc","name":"","topic":"stat/BedSensorOne/STATUS8","qos":"2","datatype":"json","broker":"","x":160,"y":220,"wires":[["d97d8ac6.1002b8"]]},{"id":"e3952e5f.abbf7","type":"change","z":"3bbf546c.9462dc","name":"Turn ON","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"value\":100}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":120,"wires":[["ef1c12b5.30b49"]]},{"id":"56068e65.e04e6","type":"change","z":"3bbf546c.9462dc","name":"Turn OFF","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"value\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":240,"wires":[["ef1c12b5.30b49"]]},{"id":"ef1c12b5.30b49","type":"hs-device","z":"3bbf546c.9462dc","name":"PersonOneSleeping","device":0,"server":"","feature":0,"reportonstartup":false,"x":1000,"y":180,"wires":[[]]},{"id":"64a419bc.190f98","type":"config","z":"3bbf546c.9462dc","name":"","properties":[{"p":"BaseRawWeightOne","pt":"flow","to":"150","tot":"num"},{"p":"BaseRawWeightTwo","pt":"flow","to":"200","tot":"num"}],"active":true,"x":110,"y":100,"wires":[]},{"id":"df2d0ea9.4b53b","type":"function","z":"3bbf546c.9462dc","name":"getLatestWeightOneA","func":"var aWeight = msg.payload.HX711.WeightRaw-flow.get(\"BaseRawWeightOne\");\nmsg.payload = aWeight;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":160,"wires":[["10258f8d.ec7c5"]]},{"id":"d97d8ac6.1002b8","type":"function","z":"3bbf546c.9462dc","name":"getLatestWeightOneB","func":"var aWeight = msg.payload.StatusSNS.HX711.WeightRaw-flow.get(\"BaseRawWeightOne\");\nmsg.payload = aWeight;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":220,"wires":[["10258f8d.ec7c5"]]},{"id":"6bd1aadb.9689a4","type":"inject","z":"3bbf546c.9462dc","name":"on","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":590,"y":120,"wires":[["e3952e5f.abbf7"]]},{"id":"34e8750d.53303a","type":"inject","z":"3bbf546c.9462dc","name":"off","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":590,"y":240,"wires":[["56068e65.e04e6"]]},{"id":"1e618e83.929bf1","type":"mqtt in","z":"3bbf546c.9462dc","name":"","topic":"tele/BedSensorTwo/SENSOR","qos":"2","datatype":"json","broker":"","x":160,"y":360,"wires":[["77212924.0d4338"]]},{"id":"43dcded3.66835","type":"mqtt in","z":"3bbf546c.9462dc","name":"","topic":"stat/BedSensorTwo/STATUS8","qos":"2","datatype":"json","broker":"","x":160,"y":420,"wires":[["2c977a7d.2523e6"]]},{"id":"58608c0c.638494","type":"switch","z":"3bbf546c.9462dc","name":"Is weight more than 50kg?","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"50000","vt":"num"},{"t":"lt","v":"50000","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":400,"wires":[["325b4854.9bd338"],["837defd3.08bf4"]]},{"id":"325b4854.9bd338","type":"change","z":"3bbf546c.9462dc","name":"Turn ON","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"value\":100}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":340,"wires":[["659e87aa.0b52a8"]]},{"id":"837defd3.08bf4","type":"change","z":"3bbf546c.9462dc","name":"Turn OFF","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"value\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":460,"wires":[["659e87aa.0b52a8"]]},{"id":"659e87aa.0b52a8","type":"hs-device","z":"3bbf546c.9462dc","name":"PersonTwoSleeping","device":0,"server":"","feature":0,"reportonstartup":false,"x":1000,"y":400,"wires":[[]]},{"id":"77212924.0d4338","type":"function","z":"3bbf546c.9462dc","name":"getLatestWeightTwoA","func":"var aWeight = msg.payload.HX711.WeightRaw-flow.get(\"BaseRawWeightTwo\");\nmsg.payload = aWeight;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":360,"wires":[["58608c0c.638494"]]},{"id":"2c977a7d.2523e6","type":"function","z":"3bbf546c.9462dc","name":"getLatestWeightTwoB","func":"var aWeight = msg.payload.StatusSNS.HX711.WeightRaw-flow.get(\"BaseRawWeightTwo\");\nmsg.payload = aWeight;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":420,"wires":[["58608c0c.638494"]]},{"id":"806a1db8.385c5","type":"inject","z":"3bbf546c.9462dc","name":"on","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":610,"y":340,"wires":[["325b4854.9bd338"]]},{"id":"5631a9f6.42ff18","type":"inject","z":"3bbf546c.9462dc","name":"off","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":610,"y":460,"wires":[["837defd3.08bf4"]]},{"id":"10258f8d.ec7c5","type":"switch","z":"3bbf546c.9462dc","name":"Is weight more than 50kg?","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"50000","vt":"num"},{"t":"lt","v":"50000","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":180,"wires":[["e3952e5f.abbf7"],["56068e65.e04e6"]]}]
4. Create an event in HS4
PersonOneSleeping has been On for exactly 5m, 0s
and
PersonTwoSleeping and has been On for at least 5m, 0s
or
PersonTwoSleeping has been On for exactly 5m, 0s
and
PersonOneSleeping and has been On for at least 5m, 0s
then
...your event task
(you could also do the event stuff all in Node-RED)
and
PersonTwoSleeping and has been On for at least 5m, 0s
or
PersonTwoSleeping has been On for exactly 5m, 0s
and
PersonOneSleeping and has been On for at least 5m, 0s
then
...your event task
(you could also do the event stuff all in Node-RED)