Page 1 of 8


Posted: Mon Aug 06, 2018 7:37 pm
by kgschlosser
The long awaited Z-Wave plugin has finally arrived!!!!



ok so now that we have that out of the way. :D

There is only a single goof I have noticed thus far and I am working on fixing it. It is a mere inconvenience and nothing that stops the plugin from running. I noticed this issue with GE Dimmers. these dimmers have a max value of 99 but you can go over the 99. If you do the lights will simply not change. I do not know if this problem is more widespread then just GE dimmers. if it is please let me know.

If this plugin does not auto detect your z-stick you will need to provide me with the manufacturer, model and hardware id of your z-stick. the plugin is set up at the moment to only work with Aeon Labs 5th Gen Z-Stick. it is a very easy process for me to add other sticks to the plugin.

There are only 2 actions. a Get action and a Set action. from these actions you have the ability to control every single aspect of a zwave node (device). There are no doors that are closed. it will expose even all of the cool firmware goodies your zwave device may have available. IF YOU BRICK A DEVICE IT IS YOUR FAULT, NOT MINE. So if you do not know what it is. don't touch it before doing some research.

The Get action if run in a python script returns that piece of data you are trying to obtain. If used as an action the data will be set into eg.result for use in other actions that have parsing ability via the curly braces {eg.result}. please do not try to inform me that the Get action does nothing. It does. you are simply using it wrong. If you want to see the data returned simply add the Dump Result to Log action after the Get action and viola you data will be printed into EG's log.

I made this plugin to support more then a single z-stick being plugged into a machine. You will be given the opportunity to name that z-stick as well as set the global polling interval for all devices. you have the option of adjusting the polling interval on a per device basis using the Set action. You will have to run this action when the plugin starts for the devices you want to be different from the global.

The plugin generates an event when the network is ready. this can be used to set the polling interval or any other things on a per device bases.

If you see an event that states "AllNodesQueriedSomeDead" what this is telling you is that you either have battery powered zwave devices that are sleeping. or you have zwave devices that are apart of the network but no longer exist. I will be adding more actions for adding and removing nodes. this will be in the next few days.

The action are broken down into several drop boxes. the first one is selecting the controller. the second is selecting the room the third is selecting the node and the fourth is selecting the variable you want to set or get.

If your devices do not have a room assigned it will be in the "Not Assigned" room (how clever of me) if you have not given a device a name it is going to show the hex decimal node id. once you set the name for the device that will appear instead. In the Get action if you come across a variable you cannot change. this is because the variable is READ ONLY. or if you come across a variable that has no value but you are able to enter one that is because it is WRITE ONLY.

This has got to be by far the easiest to use z-wave interface made. I did not make use of any of the scene crap. there really is no need because EG does way more then what the devices can. couple it with the SchedulGhost plugin and the plugin for tracking sun rise and sun set and you have a nice automated system.

I am going to add some nice convenience actions for those of you that do not have dimmers that have a programmable ramping rate for zwave and manual control. it will allow a custom ramping up and down of a dimmer. this is a nice feature if you get events in EG for things like movie playback. where you want to go all out with the theater realism and have the slow ramp for playback start and stop. but if you manually press the switch the lights will operate at a normal speed. Look for this addition in the next few days as well.

I have been trying to get this to work in EG for over a year. So everyone that uses it. please the donate button is at the bottom of this post. I have spent hundreds of hours making this possible.

One other thing. This plugin is FAST. i will bet it is the fastest z-wave control software made. I have events that get generated in 10's of milliseconds from when I press the switch. I have tried mot of the software out there some don't even report a change while others take minutes to report it. This is not the case. And the speed can be tweaked depending on your network size. less important devices set at a lower polling rate. things like lights locks and security pads. go for the 1 second poll.

There are a lot of the variables in the Set action have tool tips that will explain what they are. So be sure to let that mouse hover.

This is quite the chunky plugin clocking in at 18.5MB and almost a million lines of code. most of the code has been compiled into dll's and executables. so there is not a whole lot to edit/modify. I do not plan on releasing the full source to this but this may change. It is an overly complicated build process.

so Enjoy. if there are problems follow the usual guidelines of screen shots, logs, errors, and how to replicate the problem. One of the things you have to remember there are 1000's of different zwave devices I do not own them all. so the more information you can give the better.

