HASSOS, Node Red, SmartThings Multipurpose Sensor for garage door

Hey all,

Fairly new to HA. I’m running HASSOS on a RP4 and am doing all my automations in Node Red. I have a SmartThings multipurpose sensor that I want to use to create a state for my garage overhead door. Closed or open, based on the accelerometer z-axis. I’ve used the Events in Developer Tools to view the changes in the axes, but am not sure the best way to implement in Node Red. My first thought is a state change, but with the device being as sensitive as it is, I assume this isn’t the best idea. Has anyone done this in Node Red?

I had a similar set-up for a while but the sensor quit working. I used a switch node after the change state node. A value < 50 = closed, value > 50 but < 800 = partially open, value > 800 = open.

After the sensor quit, I changed to a contact sensor on a hinge. One leaf of the hinge is attached to the door. The other leaf has the sensor. The magnet is attached to the door. When the door is opened, the leaf with the sensor swings away from the magnet showing the door open. A much simpler solution.

Here’s what I ended up doing. ZHA Events [Events] → filter for specific device [Switch] → filter for Z-Axis [Switch] → filter for the desired Z-axis values [Switch] → trigger an input_boolean I created called garage_door [Call Service]. I used a is_between range in my call service nodes. Open is 950-1050, Closed is -50-150.

Any chance you could export the code behind your flow? I’m in the exact same boat.

I was able to piece it together. Thanks for the idea.

Here’s the basic flow:

[{"id":"7e4a9200.df31fc","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"33ca4380.2a775c","type":"server-events","z":"7e4a9200.df31fc","name":"Check for ZigBee events","server":"8eacddf5.e8655","event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":150,"y":140,"wires":[["9de00da1.24141"]]},{"id":"9de00da1.24141","type":"switch","z":"7e4a9200.df31fc","name":"Check for garage door events","property":"payload.event.device_ieee","propertyType":"msg","rules":[{"t":"eq","v":"aa:aa:aa:bb:cc:dd:ee:ff","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":440,"y":140,"wires":[["5df0b9e8.574f58"]]},{"id":"5df0b9e8.574f58","type":"switch","z":"7e4a9200.df31fc","name":"Check for z-axis events","property":"payload.event.args.attribute_name","propertyType":"msg","rules":[{"t":"eq","v":"z_axis","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":740,"y":140,"wires":[["7286cf65.b9afa"]]},{"id":"7286cf65.b9afa","type":"switch","z":"7e4a9200.df31fc","name":"Get z-axis value","property":"payload.event.args.value","propertyType":"msg","rules":[{"t":"gt","v":"900","vt":"num"},{"t":"lt","v":"150","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":970,"y":140,"wires":[["71220abd.37b524"],["4037010.4b64c"]]},{"id":"71220abd.37b524","type":"debug","z":"7e4a9200.df31fc","name":"Opened","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":60,"wires":[]},{"id":"4037010.4b64c","type":"debug","z":"7e4a9200.df31fc","name":"Closed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1170,"y":220,"wires":[]}]

Is the device_ieee what I should be keying off of or should I use unique_id to identify the device?

Too bad the entity for this device doesn’t expose the x, y and z axis directly, as we wouldn’t have to go to this length, and we’d know the initial state.