core icon indicating copy to clipboard operation
core copied to clipboard

ZWave light components

Open leoc opened this issue 11 years ago • 22 comments

Hi,

what is the current state of the Zwave support? I was about to implement ZWave light components but was not able to initialize the zwave platform:

15-11-01 14:57:11 ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component zwave
Traceback (most recent call last):
  File "/home/arthur/projects/home-assistant/lib/python3.5/site-packages/python_openzwave_api-0.2.6-py3.5.egg/openzwave/option.py", line 67, in __init__
    if os.path.exists(config_path):
  File "/usr/lib/python3.5/genericpath.py", line 19, in exists
    os.stat(path)
TypeError: stat: can't specify None for path argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arthur/projects/home-assistant/homeassistant/bootstrap.py", line 96, in _setup_component
    if not component.setup(hass, config):
  File "/home/arthur/projects/home-assistant/homeassistant/components/zwave.py", line 78, in setup
    user_path=hass.config.config_dir)
  File "/home/arthur/projects/home-assistant/lib/python3.5/site-packages/python_openzwave_api-0.2.6-py3.5.egg/openzwave/option.py", line 74, in __init__
    raise ZWaveException("Can't retrieve config from %s" % config_path)
openzwave.object.ZWaveException: "Zwave Generic Exception : Can't retrieve config from None"

I'd love to get my Zwave Multi-Level wallplugs working :+1:

leoc avatar Nov 02 '15 21:11 leoc

Hi Leoc,

I have developed some Zwave components, and already made the Zwave Dimmer. I can help You with your components.

sandro1005 avatar Nov 02 '15 23:11 sandro1005

The error that you're facing is a wrong entry in your configuration.yaml.

The basic configuration would look like this (note that your path would change, depending on your platform): zwave: usb_path: /dev/ttyUSB0

sandro1005 avatar Nov 02 '15 23:11 sandro1005

Sorry, I should have posted my configuration.

homeassistant:
  latitude: 32.87336
  longitude: 117.22743
  temperature_unit: C
  time_zone: Europe/Berlin
  name: Home

http:

zwave:
  usb_path: /dev/ttyUSB0

# My first attempt of a light component for zwave. The error occurs also, without specifying the platform.
light:
  platform: zwave

device_tracker:
  platform: nmap_tracker
  hosts: 192.168.1.1/24

Still, it's giving me config error.

@sandro1005: Thanks! Can I see your code on how you set up your zwave light switches and dimmers?

leoc avatar Nov 03 '15 06:11 leoc

I think you are getting that error because you specified zwave as an light platform. The z-wave component works via the discovery service and automatically add devices when they are detected.

So just remove:

light:
  platform: zwave

@sandro1005 I was planning to extend the z-wave support to handle lights and switches. Do you have your changes in a repository somewhere?

stefan-jonasson avatar Nov 03 '15 06:11 stefan-jonasson

@stefan-jonasson Thanks, this is actually my first draft of zwave light functionality. Currently not much more than the demo component. The error occurs even when I remove that.

Then we are three people trying to get light support done. :+1: I think it should be straight-forward. Now I am not a python developer, that's why this error leaves me a little puzzled. Haven't had time to investigate further yet, I just read in another issue, that zwave support is broken currently and will be until a new python-openzwave version... Is that so?

leoc avatar Nov 03 '15 07:11 leoc

Interestingly when I unplug the Aeon Zstick the error message is:

Traceback (most recent call last):
  File "/home/arthur/projects/home-assistant/lib/python3.5/site-packages/python_openzwave_api-0.2.6-py3.5.egg/openzwave/option.py", line 59, in __init__
    raise ZWaveException("Can't write to device %s" % device)
openzwave.object.ZWaveException: "Zwave Generic Exception : Can't write to device /dev/ttyUSB0"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arthur/projects/home-assistant/homeassistant/bootstrap.py", line 96, in _setup_component
    if not component.setup(hass, config):
  File "/home/arthur/projects/home-assistant/homeassistant/components/zwave.py", line 78, in setup
    user_path=hass.config.config_dir)
  File "/home/arthur/projects/home-assistant/lib/python3.5/site-packages/python_openzwave_api-0.2.6-py3.5.egg/openzwave/option.py", line 63, in __init__
    raise ZWaveException("Can't find device %s" % device)
openzwave.object.ZWaveException: "Zwave Generic Exception : Can't find device /dev/ttyUSB0"

So the configuration seems correct? I set user permissions to /dev/ttyUSB0 (chmod 666)

leoc avatar Nov 03 '15 17:11 leoc

Hi, @leoc, @stefan-jonasson please send me your e-mails so I can send you my code for the Zwave light component, I'm sending the files for You to use it as a point of start, as I did not fininshed it (I had no time to do it). there is some debug codes and other components tests, but it is working well. What you have to do is to cleanup the code, and organize it.

sandro1005 avatar Nov 04 '15 14:11 sandro1005

I would also like to get the z-wave switches working. Can I be included in this?

lorddaren avatar Nov 04 '15 15:11 lorddaren

