Laundry Accelerometer

I’m just getting into HA and have some configs setup based on smart plugs for washing machine and dishwashers being done based on template binary sensors with delay_on/off.

There is not enough space behind the tumble dryer to add a power meter (and it’s a nightmare to get out). So I have attached a SmartThings Multi-Sensor which records vibration and I wonder if there’s a way I can create a template sensor to be ‘on’ if vibration detected more than 5 times in the last 5 minutes, and off if vibration detected less than 5 times in the last 5 minutes.

Is this possible???

Thanks

If you have SmartThings integrated in HA and you are getting the sensor metrics, the answer is yes.

Thanks. Sorry I should have been more specific… How (i.e. what configuration/code) should be added to make this possible, for example here’s what I have for the dishwasher:

  • platform: template
    sensors:
    dishwasher:
    friendly_name: Dishwasher
    delay_off:
    minutes: 1
    delay_on:
    seconds: 30
    value_template: >-
    {{ state_attr(‘switch.dishwasher’, ‘current_power_w’) | float(0) > 0 }}

what I want is the value template to look at the state of: binary_sensor.tumble_dryer_acceleration and set the binary sensor to ‘on’ if the ‘on’ state of the dryer occurred >5 times in the last 5 minutes, and off if it has been <5 times in the last 5 minutes.

try this Issues with Xiaomi Vibration Sensor
and
Xiaomi Vibration Sensor Use Cases
and
Washing Machine Monitor using Xiaomi Vibration sensor

Thanks. I don;t know why I didn’t come across those when I was searching… possibly as I was looking for laundry/tumble dryer. I’ll try using those examples and tailor for my needs.

Good luck!

in my case, it seems even with the xiaomi sensor set to ‘high sensitivity’, it doesn’t pick up the washing machine doing anything so I’m going with a power sensor, and may use the accelerator to detect a door opening (via the accelerator itself, rather than vibration)

So I have sort of configured this myself using Node Red.

When the accelerometer detects vibration it goes to a switch which sends the ‘on’ to a timed counter, this counts the number of ‘on’ messages received in the space of 5-minutes. I have it set that if in 5 minutes the count reaches ‘5’ it should pass the 'on; message through. This action notifies me the tumble dryer is on and send the ‘open’ command to a gate.

This gate sits behind the ‘off’ messages and its purpose is to block messages coming through until it is open - this avoids accidental knocks etc and ensures that the tumble dryer is really on (unless of course there have been at least 5 knocks in 5 minutes - which isn’t likely).

Once open the gate accepts the ‘off’ messages from the accelerometer passing these through to a trigger which once activated sends nothing, then waits for more messages, each message received resets the 5-minute counter. If after 5-minutes no message has been received it sends the command to the notify services to let me know the tumble dryer has finished as well as sending a close command back to the gate.

I’ve only been playing in Node Red for about a week and I’m not a programmer/developer, so there is probably a lot of tidying up and maybe unnecessary stuff in there… but it’s a start and it seems to work - so I’m pretty chuffed.

Here’s the exported code if anyone wants to look and let me know if it can be tidied up/improved

[{"id":"3757d75b.0db258","type":"tab","label":"Utilities","disabled":false,"info":""},{"id":"d9077c26.fb79d","type":"server-state-changed","z":"3757d75b.0db258","name":"Tumble Dryer Vibration","server":"219f1ce9.e85a94","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.tumble_dryer_acceleration","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":100,"y":120,"wires":[["4b7392b8.4c337c"]]},{"id":"4b7392b8.4c337c","type":"switch","z":"3757d75b.0db258","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":100,"wires":[["c4679519.3d87e8"],["2df3799b.2d8c76"]]},{"id":"cce0a8bd.5b3d58","type":"api-call-service","z":"3757d75b.0db258","name":"Notify me","server":"219f1ce9.e85a94","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_sm_g988b","entityId":"","data":"{\"message\":\"Tumble Dryer Finished\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":800,"y":180,"wires":[["66dd2c83.809934"]]},{"id":"c4679519.3d87e8","type":"timed-counter","z":"3757d75b.0db258","name":"","timelimit":"5","timeunit":"60000","withhold":false,"fixedtimeout":false,"pertopic":false,"x":480,"y":60,"wires":[["3b9d9ff0.60e8b"]]},{"id":"8342ff3.5f4e3","type":"api-call-service","z":"3757d75b.0db258","name":"Notify me","server":"219f1ce9.e85a94","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_sm_g988b","entityId":"","data":"{\"message\":\"Tumble Dryer Started\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":840,"y":60,"wires":[[]]},{"id":"3b9d9ff0.60e8b","type":"switch","z":"3757d75b.0db258","name":"","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"5","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":650,"y":60,"wires":[["8342ff3.5f4e3","a5dfdfa.d14fc2"]]},{"id":"db4329d1.f9bcf8","type":"trigger","z":"3757d75b.0db258","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"5","extend":true,"units":"min","reset":"","bytopic":"all","name":"","x":630,"y":160,"wires":[["cce0a8bd.5b3d58","2fcbe227.4b39ae"]]},{"id":"2df3799b.2d8c76","type":"gate","z":"3757d75b.0db258","name":"","controlTopic":"control","defaultState":"closed","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":450,"y":160,"wires":[["db4329d1.f9bcf8"]]},{"id":"a5dfdfa.d14fc2","type":"change","z":"3757d75b.0db258","name":"Open Gate","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":110,"wires":[["2df3799b.2d8c76"]]},{"id":"66dd2c83.809934","type":"change","z":"3757d75b.0db258","name":"Close Gate","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":260,"wires":[["2df3799b.2d8c76"]]},{"id":"2fcbe227.4b39ae","type":"api-call-service","z":"3757d75b.0db258","name":"","server":"219f1ce9.e85a94","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_kitchen","entityId":"","data":"{\"message\":\"Tumble dryer has finished\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":870,"y":120,"wires":[[]]},{"id":"219f1ce9.e85a94","type":"server","z":"","name":"Home Assistant","addon":true}]

1 Like