**Update 0.2.0b
Fixed Unhandled Exception
Fixed missing louie module
Removed debugging dll files
Added device category/subcategory to the events
Added Ramp Up action (for dimmer switches)
Added Ramp Down action (for dimmer switches)
Added network administration control panel

The ramp up and down actions have a few settings to them. you have target level, percent increases (steps) and interval (speed).
target level i think you know what that means.
percent increases is how much to change the level of the light
interval is how long to wait between changing the levels.

so how this works is it will move the level the amount you specify. then it will wait the amount of tie you specify (in fractions of a second) and it will keep on looping like this until the target level is met.

so if you want to adjust your light to 50% and you are starting off at 0% and you tell it to move the level one percent each time with a wait of 0.1 seconds it will take 5 seconds to reach the target of 50%

50 / 1 * 0.1 = 5
another example

start = 23
target = 87
speed = 0.08
percent = 2

total change 87 - 23 = 64
number of loops 64 / 2 = 32
total time 32 * 0.08 = 2.56 seconds

The total time calculations are guesstimates. The reason i state this is the zwave protocol is asynchronous. it simply sends the commands and doesn't care if the command actually made it to the device. it is hoping it did. I could have designed these actions so it would stick to the timing and simply blast the commands to the switches. There is a problem with doing this, zwave devices are not made to route information to another device while it is performing an operation. whether it be a polling update. or something on the device is being changed. it will simply not allow the command to be routed through it. this is where having more devices helps. because zwave is a mesh network there is ore then a single route to get to a device. So the command will ping pong about intil it either hits a dead end and disappears or it finally makes it to the device. while this process is taking place if i send another command and that device that was busy is no longer busy it can make it to the device before the first command. so in terms of setting light levels if we send a value of 22 and then a value of 24 and the 24 makes it there and then the 22 does we will end up with a very undesirable ramp of the light. so on each loop i verify that the value has in fact changed if it has not changed by time it reaches the interval limit it will send the command to set the same level once again and this process keeps on going until it gets a sucessfull change. If the ramp rate is slower then expected chances are that making it run faster is not going to work. You will need to reduce the network traffic a good way to do this is by not polling variables on a device that you do not use. slowing down the polling to devices that you may not need an instant update for. like HVAC or alarm sensors when the alarm is not armed. That is the beauty of this setup because you can set up all of you alarm sensors into a single macro for arming the system and have the actions for each device change the polling settings. I do not believe there is another HA system that allows you to do this. Dynamic optimization of the network speed is a huge bonus. All the HA systems I have seen allow you to change the settings but it has to be done with user intervention.

The administration control panel allows you to add nodes. remove nodes, change the role of the controller. reboot the controller. reset the network. display all kinds of network and device metrics. adjust just about everything in a single interface without the need to set up actions to do it.

**Update 0.2.1b
Created a replacement for the louie.dispatcher module. I think this may have been causing a hanging issue.
Code cleanup.
Fixed issue with node comparison example:

Code: Select all

if node_1 == node_2:
Misc Other tweaks

**Update 0.3.0b
Reworked the code that modifies the core files. It gives explicit instructions in the event of a failure. This is done through the plugin config dialog.
Added restoring the core files back to their originals upon plugin removal fro a configuration tree. and errors during this process are printed out in the log with instructions to manually restore them.

**Update 0.4.0b
Fixed bug with the folder name that stores user data being an old MSDOS reserved file name
Fixed bug where you could set the device name or the device room name as an empty string or a string with only space(s) in it.
Hard coded a room for the network controller
Hard coded the network controller name
Removed the ability to change any variables to the controller node from an action.

**update 0.4.1b
Fixed Get action
Added zooming controls to the admin panel. (a band-aide for a problem @holdestmade was having with viewing on a 4K TV)
Added admin panel persistent position, size and zoom (remembers the last values)

Started adding the network graph. still working on the display for it. This is a a hard thing to do because networks will vary based on the number of nodes. so the more nodes the larger i am making the graph. this is being done so you will be able to zoom in on the image to see what is going on. otherwise the plot can become so contested it would be impossible to make heads or tails of what is going on. And since i am making a custom control to do this i said to myself, hell why not throw another curve ball or 2 in there and make it extremely difficult. so i decided to also add panning and rotating. the rotating is because the graph is round. So it is going to be a little bit longer until i can get that finished up

