WebThingsIO / addon-list

List of installable add-ons for WebThings Gateway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[new add-on?] zigbee2mqtt

flatsiedatsie opened this issue · comments

I could have sworn I saw a zigbee2mqtt add-on in the add-on list once. I bought all the required hardware, and then couldn't find the add-on in the list anymore.

The add-on did have some issues.

  • Did not also install the zigbee2mqtt daemon on which it depended.
  • Did not handle my devices properly

I hope I have fixed both issues. In this implementation zigbee2mqtt is not a daemon but just a node program in a sub-directory that gets started as a sub-process of the add-on.

This does require a git clone to take place before the add-on starts. I have created a build.sh file that does the git-pull. Is that the 'bootstrap.py' equivalent for node plugins?

I have tried to reach out to the original maker but have not had any response. Therefore I thought I'd share what I have created and leave it to debate if it should be added.

{
  "name": "zigbee2mqtt",
  "display_name": "Zigbee2MQTT adapter",
  "description": "Allows you to connect to a wide range of Zigbee devices with a single cheap dongle.",
  "author": "Kabbi and Flatsiedatsie",
  "homepage": "https://github.com/flatsiedatsie/zigbee2mqtt-adapter",
  "license": "https://github.com/flatsiedatsie/zigbee2mqtt-adapter/blob/master/LICENSE",
  "type": "adapter",
  "packages": [
    {
      "architecture": "linux-arm64",
      "language": {
        "name": "nodejs",
        "versions": [
          "57"
        ]
      },
      "version": "0.3.0",
      "url": "https://github.com/flatsiedatsie/zigbee2mqtt-adapter/raw/master/zigbee2mqtt-adapter-0.3.0.tgz",
      "checksum": "25b40a895c3e5371cac3250cf00757be12ec6da4fd60a4925853794352bf0e18",
      "api": {
        "min": 2,
        "max": 2
      }
    }
  ]
}

References WebThingsIO/gateway#1910

@kabbi are you still actively using the WebThings Gateway and/or maintaining your add-on?

If so, can we merge these two? If not, I'm happy to pull in this new add-on.

I think I've never published my addon. It was for my home use mostly, and requires code editing to add more device types.
There should be either a way to add new types easily by user (yaml configs? some sort of gui?), or to manually implement all of the supported zigbee2mqtt devices to make it usable for wider audience.
So, it's not ready yet

Would you be able to test this new version and see if it works for your devices?

I'm trying to avoid having multiple versions of this add-on floating around. I'd rather have a single one that works for everyone.

The forked add-on is here: https://github.com/flatsiedatsie/zigbee2mqtt-adapter

@kabbi Thanks for the quick response.

I assumed that the level of support that the add-on offered would be reliant on the work of the add-on maker, and not the end user? As you say, it's quite difficult for the end user to edit the file.

Wouldn't it make more sense to just launch the addon ("release early, release often"), and let users help increase the breadth of support via github additions? Then whenever a few new devices are supported, a new version of the add-on could be launched?

Would you still like to turn this into an add-on? I wasn't sure that was still the way forward after the discussion. I'd be happy to make it happen, don't get me wrong.

I don't have a problem with it being an add-on if:

  1. You intend to support it and add support for new devices, and
  2. This add-on provides functionality that the 2 existing Zigbee add-ons do not.

What is the benefit of using this add-on over the Zigbee and the (poorly named) Zigbee (Conbee) adapters?

Question number 2 is easy, since it's the only project I know of that allows you to communicate with the products of a wide range of companies with just a single dongle. E.g. Xiaomi, Ikea, Philips.. it works with all of those and more.

It's cheap to make too. For less than $20 you get a dongle and some flashing hardware, which allows you to flash the firmware.

The downside is that it's incredible nerdy. You have to be comfortable with flashing firmware onto a device. Not everybody is.

Question number one is less easy to answer.

On the one hand supporting it should be relatively easy, since in theory all that should happen now is that users append new devices to the device list. It's like making json, relatively easy.

On the other hand supporting this add-on is not core to my work. I only have two Zigbee devices at the moment. I guess my ideal situation would be if Kabbi incorporated the changes I proposed into his add-on and he takes charge. I already have quite a few add-ons to support. Alternatively, we could do it together.

What are your thoughts @kabbi?

Have you tried the normal Zigbee adapter? It supports a very wide variety of hardware out of the box, from lots of companies.

I had a look, and you're right, it would support the few devices I have. Funny that.

The first mentioned zigbee adapter does not seem to be for sale in my area. The Conbee is, and would be about 50 euros.

There is an open PR for CC253x dongle support, which I believe is the only thing this add-on would get you over the official Zigbee adapter. Would you agree?

I don't know, it's not my area of expertise. It would seem that way?

Ok. I'm going to close this, since it doesn't really gain us (or users) anything. If you (or someone else) has a compelling reason why this should be included alongside the 2 existing Zigbee add-ons, I'll reconsider pulling this in.

I spoke with members of the local hackerspace today. They said Zigbee2MQTT supports close to 250 devices, and that no commercial dongle gets close to that.

Zigbee2MQTT supports close to 250 devices

