openhab / org.openhab.ui.habmin

HABmin - a graphical user interface for openHAB 2
231 stars 91 forks source link

Zstick serial 'does not exist' #126

Closed sirvs closed 8 years ago

sirvs commented 8 years ago

Hello all, I'm a bit stuck on setting up my Aeon Zstick to start my first zwave network. I am completely new at this and linux as a hole, but so far so good. I have OH setup and working with Wemo. I've installed Habmin and added the 1.8 snapshot for the zwave bindings. This all starts fine and I am able to access the webpage.

Trying to get OH to recognize my Zstick, I hit the issue:

03:22:09.488 INFO o.o.i.habmin.HABminApplication[:182]- Started HABmin REST API at /services/habmin 03:22:15.305 INFO o.o.b.w.internal.WemoBinding[:376]- Wemo Device with UDN 'Lightswitch-1_0-221543K1301293' discovered 03:22:16.369 INFO o.o.c.s.AbstractActiveService[:169]- Wemo Refresh Service has been started 03:22:20.470 INFO o.o.b.z.i.ZWaveActiveBinding[:325]- Update config, port = /dev/ttyACM0 03:22:20.480 INFO o.o.b.z.i.ZWaveActiveBinding[:330]- Update config, healtime = 2 03:22:20.518 INFO o.o.c.s.AbstractActiveService[:169]- ZWave Refresh Service has been started 03:22:21.101 INFO o.o.b.z.i.p.ZWaveController[:146]- Starting Z-Wave controller 03:22:21.108 INFO o.o.b.z.i.p.ZWaveController[:154]- Z-Wave timeout is set to 5000ms. Soft reset is false. 03:22:21.120 INFO o.o.b.z.i.p.ZWaveController[:320]- Connecting to serial port /dev/ttyACM0 03:22:21.718 ERROR o.o.b.z.i.p.ZWaveController[:342]- Serial Error: Port /dev/ttyACM0 does not exist 03:22:25.540 INFO o.o.c.s.AbstractActiveService[:181]- ZWave Refresh Service has been shut down

To make sure I had the correct port: ls /dev/tty* before and after plugging it in and I only see ttyACM0 come and go.

I made sure to join my user to the dialout group

sudo usermod -a -G dialout pi
grep dialout /etc/group
dialout:x:20:pi

Yes, I am running openhab's start.sh as pi:

-rwxr-xr-x  1 pi   pi   1.1K Sep 12  2014 start_debug.sh
-rwxr-xr-x  1 pi   pi    880 Sep 12  2014 start.sh

Checked the ports permissions:

ls -lah /dev/ttyACM*
crw-rw-rw- 1 root dialout 166, 0 Feb 20 04:24 /dev/ttyACM0

I enabled the debug for zwave, but do not get much more information:

2016-02-20 03:57:15.550 [DEBUG] [.zwave.internal.ZWaveActivator:36 ]- Z-Wave binding started. Version 1.8.0.201508211938 2016-02-20 03:57:16.253 [DEBUG] [.z.internal.ZWaveActiveBinding:175 ]- ConverterHandler not initialised. Polling disabled. 2016-02-20 03:57:16.264 [INFO ] [.z.internal.ZWaveActiveBinding:325 ]- Update config, port = /dev/ttyACM0 2016-02-20 03:57:16.272 [INFO ] [.z.internal.ZWaveActiveBinding:330 ]- Update config, healtime = 2 2016-02-20 03:57:16.297 [DEBUG] [.z.internal.ZWaveActiveBinding:282 ]- Initialising zwave binding 2016-02-20 03:57:17.426 [INFO ] [b.z.i.protocol.ZWaveController:146 ]- Starting Z-Wave controller 2016-02-20 03:57:17.450 [INFO ] [b.z.i.protocol.ZWaveController:154 ]- Z-Wave timeout is set to 5000ms. Soft reset is false. 2016-02-20 03:57:17.454 [INFO ] [b.z.i.protocol.ZWaveController:320 ]- Connecting to serial port /dev/ttyACM0 2016-02-20 03:57:18.188 [ERROR] [b.z.i.protocol.ZWaveController:342 ]- Serial Error: Port /dev/ttyACM0 does not exist

Stopping and starting the services after each change: sudo service openhab restart

Any idea as to why this would not come up?

As a last ditch effort, I changed ownership of start.sh and start_debug.sh

