Home Home Automation I have infinite buttons thanks to Aqara Opple

I have infinite buttons thanks to Aqara Opple

What would you do with an infinite number of actions?

Aqara Opple may not be the best IoT response to Nintendo Switch, it won’t top the chart for 10 best No Man’s Sky controllers either, but using this light switch as a game controller shows how much fun one can have given more buttons than sense!

I came up with a couple of clever scripts over the years to tackle limited control schemes. I used a single button controller to toggle all devices, or dim, toggle and control the colour of the lights with a single click. All that forced by the number of buttons available on each controller. Now I have buttons for days and more, thanks to Aqara Opple – a ZigBee switch with 24 actions.

Power remote

Aqara Opple is built to control complicated light groups, but it doesn’t have to be used this way. The panel comes with 6 buttons, each one of them has 4 configurable actions:

  • Single Click
  • Double Click
  • Tripple Click
  • Hold and Release

It’s ZigBee, so Aqara Opple will run for months on a single CR2032 battery. Speaking of that battery, whoever came up with the procedure (or lack thereof) for changing the battery, should be hung to dry. You have to pop the buttons out with significant force risking breaking the thin panels covering the actual PCB. what’s wrong with the access latch at the back? I’m pleased that the battery on ZigBee gadgets lasts a long time! It is powered by JN5189 IC from NXP, with a rich array of dev pads present which usually indicated a good hacking potential.

Aqara Opple comes with a wall mount. It can be screwed in or glued, but the unit itself sits in the bracket thanks to small magnets. The actual device is much smaller and easier to carry around.

Aqara Opple is Aqara Home exclusive

To my surprise, I was not able to pair Aqara Opple with MiHome hub, Tuya or eWeLink. Looks like this device is compatible with Aqara Home, a new ecosystem which incorporates all familiar Aqara devices from MiHome.

Fragmenting ecosystem of ZigBee devices in the wake of Apple and Google joining the alliance is not something I would expect. The biggest strength of the ZigBee is not being locked to a single ecosystem/manufacturer.

Fortunately, there is NodeRED.

NodeRED: More buttons than sense

If this is your 1st NodeRED and ZigBee rodeo, you can mix and match most of the ZigBee products thanks to CC2531 (and other coordinators). Thanks to this small USB stick, hooking up Aqara Opple is a dream come true, as the device is already supported by ZigBee2MQTT.

I’m not sure yet, what would I need 24 actions for and how I’m going to use this in my automation setup, but I’m almost certain that Aqara Opple will end up embedded into my new desk. I will show you the most interesting use cases in NodeRED and if 24 actions aren’t enough, how to add more actions to a single controller.

I already covered different ways of interacting with various systems so I will simply refer you to individual articles for each action:

  1. Hold/Release to dim
  2. Sending messages to Android
  3. Interacting with Windows computer (EventGhost)
  4. Making Google Home talk
  5. Making Alexa do anything you want (and notifications)
  6. Tasker integration via AutoRemote
  7. Inching

Infinite buttons*

In case 24 buttons aren’t enough, NodeRED can change the map of the actions on the fly. It’s a really simple concept, an external command (a button, voice command, dashboard switch) can be used to change the current map of all actions linked to Aqara Opple. You could even bind this action to one of the buttons of Aqara Opple.

A minor inconvenience would be lack of direct feedback that would indicate what layout is currently assigned but with some clever automation, you can always have the buttons mapped your way.

I used button_1_triple & button_2_triple to iterate between 3 layouts. But you can map fixed preset as well. If you do so, these actions will be disabled from the layouts and permanently assigned to layout changes. To achieve this, simply filter the actions out, and assign 2 iterating functions:

// preset ++
var preset = flow.get("preset");
var presetName;

if(preset < 3){
    preset++;
    flow.set("preset", preset);
}
else {
    preset = 1;
    flow.set("preset", preset);
}

switch(preset){
    case 1:
        presetName = "bedroom";
        break;
    case 2:
        presetName = "office";
        break;
    case 3:
        presetName = "kitchen";
        break;
}


//preset --
var preset = flow.get("preset");
var presetName;

if(preset <= 3 && preset > 1){
    preset--;
    flow.set("preset", preset);
}
else{
    preset = 3;
    flow.set("preset", preset);
}

switch(preset){
    case 1:
        presetName = "bedroom";
        break;
    case 2:
        presetName = "office";
        break;
    case 3:
        presetName = "kitchen";
        break;
}

Then you can use all other actions to your heart’s content. I’m not sure why would you need over 60 actions, and how you are going to memorise it, but the option is there should you need it. Before I show you what you could do with all these buttons, Let’s add a Alexa/GoogleHome and Android prompt that tells you the current preset.

Amazon Echo (AlexaRemote2)