More like 380 devices:

https://www.zigbee2mqtt.io/information/supported_devices.html

It's not about a dongle. The dongle is just the hardware. If we're missing support in the Zigbee adapter, we should just file issues there.

There's also the problem of not being able to get any of your 3 supported Zigbee dongles in Australia.

So this just comes back to adding CC253x support. Just prod @dhylands and I'm sure he'll get around to it.

I don't know much about all of this, but wouldn't it be easier to just support the mqtt protocol than trying to support every single chip, dongle and gateway that people might wish to use?

Potentially, but in its current state, this adapter only supports a tiny subset of the hardware supported by zigbee2mqtt.

Very true :-)

Hi guys, I'd be very happy to see the zigbee2mqtt adapter added to the official addons, since zigbee2mqtt gives me the freedom to use one hardware with multiple frontends, like webthings gateway, home assistant and even my own at the same time. It also now supports all of deCONZ zigbee dongles with original firmware, making it easier to use.
You're right, the adapter by now only supports a tiny subset of zigbee2mqtt but that can easily be extended and even generalized to support new devices very fast.
I've forked kabbis repository, since he's not actively maintaining it anymore and am willing to help anyone in developing this addon further.

Things have changed a bit since this was last discussed.

  1. The official Zigbee adapter now supports CC2253x, ConBee, and Digi dongles natively.
  2. The second Zigbee adapter was dropped, so there is now just the one.

I’ve also learned more about Zigbee2MQTT and I do see how it could be valuable to have an adapter for it, although I do wonder how many people are using multiple home automation systems concurrently.

With all that said, I will go back to what I said before, which is that I’ll accept an add-on if someone is willing to actively maintain it.

Something I wonder about: if there was an MQTT addon that followed the Home Assistant standard for adding devices via MQTT automatically, then wouldn't that make Zigbee2Mqtt as well as many other MQTT based tools be able to hook into the Gateway? Wouldn't that be way more efficient?

@tim-hellhake made one that follows the Homie standard (here), so I assume it would be a very similar add-on.

brilliant, that's exactly what I meant.

So I haven't looked into the details, but isn't Zigbee2MQTT compatible with that addon? If Zigbee2Mqtt is installed on a syste, won't it be able to 'feed' that addon, and that addon can then create all the things?

I have no idea, I’ve never used either.

Unfortunately, no. Zigbee2mqtt is only compatible to Home Assistents mqtt discovery protocol.
But yes, I think implementing that is a really good Idea. This won't cover the full features of z2m tho. There is a reason, why a z2m addon exists for Home Assistent.
What I'm thinking is a general mqtt adapter addon, which provides an interface to implement additional protocols.
The solutions for mqtt protocols would always be very similar so it'd make sense to keep things dry.

Let's re-open this. I've worked on a new version of the addon, since the new generic ability to allow any device that the Zigbee2MQTT community supports is too good to pass up. It can lower the pressure on @mrstegeman to respond to everyone's wishes surrounding the existing zigbee addon. This is based on the great work and idea by @anvo.

Also cool: zigbee2MQTT even has support for devices that are designed to connect directly to other devices only, such as the motion recognition product and all kinds of buttons from IKEA.

And it can do all this with the $4 usb stick.

Because of the new generic nature, I believe there will be less desire to create a json addition for each and every existing device. All this is offloaded to the zigbee2mqtt community. This allows me to be the maintainer of this addon, since its unlikely to create a barage of update requests.

Code is here:
https://github.com/kabbi/zigbee2mqtt-adapter

A few questions:

  • Would you be willing to create another one of those github scripts so we can automate the workflow of creating an update?
  • The addon has both a package.json and a manifest.json file. Do javascript-based addons need both, or can I remove one of these files, like with the python addons?

Todo:

  • Test some other zigbee devices
  • Create addon list pull request
  • Would you be willing to create another one of those github scripts so we can automate the workflow of creating an update?

Yes, I can absolutely do that.

  • The addon has both a package.json and a manifest.json file. Do javascript-based addons need both, or can I remove one of these files, like with the python addons?

Yes, JS add-ons need to have both, although you can drop the whole moziot property from package.json, as that's no longer used.

Thanks for the code.

I've tested it with some devices today. They all work.

One limitation I personally ran into is that the addon doesn't support the color property on lights yet. It's an "XY colorspace" (you'll know this better than I do), so it's two numeric variables which will need to be translated into one color string - and back.

Neither of us have a zigbee lock or thermostat to test with either.

But for a first release, it's working.

Feel free to open a pull request when you're ready and I'll review it.

I noticed zigbee2mqtt has support for updating firmware on zigbee devices, and this can be initiated through a simple MQTT command.

It could be interesting to create a UI extention that lists all the zigbee devices the addon manages, and show update buttons where relevant. But that also once again makes me feel that it would make sense to be able to extend the settings page though a UI extention, since in my mind such a page would make more sense under settings. Just a thought.

Do you have a tip for an example of code to create one of those fancy popups? I'd like to inform the user that it will take another 5 minutes or so before the addon's installation is complete.

@flatsiedatsie You'll want to use sendPairingPrompt from within the adapter.