sudo chown root start.sh
sudo chown root start_debug.sh

Manually started start: sudo ./start.sh

And it appears everything comes up, but I cannot see devices in Habmin. I believe I see nodes in the zwave debugs though...I have 3 switches, I see 4 Nodes. The controller and 2 multi-level switches.

I'm not a fan of having to run openhab as root. Is there anything anyone can see as to why I cannot run as pi? Any further help of seeing the devices in habmin?

xsnrg commented 8 years ago

Just a couple things, as I think you are close. Most of your steps to figure this out were in the right direction!

When you add or change groups in Linux or just about any *nix operating system for that matter, it is always best to log out and back in so that the groups get picked up. What likely happened is you set everything up, but your pi user did not know it was a member of the new dialout group, and as such it had no permissions.

Running it as root seems to have worked, so this supports the above. Simply log out and back in and then try to run openhab again as user pi.

One final note, changing the ownership of a file does not mean it runs as that user. It still would run as whatever user has permissions to, and executes the file. There are ways to run as another user of course, but that should not be necessary.

Now, once you are running, there are some things you need to know about the present state of Habmin and zwave. Zwave 1.8 will not work with the current snapshot of Habmin2. Use Habmin1 with 1.x zwave bindings. Zwave 2.0 is not out yet, though it is getting close. I have been working with @cdjackson and other testers to help get it there as time permits. For people just starting out though, I would wait until it is part of the OpenHAB distribution, and then you can add it easily. If you are set on 2.0 stuffs, there is a good thread over at the openHAB forums here: Zwave 2.0 testing

This is also a thread similar to your question: Z-stick on Pi

Hope this helps!

sirvs commented 8 years ago

Thank you for such a quick response! As i was troubleshooting, I actually tried a couple of things.

  1. Leaving the owner as root, stopped the manual run and tried to start the service sudo service openhab start Low and behold, it cannot find the port
  2. Seeing your comment, I logged out (of both ssh sessions), logged back in, changed the owner back to 'pi' for start.sh, and tried to start the service as above again. Same issue.
  3. Leaving it as owner pi, started it all manually

./start.sh Launching the openHAB runtime...

Invalid Configuration LocationLocking is not possible in the directory "/opt/openhab/server/configuration/org.eclipse.osgi". A common reason is that the file system or Runtime Environment does not support file locking for that location. Please choose a different location, or disable file locking passing "-Dosgi.locking=none" as a VM argument. /opt/openhab/server/configuration/org.eclipse.osgi/.manager/.fileTableLock (Permission denied) 1. Decided to run it as `sudo ./start.sh` as pi being the owner. I assume this is actually running the file as root at this point, bypassing the TableLock issue and things run correctly.

So, I guess and as you mentioned, it is not the file owner issue, but how its actually called. Running the service, even with sudo, does not appear to trigger as root, but running "sudo ./start.sh" does run it as root.

Makes a little sense now, guess i need to figure out how services are really running.

I must have made a flub with my searches and posting. I believe I am actually using Habmin1. 1.7 SNAPSHOT to be precise. Though it lists as 1.4.0 in the HABmin web UI under System > Bundles. I guess i should move this over to the other support forums as to why Habmin1 is not seeing the zwave nodes, though i have a feeling its something similar as openhab is calling /services/habmin to start it...though that folder does not seem to exist.

sirvs commented 8 years ago

Oh, and I would love to go through and test Habmin2, just need to get Habmin1 up and running first :+1:

sirvs commented 8 years ago

Thanks for your help xsnrg I wanted to follow-up on here at least in case it helps anyone else.

My issue ended up coming down to stating the service manually sudo ./start.sh vs as a service sudo service openhab start

I decided to take a look at the actual service script /etc/init.d/openhab

I found this in it -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0

Turns out, even though it never listed this port in the logs, it was still trying to use the wrong port, or something. Changing this to my port fixed it.

Now, to figure out why Habmin1 isnt seeing my devices...to the other forum!

ahmadado commented 7 years ago

This worked for me, gotten from another forum:

**_"I got some feedback from a friend and he suggested that I edit the start-stop-status.sh and add chmod 777 /dev/ttyACM0 and chmod 777 /run/lock/

It worked. I know that 777 is bad juju but I tried that on the command line for the device and it didn't help. Wan it /run/lock? I already had /var/lock set as root.uucp and openhab was added to the group."_**


Good luck