@sandro1005 Awesome, maybe you could push to your fork of home-assistant? Then we can all try to collaborate on your state of zwave light components.

Otherwise, please use leoc.git {at} gmail.com

leoc avatar Nov 04 '15 16:11 leoc

@leoc, @stefan-jonasson, @Xorso, thats the problem, since I have a bunch of code pieces (in fact, I have various versions of home-assistant that I was working on) the code that is working to the Zwave components where in a version prior to 0.7.3 (I have already tested on 0.7.5 and is working too), but my branch has a bunch of messed codes, since I am working on other platforms (like iTach Global Caché), I think the best way is to someone to generate a new branch based on a clean master, to make a pull request. If some of You want to do this, please send me an e-mail ([email protected]) and I can send the code.

sandro1005 avatar Nov 04 '15 17:11 sandro1005

You've got mail. :+1:

leoc avatar Nov 05 '15 13:11 leoc

I have emailed as well.

lorddaren avatar Nov 05 '15 13:11 lorddaren

@Xorso, are You Daren Lord? I've received only e-mails from @leoc and this one from Daren Lord, if it's You, I've sent the e-mail.

sandro1005 avatar Nov 05 '15 17:11 sandro1005

Hi, sending code per email seems a litte messy, couldn't you just push it to newly cloned repository here at github?

stefan-jonasson avatar Nov 05 '15 21:11 stefan-jonasson

Hi @stefan-jonasson, that's the problem, as I said before, the code is a little messy, and I don't have time, for now, to organize it. I've sent it to @leoc and @Xorso and I hope they have the time to put it together and do a pull request. If You want to do, I can send You by e-mail.

sandro1005 avatar Nov 06 '15 00:11 sandro1005

I made an attempt on using my wall plugs. See #592

Since the original issue is solved I'm closing this. Thank you all! :+1:

leoc avatar Nov 07 '15 14:11 leoc

I am getting the error described in the very first post. I was able to install python-openzwave. It appears that the XML configuration files required by libopenzwave are missing. Is there an additional step I need to do to get this working?

bburan avatar Nov 19 '15 04:11 bburan

Ok, I figured out the issue. The real issue is that ZWaveOption needs to know where the OpenZWave configuration files are (e.g., ~/.virtualenvs/ha/share/python-openzwave/config/). I don't know why the docker container doesn't have this issue. Presumably the path to the configuration files should be an option in the configuration.yaml file. I'll submit a pull request in the next few days.

bburan avatar Nov 19 '15 04:11 bburan

The fix by @bburan has been merged into the dev branch and should go out the next release.

balloob avatar Nov 21 '15 20:11 balloob

Hi - I"m having the original posters issue when running the docker image on Synology DS415+ and using Aeon Z-stick Gen 5.

I have the CP210 drivers loaded and the z-stick confirmed at /dev/ttyUSB0 on the synology with permissions of 666 and have added only the following to the end of the docker-generated config file (residing in my host fs per the home assistant docker image instructions).

zwave:

  usb_path: /dev/ttyUSB0
  config_path: /usr/local/share/python-openzwave/config

I have also confirmed the location of python-openzwave within the container. Note that inside the docker container there is no /dev/ttyUSB* - I'm new to containers and unsure if that is expected.

Here is my error from the docker log (newest line first) ...

2016-02-16 20:27:03 stdout openzwave.object.ZWaveException: "Zwave Generic Exception : Can't find device /dev/ttyUSB0" 2016-02-16 20:27:03 stdout raise ZWaveException("Can't find device %s" % device) 2016-02-16 20:27:03 stdout File "/usr/local/lib/python3.4/site-packages/python_openzwave_api-0.2.6-py3.4.egg/openzwave/option.py", line 63, in init 2016-02-16 20:27:03 stdout DEFAULT_ZWAVE_CONFIG_PATH),) 2016-02-16 20:27:03 stdout File "/usr/src/app/homeassistant/components/zwave.py", line 136, in setup 2016-02-16 20:27:03 stdout if not component.setup(hass, config): 2016-02-16 20:27:03 stdout File "/usr/src/app/homeassistant/bootstrap.py", line 99, in _setup_component 2016-02-16 20:27:03 stdout Traceback (most recent call last): 2016-02-16 20:27:03 stdout
2016-02-16 20:27:03 stdout During handling of the above exception, another exception occurred: 2016-02-16 20:27:03 stdout
2016-02-16 20:27:03 stdout openzwave.object.ZWaveException: "Zwave Generic Exception : Can't find device /dev/ttyUSB0" 2016-02-16 20:27:03 stdout raise ZWaveException("Can't find device %s" % device) 2016-02-16 20:27:03 stdout File "/usr/local/lib/python3.4/site-packages/python_openzwave_api-0.2.6-py3.4.egg/openzwave/option.py", line 61, in init 2016-02-16 20:27:03 stdout Traceback (most recent call last): 2016-02-16 20:27:03 stdout ERROR:homeassistant.bootstrap:Error during setup of component zwave

jeremysavoy avatar Feb 16 '16 20:02 jeremysavoy