***** I will be back to add the attachment. I seem to have an issue because of the max attachment file_size. LOL. compressed this bugger is now almost 14 meg

**** ok that is fixed. File is attached

**Update 0.5.0b
Added the network map.
In the config dialog for the plugin, if you look just under the header bear at the top you will see a tab that says Settings. There will be one or more tabs to the right of it if you have one or more connected z-sticks. That tab is the admin panel for the network. I added a new button "Graph Network" This button shows network node (device) relationships. Since zwave is a mesh network all hard wired devices also act as repeaters. because of this feature you have the ability to keep on adding devices that do not have direct communication with the controller. It does have a single downfall. if a device is busy it will not repeat a packet that it has been told to. so in some rare cases you can have issues with devices working properly.

as an example

if your network like like this.

You can have a problem. Something like this will occur if you have some kind of a device say in a garage. or in some kind of an out building. or possibly a gate. or if you have so much money you happen to own a home that has a ridiculously long hallway. You can have issues. They do make zwave repeaters that would forward packets all the time. it doesn't do the "I'm busy so go away" like a device will do.

This network map shows the connections between the devices. there are chords that represent these connections. the larger the cord is the lower the number of connections to other devices that device has. that is one of the things you look for. You want to make sure that the paths between devices are circular, has more then one or 2 paths data can be transmitted through to get to a device.

This map will help in optimizing your network and also tell you if you need to buy a repeater or maybe add a few more devices to make more connections.

The graph opens up in a new window. There are several things that can be done.

mouse wheel = zoom

hold left click and move mouse = panning (only if graph is larger then the window)

left double click = full screen

hold left click and scroll wheel = rendering mode - changes the pixel relationships you can see what it is set to on the bottom right of the window choices are Nearest, Antialias, Bilinear, Bicubic, Box, Hamming. This order i believe is from worst to best image quality. it also impacts memory consumption.

hold right click and scroll wheel = rotate image. for those of you that do not want to read your node names upside down/sideways

if you happen to zoom in to far you may see INSUFFICIENT MEMORY come up on the screen. you can try to zoom out. but chances are you will have to close the plugin config dialog and start over.

this is a pretty intense graph to draw so it may take a while to render. for those of you running EG on a 80386 You are probably going to be 90 years old when it gets done. Because i manipulate an image of the plotted graph instead of plotting it over and over again if you use one of the above features. it does move pretty quick.

I do not know if the modules i have included in this package will work without being built into EG. I guess we are going to find out.

**Update 0.5.3b
Improved caching of data
improved creation of node parameter objects
improved plotting of the network graph
improved control of the network graph
added popup menu to network graph - this shows the "neighbor" nodes, it also shows the number of routes it has discovered back to the controller. This is an extremely important number This is the magic number that tells you if your network needs to be optimized. optimally it should show the same number of routes as nodes in the network. unless you have battery devices then it should show the number of nodes - the number of battery devices

attempted repair of the graph. another shot i guess. I am not sure what the libpng error is all about and i do not have a clue where it is coming from.
another test to see if it will run is to install python 2.7 and key this command in at a command prompt

Code: Select all

c:\python27\scripts\pip install matplotlib
then run eventghost and see if it works.

**Update 0.5.4b
Fixes Traceback error for COMMAND_CLASS_ZWAVE_PLUS_INFO
Fixes (hopefully) Traceback when unplugging the ZStick while EG is active

**Update 0.5.5b
Fixes traceback when getting group information.
I am still working through bugs in the groups portion of the plugin.

**update 0.5.6b
Fixes import traceback problems.
I believe I have finally fixed the issue with the "Graph Network" not working.

Re: Z-Wave

Posted: Wed Aug 08, 2018 3:17 am
by yokel22

Re: Z-Wave

Posted: Wed Aug 08, 2018 1:08 pm
by holdestmade
Got this error so added louie:

Code: Select all

Error loading plugin file: C:\ProgramData\EventGhost\plugins\ZWave
Traceback (most recent call last) (WIP-2018.06.03-12.44.49):
  File "C:\ProgramData\EventGhost\plugins\ZWave\", line 43, in <module>
    from louie import dispatcher # NOQA
ImportError: No module named louie
Then on adding plugin:

Code: Select all

Error loading plugin file: C:\ProgramData\EventGhost\plugins\ZWave
Traceback (most recent call last) (WIP-2018.06.03-12.44.49):
  File "C:\ProgramData\EventGhost\plugins\ZWave\", line 44, in <module>
    from zwave_network import ZWaveNetwork # NOQA
  File "C:\ProgramData\EventGhost\plugins\ZWave\", line 35, in <module>
    import libopenzwave # NOQA
  File "libopenzwave_source\libopenzwave\libopenzwave.pyx", line 73, in init libopenzwave
  File "logging\__init__.pyc", line 1298, in addHandler
SystemError: error return without exception set

Re: Z-Wave

Posted: Wed Aug 08, 2018 2:18 pm
by kgschlosser
Im a dong dong!!

I thought louie was in the EG std lib. I will add it.

and the exception thing is what I have been fighting with for over a year. I wasn't thinking and I added the file replacement in the plugin's __init__ statement but I am importing the dll at the module level. so DUH!! on me.

i will have it fixed in a jif.

Re: Z-Wave

Posted: Wed Aug 08, 2018 4:38 pm
by kgschlosser
Bah! Sorry guys I didn't manage to get this fixed before I had to go to the doctors. Which is where I. Sitting now. Well I did fix it. Then I did something and corrupted the egplugin file which is where I made the changes. So I have to redo them. The version I have is not complete. I just added a really big chunk of code to it. Better handling of variables and what zwave class the variable belongs to. Also speed up the plug-in some more and improved polling performance. I now cache the variable metrics instead of constant querying for it. I added a large section that gives better event naming instead of "Node" for a device and "Network" for a network event. All items that can attach to a zwave network now have a category and subcategory and that is what is used in the event.

I added the ramping actions for the dimmers.
I also added a whole network configuration dialog. I added a tab in the plugin config dialog for each zstick that you have attached. It gives a tree view of the whole network all nodes, variables, and settings. I added buttons for zstick factory reset, zstick reboot, add node, remove node, remove failed node, rebuild network, transfer primary, send sync data, receive sync data.

I am still working out the kinks in that last addition.

If you can hang tight until this evening I can fix this bug and release all those updates at the same time.

Re: Z-Wave

Posted: Thu Aug 09, 2018 7:29 am
by kgschlosser
OK i fixed that bug. and I think I have most of the kinks ironed out of the network administration panel as well. There is a whole slew of things you can do with that panel.

I am trying to keep this simple to use as possible. That is the reason why I am not making specific actions for the different device types. How zwave networks work is simply by changing variables. so by simply providing a way to change any and all variables for a specific device it keeps everything wide open for the user to pick and choose what they want to do.

On another note. I had mentioned that bug with the dimmer level. It is not a bug. It is a really dumb way the protocol API is for multilevel switches. The max and min values that can be obtained from the devices are exactly that. a max and a min. it does not mean this is the real boundaries for setting the variable. As in my case it gives a min of 0 and a max of 255 for the level. but the level variable does nothing above 99 or so I thought. If i set the level to 255 and the level was at 0 when i did this it will return the dimmer to the previous level it was at before it was set to 0. So the level variable can take from 0-99 and 255 so that is how the min and max are derived..

I did add those ramping actions for the dimmers. i did this because there are folks that do not have the ability via the firmware on the dimmer to have a manual ramping speed and a zwave ramping speed. or some switches simply stick you with whatever the mfg wanted to do.

For those of you that do have the ability to adjust the manual ramp rates (manual means if you physically push the button on the switch) you now have the means to adjust these rates Via EG actions. I can only think of a single reason to use this feature. but it has to be hands down one of the best features. slowing down how fast the light will turn on in a bathroom after a specific time of day. and change it back to operating normally in the AM. I can't imagine there is a single person that likes getting blinded by the bathroom light when you simply want to go and make a deposit. I blame this happening on my wife. I know that i don't always remember to press and hold the switch in my 1/2 awake state. Now i won't have to worry about it at all. I can slap the button and instead of it shooting up it will move nice and slow allowing my eyes to adjust.

The newest version is attached to the first post.

Re: Z-Wave

Posted: Thu Aug 09, 2018 8:00 am
by holdestmade

