How to use a Aqara cube with ZHA in Node-red?

I’ve managed to work out all commands given by the cube, like Flip, Rotate_left, Rotate_right, and how to call them to set an action.

Now I don’t know if this is possible, but I want NR to remember that the activated_face + rotate L/R
to trigger other actions based on the side its on??

Is this possible, if yes, how??

Thnx

with a command like ‘flip’ I see the 'activated_face"

But when I rotate I only see the rotate, but not the activated face.
Is it possible to ‘set’ the rotated face (into a memory ) and then when rotate is triggered, based on the face up, to start a action??

I now have :

but after ‘select side’ I cannot add the needed commands, is there any idea how to solve this?

If ‘side 1’ is up, and ‘rotate left/right’ then …

[{“id”:“19d5765b.65e74a”,“type”:“tab”,“label”:“Test cube”,“disabled”:false,“info”:""},{“id”:“44514fe.732f1b”,“type”:“switch”,“z”:“19d5765b.65e74a”,“name”:“Remote keuze”,“property”:“payload.event.device_ieee”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“00:15:8d:00:01:0f:d2:6d”,“vt”:“str”},{“t”:“eq”,“v”:“00:17:88:01:06:a7:02:5e”,“vt”:“str”}],“checkall”:“false”,“repair”:false,“outputs”:2,“x”:360,“y”:300,“wires”:[[“915e86a3.647468”,“79b25655.2e4bb8”],[“d5dc320.ae49cd”]]},{“id”:“712a1d0a.fc4474”,“type”:“server-events”,“z”:“19d5765b.65e74a”,“name”:“Zha Event”,“server”:“a81f26ce.23aa88”,“version”:1,“event_type”:“zha_event”,“exposeToHomeAssistant”:false,“haConfig”:[{“property”:“name”,“value”:""},{“property”:“icon”,“value”:""}],“waitForRunning”:true,“outputProperties”:[{“property”:“payload”,“propertyType”:“msg”,“value”:"",“valueType”:“eventData”}],“x”:100,“y”:300,“wires”:[[“44514fe.732f1b”,“79b25655.2e4bb8”]]},{“id”:“1a508cb.684b673”,“type”:“comment”,“z”:“19d5765b.65e74a”,“name”:“Deconz remote events”,“info”:"",“x”:140,“y”:140,“wires”:[]},{“id”:“915e86a3.647468”,“type”:“link out”,“z”:“19d5765b.65e74a”,“name”:“hue_r6”,“links”:[“bdc04cfc.1676b”,“ea463963.7288e8”,“18732f6.91e01d1”,“e5f872b8.59698”],“x”:555,“y”:260,“wires”:[]},{“id”:“a3635d8f.70e9d”,“type”:“comment”,“z”:“19d5765b.65e74a”,“name”:“Naar kubus flow”,“info”:"",“x”:700,“y”:260,“wires”:[]},{“id”:“b8cde8d3.73b258”,“type”:“switch”,“z”:“19d5765b.65e74a”,“name”:“Select side”,“property”:“payload.event.args.activated_face”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“1”,“vt”:“str”},{“t”:“eq”,“v”:“2”,“vt”:“str”},{“t”:“eq”,“v”:“3”,“vt”:“str”},{“t”:“eq”,“v”:“4”,“vt”:“str”},{“t”:“eq”,“v”:“5”,“vt”:“str”},{“t”:“eq”,“v”:“6”,“vt”:“str”}],“checkall”:“false”,“repair”:true,“outputs”:6,“x”:390,“y”:800,“wires”:[[“a1fa96f5.9c5478”,“5594cce0.3ef2ac”],[“8bdbcc2.d2cc83”,“38619ba8.50262c”],[],[],[],[]]},{“id”:“4dc2ad05.187ddc”,“type”:“comment”,“z”:“19d5765b.65e74a”,“name”:“Aqara Cube”,“info”:“Events:\n- [7000] == ‘wake’\n- [1000, 2000, 3000, 4000, 5000, 6000] == ‘slide’\n- [1001, 2002, 3003, 4004, 5005, 6006] == ‘double_tap’\n- [1006, 2005, 3004, 4003, 5002, 6001] == ‘flip_180’\n- [1002, 1003, 1004, 1005, 2001, 2003, 2004, 2006, 3001, 3002, 3005, 3006, 4001, 4002, 4005, 4006, 5001, 5003, 5004, 5006, 6002, 6003, 6004, 6005] == ‘flip_90’\n- [7007] == ‘shake’\n- [7008] == ‘drop’\n- [int > 0] == ‘rotate_cw’\n- [int < 0] == ‘rotate_ccw’”,“x”:330,“y”:720,“wires”:[]},{“id”:“18732f6.91e01d1”,“type”:“link in”,“z”:“19d5765b.65e74a”,“name”:"",“links”:[“915e86a3.647468”],“x”:115,“y”:920,“wires”:[[“b8cde8d3.73b258”]]},{“id”:“79b25655.2e4bb8”,“type”:“debug”,“z”:“19d5765b.65e74a”,“name”:"",“active”:false,“tosidebar”:true,“console”:true,“tostatus”:false,“complete”:“payload”,“targetType”:“msg”,“statusVal”:"",“statusType”:“auto”,“x”:620,“y”:220,“wires”:[]},{“id”:“d5dc320.ae49cd”,“type”:“link out”,“z”:“19d5765b.65e74a”,“name”:“remote rolluikken”,“links”:[“54cc87c4.a1908”],“x”:555,“y”:300,“wires”:[]},{“id”:“65686b4b.367714”,“type”:“comment”,“z”:“19d5765b.65e74a”,“name”:“remote rolluikken”,“info”:"",“x”:700,“y”:300,“wires”:[]},{“id”:“a1fa96f5.9c5478”,“type”:“switch”,“z”:“19d5765b.65e74a”,“name”:“Action”,“property”:“payload.context.id”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“flip”,“vt”:“str”},{“t”:“eq”,“v”:“knock”,“vt”:“str”},{“t”:“eq”,“v”:“slide”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:3,“x”:570,“y”:720,“wires”:[[“5594cce0.3ef2ac”],[],[]]},{“id”:“5594cce0.3ef2ac”,“type”:“debug”,“z”:“19d5765b.65e74a”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“statusVal”:"",“statusType”:“auto”,“x”:790,“y”:720,“wires”:[]},{“id”:“8bdbcc2.d2cc83”,“type”:“switch”,“z”:“19d5765b.65e74a”,“name”:“Action”,“property”:“payload.context.id”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“flip”,“vt”:“str”},{“t”:“eq”,“v”:"",“vt”:“str”},{“t”:“eq”,“v”:"",“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:3,“x”:570,“y”:840,“wires”:[[“38619ba8.50262c”],[],[]]},{“id”:“38619ba8.50262c”,“type”:“debug”,“z”:“19d5765b.65e74a”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“statusVal”:"",“statusType”:“auto”,“x”:790,“y”:800,“wires”:[]},{“id”:“a81f26ce.23aa88”,“type”:“server”,“name”:“Home Assistant”,“version”:1,“addon”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:true,“cacheJson”:true}]’

I don’t have a cube and I don’t really know how it works, but as far as I understood, you could create an input select with X options, one for each face (Face A, Face B, Face C, etc)

input_select:
  aqara_cube_current_face:
    name: Aqara Face
    options:
      - "Face A"
      - "Face B"
      - "Face C"
      - "Face D"
      - "Face E"
      - "Face F"

Then create an automation that when you see the “activated_face”

then set the input_select to the given option. That input select persists its state after restarts and you’d always have the information of the current face of the cube.

Then you could use a current state node with the current state of the input as a condition whenever you rotate the cube :wink:

Sorry for rambling, I hope I made myself clear.

You could also use the entity node from NR, to create a sensor from NR to HA with the information of the current face. Then do the same as with the input, use it with a current state node as a condition whenever the cube is rotated.

thnx, lets see if I can get this working :slight_smile:

Did you get this working? Can you share your node red formula?

I don’t have the cube so I can’t actually build it… ask johannes