Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.82k stars 1.64k forks source link

Zigbee2MQTT port for Windows #648

Closed mcsSolutions closed 5 years ago

mcsSolutions commented 5 years ago

I recognize that there are instructions for use of Windows to program the sniffer, but is there a port of zigbee2mqtt that runs on Windows?

ptvoinfo commented 5 years ago

@mcsSolutions Zigbee2MQTT runs on Windows without any problems. You may install NodeJS, Zigbee2MQTT and all depended packages.

mcsSolutions commented 5 years ago

All the install instructions I have seen are based upon a Linux install. Things like sudo does not work from the Windows command prompt. Seems like the Wiki should have a Windows install to parallel the Linux one. Just as it does for the Windows flash of the USB dongle.

Elliott32224 commented 5 years ago

I second the request for Windows installation instructions on the Wiki.

mcsSolutions commented 5 years ago

I gave it a shot at trying to install on Windows using as best I could the pattern defined for Linux. First issue is the CC2531 device identification. It shows in Windows Device Manager as an "Other Device" "TI CC2531 USB CDC". I assume then that configuration.yaml will use this text rather than the "ttyACM0". I suspect this will not be correct and zigbee2mqtt will expect something like "COM5", but no device driver for Windows has been installed for this device.

A fresh install of node.js resulted in version 10.14.1 and npm 6.4.1. This should be good as it is a higher version than what is installed on Linux.

/opt/ folder does not exist on Windows so to make it as close as possible I did the git clone into C:\opt\zigbee2mqtt. I already had git installed, but I suspect if I did not then this would be a prerequisite part of the instructions.

I installed from an administrator account so chown equivalent is not needed

After npm install and npm start the expected issue with the port showed up with the following in the command window: Error while starting zigbee-shepherd, attempting to fix ... PM failed to start Opening TI CC2531 USB CDC: File not found,

So it seems the essential problem with the Windows install is the method to identify the USB Dongle in configuration.yaml.

ptvoinfo commented 5 years ago

You may find the port number in the devices manager. The corresponding option in "configuration.yaml" looks like:

serial:
  port: \\.\COM15

If Windows didn't assign the port number to TI CC2531 USB CDC then you need to install the driver.

mcsSolutions commented 5 years ago

It shows up in Device Manager as an Other Device because there is no driver installed that makes the USB device look like a serial port. Is there a place to get such a driver?

ptvoinfo commented 5 years ago

I've installed this driver with Z-Stack. You may try the following file: http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=swrc088&fileType=zip driver\usb_cdc_driver_cc2531.inf Right click -> Install

If the direct link will not work:

  1. Go to http://www.ti.com/product/CC2531/toolssoftware
  2. Select "Tools and software" tab
  3. Scroll down to "CC USB Firmware Library and Examples (Rev. C)" and download it.
mcsSolutions commented 5 years ago

Able to install the driver via Control Panel and now have a COM15 port. Issue now is privledges to access port. I opened command prompt with right-click on cmd.exe, run as administrator. Logged into administer account on Win 7 Ultimate. cd c:/opt/zigbee2mqtt npm start Receive Error: Opening COM15: Access denied

Is there a way to run npm directly so it has the elevated privileges to access the port?

mcsSolutions commented 5 years ago

Turns out that a PC restart cleared up the access denied message. Success was then achieved. ptvo, thanks for all the pointers.

I documented my steps at https://forums.homeseer.com/forum/lighting-primary-technology-plug-ins/lighting-primary-technology-discussion/mcsmqtt-michael-mcsharry/1264779-zigbee2mqtt-on-windows. It would be nice if this or similar information was available for others via the Wiki.

clockbrain commented 5 years ago

I'd like to second those thanks to @ptvoinfo and @mcsSolutions.

I got it working on Windows 10 quite easily thanks to all the tips here. Had to install node.js and git but I didn't have to install any special drivers, or even reboot - worked straight up.

Now I had somewhere I can experiment with new device pairing etc without disrupting my operational Pi setup, Pro tip: when purchasing the CC2531 get 2 of them - one for prod and one for dev.

ptvoinfo commented 5 years ago

Also, if you have Hyper-V on your Windows system, you may install and use a docker container. I've tried it too, but installing NodeJS is more easy :).

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Elliott32224 commented 5 years ago

So, I have been trying to implement zigbee2mqtt on Windows 10, since I am having issues (won't start) on RPi3, which are being discussed elsewhere. I could not get it started. The feedback in the command window indicated "Error: Cannot find module 'semver'," which I do not see in the log file. The log file is attached. Any help would be appreciated. 2019-08-26T17_08_32_806Z-debug.pdf Thanks.