I mentioned before how AlexaRemote2 replaces IFTTT Pro for Alexa users completely, and it’s pretty much all you need to send the voice feedback to your Alexa enabled speaker (or a mobile phone with Alexa app installed).

Use Alexa Routine node to trigger a speech mode. If you are feeling fancy, you can edit the payload to SSML and make the Alexa whisper instead, I will keep it simple and set the text option to msg.payload. Now, when I change the preset, Alexa will announce the one, that is active on my Aqara Opple.

Google Home (Castv2)

To achieve a similar outcome with Google Home devices, I need a Castv2 node. I will cover it in detail better at some point, but for the purpose of this tutorial, just know that you have to modify the payload into a JSON format (JSON 5 min tutorial).

This function node will do just that, and Castv2 will make your smart speaker announce the current preset for Aqara Opple.

msg.payload =  {
    "app": "DefaultMediaReceiver",
    "type": "TTS",
    "text": msg.payload,
    "speed": 1,
    "language": "en",
    "metadata": {
        "title": "Media title"
    }
}
return msg;

You could take it further and trigger voice prompts only on smart speakers located in the rooms that correspond to presets instead of spamming all of them. Simply add an IF statement and take the advantage of the value listed in the presetName.

Android (Join App)

If you want an android notification, Join app is by far the easiest way to go (plus the app has 100s of other uses!). To send the message, I have to compose the push JSON. I used this website to get URL for the icons (free, but needs account) so if you want to prettify your notification pick the icons you like.

msg.push = {
"title":"Aqara Opple preset",
"text":msg.payload, 
"icon":"https://img.icons8.com/cotton/64/000000/warning-shield.png",
"smallicon": "https://img.icons8.com/cotton/64/000000/warning-shield.png"
};
return msg;

When the preset changes, you will get an instant notification on your phone to keep the track of the changes.