Getting this error and sometimes EG crashes and closes down when trying to add the plugin, I've tried a blank config file and running as admin:

Code: Select all

Error loading plugin file: C:\ProgramData\EventGhost\plugins\ZWave
Traceback (most recent call last) (WIP-2018.06.03-12.44.49):
  File "C:\ProgramData\EventGhost\plugins\ZWave\", line 44, in <module>
    from zwave_network import ZWaveNetwork # NOQA
  File "C:\ProgramData\EventGhost\plugins\ZWave\", line 35, in <module>
    import libopenzwave # NOQA
  File "libopenzwave_source\libopenzwave\libopenzwave.pyx", line 73, in init libopenzwave
  File "logging\__init__.pyc", line 1298, in addHandler
SystemError: error return without exception set

Re: Z-Wave

Posted: Thu Aug 09, 2018 8:12 am
by holdestmade
Just thought maybe I better plugin my USB Z-wave stick !

This appeared in the log:

Code: Select all

---> Welcome to EventGhost <---
EventGhost has found devices on your system, that can be 
handled by the following plugins and are not loaded by your
current configuration:
   - ZWave
If you want to use them, please add the missing plugins.
Still cant add the plugin though

Code: Select all

Error loading plugin file: C:\ProgramData\EventGhost\plugins\ZWave
Traceback (most recent call last) (WIP-2018.06.03-12.44.49):
  File "C:\ProgramData\EventGhost\plugins\ZWave\", line 44, in <module>
    from zwave_network import ZWaveNetwork # NOQA
  File "C:\ProgramData\EventGhost\plugins\ZWave\", line 35, in <module>
    import libopenzwave # NOQA
  File "libopenzwave_source\libopenzwave\libopenzwave.pyx", line 73, in init libopenzwave
  File "logging\__init__.pyc", line 1298, in addHandler
SystemError: error return without exception set

Re: Z-Wave

Posted: Thu Aug 09, 2018 8:14 am
by kgschlosser
I was still adding the new version to the first post. I had a lot to type up.

It is there now. so give it a try again.

Re: Z-Wave

Posted: Thu Aug 09, 2018 8:18 am
by kgschlosser
And i forgot to tell you about another feature.

There is no need to shutdown EG or disable the plugin if you want to use the zstick to add devices. simply unplug it from the USB press the button. go and learn the device. and plug the bugger back in. I built the plugin to handle having the stick unplugged and plugged without the need to restart/reset anything. it will take care of everything behind the scenes.

Re: Z-Wave

Posted: Thu Aug 09, 2018 11:45 am
by holdestmade
Sorry was a bit keen

I deleted the louie module I had

Get this error when adding plugin:

Code: Select all

Error loading plugin file: C:\ProgramData\EventGhost\plugins\ZWave
Traceback (most recent call last) (WIP-2018.06.03-12.44.49):
  File "C:\ProgramData\EventGhost\plugins\ZWave\", line 44, in <module>
    from louie import dispatcher # NOQA
  File "C:\ProgramData\EventGhost\plugins\ZWave\louie\", line 33, in <module>
    import louie.dispatcher, louie.error, louie.plugin, louie.robustapply, \
ImportError: No module named louie.dispatcher

Re: Z-Wave

Posted: Thu Aug 09, 2018 11:46 am
by holdestmade
If I leave the louie module I have downloaded in the site packages folder, EG just hangs...

Re: Z-Wave

Posted: Thu Aug 09, 2018 7:05 pm
by yokel22
same here, locks up on adding plugin.

Re: Z-Wave

Posted: Thu Aug 09, 2018 9:19 pm
by kgschlosser
ok I created a replacement for louie. It is no longer used.

also try running EventGhost as Administrator if it locks up. it could have something to do with the file replacement. I know that Window 10 behaves very differently in respect to the program files (x86) folder compared to earlier versions of windows. I do not know if you are using Windows 10 or not. but for the hell of it give it a shot. try it first without and see what happens. I think the issues could have been caused by the louie module that is why i created a replacement.

new version is attached to the first post

Re: Z-Wave

Posted: Thu Aug 09, 2018 9:33 pm
by jachin99
I had to restart, and add the plugin a few times but I got it added to my tree without errors. I haven't attached my ZStick yet though. The ability to NOT have to stop the service to add devices is a GREAT thing btw. Great stuff as always!!