Aqara in 2024 - Zigbee 3.0

So I ran into the issue of a switch having to be a No Neutral type.
Picked up an Aqara hub E1 and a Switch (WS-USC01) installed in minutes and the app was a breeze. Now for the hard part.

How do I add this thing to Openhabian? I installed the Zigbee binding since its zigbee certified, but when I click SCAN nothing shows up, and there are just the 4 default co-ordinators in OH.

Any tips appreciated

You can’t use the Aqara hub with the Zigbee binding. It requires a USB Zigbee controller to be plugged into your OH server.

I don’t know anything about the Aqara hub E1. You can search the community to see if anyone else has implemented it, but I’d personally recommend that you get a USB controller (I use a Sonoff ZBDongle-E).

If your Aqara switch follows the Zigbee standards, the Zigbee Binding will automatically identify it for direct control in OH. Unfortunately, Aqara has a history of not following the Zigbee standards, in which case you’ll need to use Zigbee2mqtt.

If you haven’t used MQTT before, you’ll have to set up an MQTT broker to pass messages between Zigbee2mqtt and OH. If you’re using openHABian, you can install the Mosquitto broker from openhabian-config.

MQTT can be very daunting at first, but once you figure it out it makes a lot of sense. Plus, there’s a lot of help available in the community.

Aquara hub is, as far as I understand, not a standard/supported Zigbee coordinator. The Zigbee binding requires a supported USB Zigbee coordinator in order to access the Zigbee network. Nothing shows up when you hit “scan” because there is no coordinator. The coordinator has the actual antenna that talks Zigbee. Without the coordinator it’s like asking your bluetooth speaker to send a file over WiFi.

There is an API for the Aquara Hub: API Introduction · Aqara Developer Platform Documentation. You might be able to make something work using the HTTP binding, but it’s going to be a lot of work.

Here is the list of supported coordinators.

Thanks for your replies. Took a look at the api and bailed because I don’t have time for a pet project.

I ordered a
EFR32MG21 Sonoff Dongle and will try it tomorrow.

Ok - dongle installed, and recognized in openhab -meaning I installed mosquito broker and zibgee2mqtt from the >

sudo openhab-config

menu. (This is RPi 4 with OH 4.0.4)

