Timvdv / pimatic-zwave-usb

GNU General Public License v2.0
1 stars 7 forks source link

How to add devices #9

Open sweebee opened 6 years ago

sweebee commented 6 years ago

I've got this usb dongle: https://www.robbshop.nl/usb-stick-met-zwave-plus?sqr=zware%20usb&

your plugin does find this and should work.

But how do I add devices? Can't find any. I've got this dimmer: https://www.robbshop.nl/enkele-dimmer-z-wave-plus-tkb?sqr=tkb%20dimmer&

Timvdv commented 6 years ago

Hey @sweebee,

You should put the dimmer in pairing mode first, then press the search button. If the device is not found you could also try adding it the old fashioned way by entering the z-wave network id yourself. Make sure the dimmer is indeed data.class_id==38 or else it won't be found.

Sometimes the z-wave network is kind of broken and has to be reset, I have an open branch which should implement this feature but unfortunately some other project have more priority right now. I remember having some trouble with putting custom elements in the Pimatic UI.

You could use the z-wave API yourself and create a node reset script or use another HA platform like HomeAssistant or Domoticz.

sweebee commented 6 years ago

I need to connect it first to the usb dongle right? I can't get that working, I have no inclusion button on the usb dongle. Also can't find a way to do it with the API from open-zwave-shared.

If I look at the discovery log, it looks like the device is not yet connected to the dongle right?

21:21:53.234 [pimatic] info: pimatic-zwave-usb: Searching for zwave devices
21:21:53.240 [pimatic-zwave-usb] debug: [Plugin] Eventdata: { time: 20000 }
21:21:53.255 [pimatic-zwave-usb] debug: [Plugin] devices:  [ { nodeid: 1,
21:21:53.255 [pimatic-zwave-usb] debug:>    manufacturer: 'Z-Wave.Me',
21:21:53.255 [pimatic-zwave-usb] debug:>    manufacturerid: '0x0115',
21:21:53.255 [pimatic-zwave-usb] debug:>    product: 'ZME_UZB1 USB Stick',
21:21:53.255 [pimatic-zwave-usb] debug:>    producttype: '0x0400',
21:21:53.255 [pimatic-zwave-usb] debug:>    productid: '0x0001',
21:21:53.255 [pimatic-zwave-usb] debug:>    type: 'Static PC Controller',
21:21:53.255 [pimatic-zwave-usb] debug:>    name: '',
21:21:53.255 [pimatic-zwave-usb] debug:>    loc: '',
21:21:53.255 [pimatic-zwave-usb] debug:>    classes: { '32': [Object] },
21:21:53.255 [pimatic-zwave-usb] debug:>    ready: true } ]
21:21:53.464 [pimatic] info: Device discovered: pimatic-tradfri : GATEWAY: TradfriHub - 192.168.1.132
21:21:53.511 [pimatic-hue-zll] info: Connected to bridge Thuis, API version 1.21.0, software 1709131301
Timvdv commented 6 years ago

Ahhh.. Yes, same feature. Working on this in the feature/zwave-network-commands branch. You need to put the zwave network into 'include mode' first.

I looked into it, and indeed could not find it in the api documentation.. yay. I looked at the way HomeAssistant does this and they use: ADD_NODE. I have to dig deeper to really help you because all this z-wave stuff is super complicated. But I did find a piece of code in the official z-wave docs which uses the zwave.beginControllerCommand to add devices like this.

Manager::Get()->BeginControllerCommand(homeId, Driver::ControllerCommand_AddDevice,
callbackfn, context, true));

My z-wave stick has an 'include' button. Thats why I did not implement this yet. Hope this helps.

sweebee commented 6 years ago

Well, I better return it for one with an inclusion button. Much easier for now

redxeagle commented 6 years ago

I included some week ago my new device without any inclusion button by simply calling the z-wave add node function. To do this I used the openzwave lib to include it here.

This evening I could search the node js commands where you can do it. Its a good remark to your feature branch, perhaps I will extend it. Because I have also a second Spirit which is not added yet. So I also want's this adding feature inside this plugin.

@sweebee didn't find this dimmer device in list of products here: https://products.z-wavealliance.org/regions/1/categories/25/products This is always a good help to find supported devices and then their command classes. BUT in the supported projects domestic is mentioned. They also use Open-zwave-library like this plugin does. So from theory we should support this as well. :-)

redxeagle commented 6 years ago

https://github.com/OpenZWave/node-openzwave-shared/blob/master/README-mgmt.md

var OZW = require('openzwave-shared'); var zwave = new OZW(); zwave.connect('/dev/ttyUSB0'); // here you need to add the ACM0 I think

zwave.addNode(false):

Timvdv commented 6 years ago

@redxeagle Nice find! Looks promising

redxeagle commented 6 years ago

I would also try this it the same way to set the pimatic into device detection mode for 30 seconds. I think several other plugin does this in the same way.

But this helps only for new devices. In case someone has already an existing cluster of devices, here we need also to discover all existing nodes and then try to detect the device class. But could also already happend at startup of pimatic. We will see. :)