NodeRED example flow
[{"id":"4cde4e4b.0a14a","type":"tab","label":"Aqara Opple","disabled":false,"info":""},{"id":"15f5bb19.ebc0f5","type":"group","z":"4cde4e4b.0a14a","name":"Notifications Android","style":{"stroke":"#addb7b","fill":"#e3f3d3","label":true,"label-position":"n","color":"#000000"},"nodes":["7c4b2e6d.2badb","3237f781.827778"],"x":754,"y":319,"w":412,"h":82},{"id":"2aa484bf.2cc8ec","type":"group","z":"4cde4e4b.0a14a","name":"Notifications Alexa","style":{"stroke":"#addb7b","fill":"#e3f3d3","label":true,"label-position":"n","color":"#000000"},"nodes":["b8767be8.c5dac8"],"x":754,"y":119,"w":152,"h":82},{"id":"bf271361.fd275","type":"group","z":"4cde4e4b.0a14a","name":"Notifications Google Home","style":{"stroke":"#addb7b","fill":"#e3f3d3","label":true,"label-position":"n","color":"#000000"},"nodes":["44f25e37.50f5f","648ba182.67ea7"],"x":754,"y":219,"w":452,"h":82},{"id":"bfc4df79.351b4","type":"group","z":"4cde4e4b.0a14a","name":"Presets","style":{"stroke":"#ffC000","fill":"#ffffbf","label":true},"nodes":["e4ad9171.6d394","3538f58.593420a","a84676f6.eeda58","b34d8eea.bf45a","6ee3b0ec.61a7","73da595d.7438c8"],"x":934,"y":434,"w":852,"h":412},{"id":"6f128d.95e16d74","type":"mqtt in","z":"4cde4e4b.0a14a","name":"Aqara Opple","topic":"zigbee2mqtt/0x04cf8cdf3c7d471b","qos":"2","datatype":"json","broker":"6e117ba5.8026e4","x":130,"y":280,"wires":[["5fe8aa97.e1ed64","a69dc782.bb8198"]]},{"id":"e4ad9171.6d394","type":"switch","z":"4cde4e4b.0a14a","g":"bfc4df79.351b4","name":"Preset 2 (office)","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"button_1_single","vt":"str"},{"t":"eq","v":"button_1_double","vt":"str"},{"t":"eq","v":"button_1_triple","vt":"str"},{"t":"eq","v":"button_1_release","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"}],"checkall":"false","repair":false,"outputs":24,"x":1380,"y":640,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]},{"id":"3538f58.593420a","type":"switch","z":"4cde4e4b.0a14a","g":"bfc4df79.351b4","name":"Preset 3 (kitchen)","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"button_1_single","vt":"str"},{"t":"eq","v":"button_1_double","vt":"str"},{"t":"eq","v":"button_1_triple","vt":"str"},{"t":"eq","v":"button_1_release","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"}],"checkall":"false","repair":false,"outputs":24,"x":1670,"y":640,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]},{"id":"79cfaf4f.f93ca","type":"switch","z":"4cde4e4b.0a14a","name":"Active Preset","property":"preset","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":570,"y":460,"wires":[["93382d1c.705c2"],["42334746.605358"],["eb4e5074.9f572"]]},{"id":"79bf08e3.f30238","type":"function","z":"4cde4e4b.0a14a","name":"Preset ++","func":"var preset = flow.get(\"preset\");\nvar presetName;\n\nif(preset < 3){\n    preset++;\n    flow.set(\"preset\", preset);\n}\nelse {\n    preset = 1;\n    flow.set(\"preset\", preset);\n}\n\nswitch(preset){\n    case 1:\n        presetName = \"bedroom\";\n        break;\n    case 2:\n        presetName = \"office\";\n        break;\n    case 3:\n        presetName = \"no man's sky\";\n        break;\n}\n\nmsg.payload = \"Current preset for Aqara Opple is \" + presetName;\nreturn msg;","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is deployed.\nflow.set(\"preset\", 1);","finalize":"","x":560,"y":220,"wires":[["b8767be8.c5dac8"]]},{"id":"5fe8aa97.e1ed64","type":"switch","z":"4cde4e4b.0a14a","name":"Preset toggle","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"button_1_triple","vt":"str"},{"t":"eq","v":"button_2_triple","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":350,"y":280,"wires":[["79bf08e3.f30238"],["149ddbfd.4bf254"],["79cfaf4f.f93ca"]]},{"id":"149ddbfd.4bf254","type":"function","z":"4cde4e4b.0a14a","name":"Preset --","func":"var preset = flow.get(\"preset\");\nvar presetName;\n\nif(preset <= 3 && preset > 1){\n    preset--;\n    flow.set(\"preset\", preset);\n}\nelse{\n    preset = 3;\n    flow.set(\"preset\", preset);\n}\n\nswitch(preset){\n    case 1:\n        presetName = \"bedroom\";\n        break;\n    case 2:\n        presetName = \"office\";\n        break;\n    case 3:\n        presetName = \"no man's sky\";\n        break;\n}\n\nmsg.payload = \"Current preset for Aqara Opple is \" + presetName;\nreturn msg;","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is deployed.\nflow.set(\"preset\", 1);","finalize":"","x":560,"y":280,"wires":[["b8767be8.c5dac8"]]},{"id":"b8767be8.c5dac8","type":"alexa-remote-routine","z":"4cde4e4b.0a14a","g":"2aa484bf.2cc8ec","name":"Alexa","account":"9d26c7ce.162eb8","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"msg","value":"payload"},"devices":["G0916D10012701AR"]}},"x":830,"y":160,"wires":[[]]},{"id":"a84676f6.eeda58","type":"switch","z":"4cde4e4b.0a14a","g":"bfc4df79.351b4","name":"Preset 1 (bedroom)","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"button_1_single","vt":"str"},{"t":"eq","v":"button_1_double","vt":"str"},{"t":"eq","v":"button_1_triple","vt":"str"},{"t":"eq","v":"button_1_release","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"","vt":"str"}],"checkall":"false","repair":false,"outputs":24,"x":1110,"y":640,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]},{"id":"b34d8eea.bf45a","type":"link in","z":"4cde4e4b.0a14a","g":"bfc4df79.351b4","name":"","links":["93382d1c.705c2"],"x":975,"y":640,"wires":[["a84676f6.eeda58"]]},{"id":"6ee3b0ec.61a7","type":"link in","z":"4cde4e4b.0a14a","g":"bfc4df79.351b4","name":"","links":["eb4e5074.9f572"],"x":1515,"y":640,"wires":[["3538f58.593420a"]]},{"id":"73da595d.7438c8","type":"link in","z":"4cde4e4b.0a14a","g":"bfc4df79.351b4","name":"","links":["42334746.605358"],"x":1255,"y":640,"wires":[["e4ad9171.6d394"]]},{"id":"93382d1c.705c2","type":"link out","z":"4cde4e4b.0a14a","name":"bedroom","links":["b34d8eea.bf45a"],"x":755,"y":440,"wires":[]},{"id":"42334746.605358","type":"link out","z":"4cde4e4b.0a14a","name":"office","links":["73da595d.7438c8"],"x":755,"y":480,"wires":[]},{"id":"eb4e5074.9f572","type":"link out","z":"4cde4e4b.0a14a","name":"kitchen","links":["6ee3b0ec.61a7"],"x":755,"y":520,"wires":[]},{"id":"44f25e37.50f5f","type":"castv2-sender","z":"4cde4e4b.0a14a","g":"bf271361.fd275","name":"Google Home","connection":"75963de5.058184","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":1100,"y":260,"wires":[[]]},{"id":"648ba182.67ea7","type":"function","z":"4cde4e4b.0a14a","g":"bf271361.fd275","name":"Format Response","func":"msg.payload =  {\n    \"app\": \"DefaultMediaReceiver\",\n    \"type\": \"TTS\",\n    \"text\": msg.payload,\n    \"speed\": 1,\n    \"language\": \"en\",\n    \"metadata\": {\n        \"title\": \"Media title\"\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":870,"y":260,"wires":[["44f25e37.50f5f"]]},{"id":"7c4b2e6d.2badb","type":"function","z":"4cde4e4b.0a14a","g":"15f5bb19.ebc0f5","name":"Format Response","func":"msg.push = {\n\"title\":\"Aqara Opple preset\",\n\"text\":msg.payload, \n\"icon\":\"https://img.icons8.com/cotton/64/000000/warning-shield.png\",\n\"smallicon\": \"https://img.icons8.com/cotton/64/000000/warning-shield.png\"\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":870,"y":360,"wires":[["3237f781.827778"]]},{"id":"3237f781.827778","type":"join-message","z":"4cde4e4b.0a14a","g":"15f5bb19.ebc0f5","name":"Android","text":"","title":"","url":"","notificationicon":"","joinConfig":"8ac6a18d.55759","x":1080,"y":360,"wires":[[]]},{"id":"a69dc782.bb8198","type":"debug","z":"4cde4e4b.0a14a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":480,"y":80,"wires":[]},{"id":"6e117ba5.8026e4","type":"mqtt-broker","z":"","name":"MQTT","broker":"automation.local","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9d26c7ce.162eb8","type":"alexa-remote-account","z":"","name":"","authMethod":"proxy","proxyOwnIp":"192.168.1.107","proxyPort":"3456","cookieFile":"","refreshInterval":"3","alexaServiceHost":"alexa.amazon.co.uk","amazonPage":"amazon.co.uk","acceptLanguage":"en-UK","userAgent":"","useWsMqtt":"on","autoInit":"off"},{"id":"75963de5.058184","type":"castv2-connection","z":"","name":"Google Home","target":"Google Home","host":"","port":"8009"},{"id":"8ac6a18d.55759","type":"join-config","z":"","name":"JOIN Mat","register":true}]

No Man’s Sky

In case you wonder how I turned the Aqara Opple into a controller, I created a new preset with AutoRemote to EventGhost action. Commands sent from the remote (mostly hold down/up events) were mapped to corresponding button actions using Keyboard plugin. This way I could emulate the button presses from the wall switch itself.

While latency wasn’t that big, hold and release triggers take about 1 sec to register which introduced a visible delay between my actions and character’s response. Anything that requires a simple button press takes less than half a second to register. It’s not enough for gaming, but sufficient for a viral video or a custom Spotify controller.

Buy Aqara Opple

Buy it using these links to support NotEnoughTech.

Final thoughts

Although the lack of support for MiHome, Tuya and other ecosystems than Aqara Home is disappointing, the seamless work with NodeRED redeems the gadget for me. Everything I play with ends up linked to my automation server so it’s a win in my books. The most important question is: what am I going to do with countless ZigBee buttons? 24 actions (or 18 actions and 6 dimmers) seem like a lot. I created the layouts and named it after the rooms for a reason as if you ever wanted to have a universal remote that works in each room – Aqara Opple could be a very inexpensive option. Let me know what would you do with 24+ actions in this Reddit thread.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated in style with crypto-currency

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services

Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

0
To server or not to server? That's a very silly question!

Best Automation Projects

ESP8266 WIFI lights under $5

0
Your Sonoff device can't do this!

Free wireless doorbell (Amazon Dash button hack)

0
The most terrifying situation I can imagine* is missing a parcel

New Amazon Dash Buttons

0
You can teach new buttons old tricks!

ESP8266 ceiling light – demo

0
Testing the ESP8266 as a WIFI light controller

Try Tasker and Raspberry Pi for your home automation needs!

0
Raspberry Pi can help you with your Tasker profiles

Smart Home

How to make Sonoff ZB Mini and ZigBee2MQTT work together

0
It's time to make Sonoff ZB Mini and ZigBee2MQTT work together!

Sonoff ZBMINI is in town!

0
ITEAD released a new product - Sonoff ZB Mini - a smarter twin brother of Sonoff Mini!

Testing 9 external antennas with CC2531 ZigBee coordinator

0
I have tested the range and the link quality of 9 external antennas with CC2531!

I have infinite buttons thanks to Aqara Opple

0
Gaming on Switch meets IoT - can you play games on Aqara Opple? Apparently you can! This and more uses of the connected wall switch

Smart lights won’t save you money

0
It's pretty clear how much power a smart light draws when turned on, but have you ever wonder how much do you pay to have it connected 24/7?