Visited the URL http:\myopenhabip:8081 and zigbee2mqtt’s UI was there, Allowed Join (Which actually says "Disable join’ in the dropdown, with a count down, since joining will automatically close in 255secs)

So switch is added.

But now I have no clue what THING to add

  • Tried adding a zigbee thing, scan did nothing. So I added an already listed one - EMBER, it was initializing and says Error Com, the port is /dev/ttyACM0

(investigating how to determine what dev mount point a USB device has)

Also added an MQTT broker - there was nothing much to configure, Broker Hostname is localhost, security disabled.

Adding an item just adds stub, the channel can neither be set to ember or mqtt …
Other threads indicate a lot of textfile based config - is this still the case?

Any pointers appreciated. (I can use text files but would rather hit this via the UI as much as possible)

None of this. You are using zigbee2mqtt. zigbee2mqtt owns the Zigbee network. OH can access it through zigbee2mqtt using MQTT.

You have two choices:

  • zigbee2mqtt to interface with Zigbee and MQTT in OH
  • OH Zigbee add-on to interface with the Zigbee network directly.

You can’t use both zigbee2mqtt and the Zigbee add-on at the same time with the same controller.

MQTT is going to be more work. There are several tutorials on the forum with how to integrate with zigbee2mqtt.

For a simple switch, it’s probably going to be sufficient to:

  1. Remove the Zigbee add-on from OH. At this point OH is completely separated from Zigbee.

  2. Install the MQTT add-on.

  3. Create an MQTT Broker Thing and configure it to connect to your MQTT broker (presumably zigbee2mqtt has also been configured to connect to this same broker).

  4. On the MQTT Broker Thing click “show advanced” and scroll to the bottom and make sure “Enable Discovery” is checked.

  5. Return to Settings → Things and click +, choose MQTT and then run a scan. If zigbee2mqtt is connected to the MQTT broker and configured to use the HomeAssistant MQTT standard, it should automatically discover the switch and let you add it’s Thing.

Thanks Rich - it got me pretty much in the right direction, I did have to enable legacy options as in screen shot, then the SCAN worked and found the switch.

From that I chose the option to create a thing, and it did.
From the thing I chose to create an Item which it did.
But its making fun of me and not working.

Getting close - but I’ll play with it more tonight.

Thanks for your help!

I don’t use the HA auto-discovery, which I seem to recall being problematic for at least one of my devices. I prefer to create things manually and only define the channels I need. If I need a duplicate thing, I just add a new one and then copy/edit the code from an existing one.

Here’s what the thing code looks like for one of my outlets, which is the closest I’ll have to your Aqara light switch. As you can see, you need a stateTopic to receive data from Z2M, and a commandTopic to send commands to Z2M.

UID: mqtt:topic:mosquitto:ThirdReality_Outlet
label: "MQTT: Third Reality Outlet"
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: offline
  availabilityTopic: zigbee2mqtt/ThirdReality_Outlet/availability
  payloadAvailable: online
bridgeUID: mqtt:broker:mosquitto
channels:
  - id: state
    channelTypeUID: mqtt:switch
    label: Outlet
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/ThirdReality_Outlet/set
      stateTopic: zigbee2mqtt/ThirdReality_Outlet/state
  - id: current
    channelTypeUID: mqtt:number
    label: Current
    description: ""
    configuration:
      stateTopic: zigbee2mqtt/ThirdReality_Outlet/current

To close this out, I finally got it working today and am happy with getting it to work without using text config files. (I personally despise them, despite being a dev)

This is specifically for the AQARA WS-USC01 available on amazon in the americas. It’s a “no neutral wire” switch so it has a battery or slow capacitor inside, not sure which. In my case I had to use it because a slack electrician added a switch for a light by simply putting the switch in line, leaving the neutral at the fixture. This can happen when the walls and ceiling are finished and breaking them would be an excess of work, however in my case it was an unfinished space so it should have been run.

Some URLs that will help you. openhabsvr in the url means YOUR open hab instance’s IPaddress or name. If you are not on Rasberry Pi (RPI) yet, highly recommend it. I was running it on a NAS for years and years, but Openhabian on the RPI is lower powered (so the nas can sleep state) and RPI is stable, and faster to respond when the nas is busy.

Devices supported by zigbee2mqtt:

Cool software that talks directly to the mqtt device. You can see all sorts of data and publish commands to the device(s). This helped immensely with seeing the config and sending json payloads.

Your zigbee2mqtt after install in OH is here:
http://openhabsvr:8081/

Your OH log is here (you must login as admin via the web to see it):
http://openhabsvr:9001/


Hardware
You will need a Sonoff Zigbee dongle from amazon that will plug into your RPI.


Adding the THING in OH
Forget using the Home Assistant MQTT search, its problematic, it will find the device and create the THING but it will not always make the proper channels for the THING and this was my problem there was no SWITCH channel. Instead I created a THING manually via the GUI.

Things Page > click the blue + > MQTT Binding > Generic MQTT Thing
Make sure to choose the bridge you setup when Mosquitto was installed via OH admin linux console.

Save it. and Edit it.
Goto the channels tab for the new THING and ADD A CHANNEL then enter the specifics

Notice the MQTT Command topic has a /set this is important
The payloads (aka data) for the Command Topic are in json format, with curly braces {"state:“ON”}

Lastly after saving make an ITEM linked the Channel (green plus - add link to item)
In this case a switch type item.

Once the item is saved, toggling it will turn on and off your switch.

Hope that helps you.

***REMINDER you must have setup mosquitto and zigbee on openhab before any of this, its simple and there are a few threads on it, if you’re stuck reply to me I may be around to help.

Also you DO NOT NEED the aqara hub for this, you do need the zigbee dongle.

1 Like