🧯 Zigbee2MQTT - ZemiSmart ZM-RM02 Controller

(18 actions!!) This Blueprint uses the Z2M (Zigbee2MQTT) imported Action sensor to sort out the 18 commands from the 6 buttons of a ZemiSmart ZM-RM02 Controller. The split out of functions gives you the ability to assign local scripts or functions to do the things you want the remote to do. Functions that are left empty will simply do nothing.

:bookmark_tabs: Changelog

  • 2022-05-05: Updated for 2022.5.0 HA. Added Markdown to !input Descriptions.
  • 2022-04-17: :tada: :control_knobs: :battery: New Blueprint!

:envelope_with_arrow: Get Started

Updates will be published on my GIT repository with the rest of my Home Assistant Blueprint collection.

Option 1: My Home Assistant

Click the badge to import this Blueprint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Please Click the :orange_heart: at the end of this Top Post if you find this Useful

Option 2: Direct Link

Copy this link if you want to import the blueprint in your installation.

:open_book: Description

This Blueprint uses the Z2M (Zigbee2MQTT) imported Action sensor to sort out the 18 commands from the 6 buttons of a ZemiSmart ZM-RM02 Controller. The split out of functions gives you the ability to assign local scripts or functions to do the things you want the remote to do. Functions that are left empty will simply do nothing.

Within this code there is an event handler that will ‘latch’ the last command that the blueprint finds and sends that to the event buss. From there a simple Template sensor can grab it and show you the last action sent. This will help when setting up new functions and to troubleshoot strange behaviors. Here is a sample Template sensor to capture this event:

Sample Script Generation Dashboard Entry

  - trigger:
      - platform: event
        event_type: rm02_last_action
      - name: "RM02 Last Action"
        unique_id: Random-String-of-Gibberish-HERE
        icon: mdi:eye-refresh-outline
          friendly_name: "RM02 Action"
        state: >
          {{ trigger.event.data.friendly_name }} - 
          {{ trigger.event.data.event }}

If you wish to ‘store’ these events you can add this sensor to recorder and it will
save them for you.

My ‘suggestion’ is that you do separate scripts for most, if not all of the actions you generate here. If you are using the UI editor for the simple things you are fine, but for more complicated things scripts may work better for you. This is my opinion and how I am using it, to each their own. Building functions within the uI is also available if you are more confortable with that.

First, let’s go over Blueprints and what they are. Blueprints are a way to share automations and is built into Home Assistant. Simple as that. You can import my template code and a copy of it will reside in your configuration. Once there, you can can edit it (if you need changes only) or you can call up that Blueprint to build an automation. It will collect the information needed based on your entities and your personal adjustments, and provide a working automation. You will have to have or add the required hardware and entities that the Blueprint needs to function.

:gear: Usage

:hammer_and_wrench: Installation

  • Open Home Assistant with administrator privileges and on a Lovelace screen, click anywhere in the main entity area and type the letter ‘c’. A selection box should pop up. Type blue and select the button to navigate to blueprints. You can also find blueprints by selecting configuration from the left menu and then blueprints from the center menu.
  • Once there, click on the ‘Import Blueprint’ button in the lower right side of the main screen.
  • In the ‘URL of the blueprint’ line type or paste in the URL of my Blueprint. I have the blueprint stored on my Public GitHub:

GitHub - SirGoodenough/HA_Blueprints: My Collection of Automation and Script Blueprints for Home Assistant

:dna: To make the blueprint work it will need

To make the Blueprint work you will need a functional Magic Cube integrated to Home Assistant thri Zigbee2MQTT and find the sensor entity in the Home Assistant Device tab that Z2M imported which is named similar this:

  • sensor.xxDevice_Namexx_action

If you do not see that sensor, ‘LegacyAPI’ might not be selected in the Zigbee2MQTT settings - settings - advanced menu. Please find and check/select that setting like so:

Z2M Menu Screen


Legacy API Selected Screen

Once you have found the entity_id you can build the Automation. To build the automation:

  1. Click on ‘Create Automation’ Open your Home Assistant instance and show your automations. and ‘Use Blueprint’
  2. Add a Description so you can tell what this one is for
  3. Use the Drop-downs to select the Entities for the listed purposes

:sun_with_face: :snowflake: Troubleshooting tip

If you are troubleshooting and you want to see more traces back when doing so, here is a TIP I’ve found.
Manually edit the automation created with the ui editor (or manually with a text editor) and add the following to have this automation contain 10 traces instead of the normal 5. Then if the automation is triggering often, you can see the last 10 traces to help you decide what the issue is.

alias: aaaaaaa Test
description: 'See how to increase the number of Traces available''
  stored_traces: 10

:globe_with_meridians: All My Blueprints

Link to ALL my Blueprints

Here is a list of each of my blueprints, a quick description and jump links to the Blueprints Exchange post…

:cyclone: Scripts

:fire_extinguisher:Broadlink on Script Blueprint

This is a SCRIPT Blueprint that uses my Broadlink RM3 to turn my TV on and get it into the correct mode, Pushes remote buttons in sequence.

:fire_extinguisher:Tasmota EZ Button Blueprint

This Script Blueprint generates 3 Buttons to help you manage your Tasmota installed base. Restart All, Update a few, and Update all.

:fire_extinguisher:Play Media File Script Blueprint Blueprint

This is a SCRIPT Blueprint. This provides a way to play canned media files with the big long list of YAML entries but keep the main script or automation clean.

:fire_extinguisher:TTS All Message Blueprint

This script can use any of the 11 integrated TTS Platforms in Home Assistant to send a message to a media player.

:arrows_clockwise: Automations

:fire_extinguisher:Auto Fan Control Blueprint

TThis Blueprint is for controlling a 3 speed fan based on a temperature sensor. Both fan% control & MQTT fan control versions.

:fire_extinguisher:Door Open TTS Cloud-Say Message Blueprint

This Blueprint is a TTS.cloud-say version of another Door Announcer I found in the HA Blueprint Exchange.

:fire_extinguisher:Keypad Lock or puzzle Box Tool Blueprint

This Blueprint accepts 5 actions & when done in the right order, flips an input_boolean.

:fire_extinguisher:Zigbee2MQTT - Xiaomi Cube Controller Blueprint

This Blueprint uses a Zigbee2MQTT built sensor to sort out the multitude of commands from the Xiaomi Magic Cube Remote.

:fire_extinguisher:Zigbee2MQTT - ZemiSmart ZM-RM02 Controller Blueprint

This Blueprint uses the Z2M (Zigbee2MQTT) imported Action sensor to sort out the 18 commands from the ZemiSmart ZM-RM02 Controller.

:man_juggling:t5: Contact Links or see my other work

What are we Fixing Today Homepage / Website: https://www.WhatAreWeFixing.Today/

Channel Link URL: (WhatAreWeFixingToday) https://bit.ly/WhatAreWeFixingTodaysYT

What are we Fixing Today Facebook page (Sir GoodEnough): WhatAreWeFixingToday

What are we Fixing Today Twitter Account (Sir GoodEnough): https://bit.ly/WhatAreWeFixingTodayTW

Discord Guild: (Sir_Goodenough#9683) WhatAreWeFixingToday?

:cheese: If you want to support me

Buy me Coffee: Sir GoodEnough

PayPal one-off donation link: PayPal.Me