Z-Wave

Questions and comments specific to a particular plugin should go here.
User avatar
kgschlosser
Site Admin
Posts: 4026
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Z-Wave

Post by kgschlosser » Thu Aug 09, 2018 10:10 pm

ok when you say restart. you had to restart your PC? or EG?.

when you first install the plugin it is going to tell you that EG needs to be restarted. this is due to py.exe pyw.exe and python27.dll getting replaced with ones that have compiled by me with some coded added to fix a bug that was not allowing me to compile the zwave dll using Cython and also not allowing a Cythonized module to run. This is something we are not going o have to worry about in the future I do plan on adding it as a pull request on EG's repo as soon as the author of Stackless builds and releases it.

if you can give me more detail as far as the install process for the plugin it would be most helpful. This way i can fix it if it is broken.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 491
Joined: Sat Feb 13, 2016 8:39 pm

Re: Z-Wave

Post by jachin99 » Thu Aug 09, 2018 10:16 pm

I had to restart EG which, like you said is mostly normal. What was strange is that after restarting, the plugin didn't show up so I had to add it, then restart again two or three times before EG loaded with the plugin. I wasn't paying close attention but I do remember that much.

User avatar
kgschlosser
Site Admin
Posts: 4026
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Z-Wave

Post by kgschlosser » Thu Aug 09, 2018 10:29 pm

OYE vay!!!


It tells you in the log that you need to restart EG.

I guess i really should do something a little better with how that whole thing is done. instead of throwing an exception have it complete the installation of the plugin. and then post a dialog letting the user know that they need to restart EG to get the plugin to work.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4026
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Z-Wave

Post by kgschlosser » Fri Aug 10, 2018 12:46 am

OK i revamped the code that modifies the core so there is a really visible set of instructions.
I also added restoring the files back to their originals if the plugin gets deleted from the tree.

update is on the first post.
If you like the work I have been doing then feel free to Image

User avatar
yokel22
Experienced User
Posts: 237
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Z-Wave

Post by yokel22 » Fri Aug 10, 2018 2:48 am

nevermind, just forgot to install gen5 drivers on different pc. Network found fine with gen5 stick. Kicks back this debugging error about bad path name for dynamic port #. COM6 is the correct port.

Code: Select all

   Plugin: ZWave
      22:23:41: 0 MainMessageReceiver: timeout TriggerEventWait
        File "threading.pyc", line 774, in __bootstrap
        File "threading.pyc", line 801, in __bootstrap_inner
        File "threading.pyc", line 754, in run
        File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 280, in __MainLoop
          self.__DoOneEvent()
        File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 261, in __DoOneEvent
          self.__PumpWaitingMessages()
        File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 287, in __PumpWaitingMessages
          while PeekMessage(byref(msg), 0, 0, 0, PM_REMOVE):
        File "C:\Program Files (x86)\EventGhost\eg\Classes\MessageReceiver.py", line 127, in WindowProc
          res = handler(hwnd, mesg, wParam, lParam)
        File "C:\Program Files (x86)\EventGhost\eg\Utils.py", line 427, in LogItWrapper
          eg.PrintDebugNotice(funcName + argString)
        File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 163, in PrintDebugNotice
          sys.stderr.write(" ".join(strs) + "\n")
        File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 70, in write
          log.Write(data, ERROR_ICON)
        File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 240, in Write
          wx.CallAfter(self._WriteLine, line, icon, wRef, when, eg.indent)
        File "wx\_core.pyc", line 16772, in CallAfter
        File "wx\_core.pyc", line 8410, in PostEvent
        File "C:\Program Files (x86)\EventGhost\eg\Classes\MessageReceiver.py", line 127, in WindowProc
          res = handler(hwnd, mesg, wParam, lParam)
        File "C:\Program Files (x86)\EventGhost\eg\Utils.py", line 427, in LogItWrapper
          eg.PrintDebugNotice(funcName + argString)
        File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 163, in PrintDebugNotice
          sys.stderr.write(" ".join(strs) + "\n")
        File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 70, in write
          log.Write(data, ERROR_ICON)
        File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 240, in Write
          wx.CallAfter(self._WriteLine, line, icon, wRef, when, eg.indent)
        File "wx\_core.pyc", line 16772, in CallAfter
        File "wx\_core.pyc", line 8410, in PostEvent
        File "C:\Program Files (x86)\EventGhost\eg\Classes\MessageReceiver.py", line 127, in WindowProc
          res = handler(hwnd, mesg, wParam, lParam)
        File "C:\Program Files (x86)\EventGhost\eg\Utils.py", line 428, in LogItWrapper
          return func(*args, **kwargs)
        File "C:\Program Files (x86)\EventGhost\plugins\System\PowerBroadcastNotifier.py", line 254, in OnPowerBroadcast
          source=self.plugin
        File "C:\Program Files (x86)\EventGhost\eg\Classes\EventThread.py", line 151, in TriggerEventWait
          traceback.print_stack()
      Error starting plugin: ZWave
      Traceback (most recent call last) (0.5.0-rc4):
        File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginInstanceInfo.py", line 192, in Start
          self.instance.__start__(*self.args)
        File "C:\ProgramData\EventGhost\plugins\ZWave\__init__.py", line 799, in __start__
          network = Network(str(comport), **z_sticks[comport])
        File "C:\ProgramData\EventGhost\plugins\ZWave\__init__.py", line 121, in __init__
          os.mkdir(user_config_dir)
      WindowsError: [Error 267] The directory name is invalid: u'C:\\ProgramData\\EventGhost\\ZWave\\COM6'
I tried manually creating the folder. Something about having "COM" in the folder name that Windows doesn't like. I can't create "COM6", but i can create "CO6". Weird.

Can you add Aeotec's 4th gen zstick?
gen4.jpg

User avatar
kgschlosser
Site Admin
Posts: 4026
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Z-Wave

Post by kgschlosser » Fri Aug 10, 2018 5:40 am

are you on windows 10??


It doesn't matter. because I gave the ability to name the network i can use that name for the user config files instead of the com port. this is a better solution anywho because if you plug your zstick into a different USB port windows will assign it a different com port. so your user data would not follow the zstick,

I am going to do one better. I am going to do a bit more poking about to see if i can grab the serial number of the zstick using WMI (which is how i am grabbing the com port) and I will use that as the identifier and not even show the user the com port. So if you change the USB port on the PC even tho it is on a different com port the network will still fire back up without any user interaction.
If you like the work I have been doing then feel free to Image

User avatar
yokel22
Experienced User
Posts: 237
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Z-Wave

Post by yokel22 » Fri Aug 10, 2018 5:42 am

Win7 x64.

holdestmade
Experienced User
Posts: 129
Joined: Thu Dec 04, 2014 2:44 pm

Re: Z-Wave

Post by holdestmade » Fri Aug 10, 2018 7:40 am

Same here with the COM directory, plugin installs great now though.

Found this:
The error code "The specified device name is invalid" appears if you try to name a folder with a name which is a restricted MSDOS device name.

MS-DOS Device Driver names cannot be used as file names in Windows. As a result, we are unable to name folders as con, aux, nul, etc.

Microsoft MS-DOS had reserved these names for these system device drivers.

CON : Keyboard and display
PRN : System list device, usually a parallel port
AUX : Auxiliary device, usually a serial port
CLOCK$ : System real-time clock
NUL: Bit-bucket device
A:-Z: : Drive letters
COM1 : First serial communications port
LPT1 : First parallel printer port
LPT2 : Second parallel printer port
LPT3 : Third parallel printer port
COM2 : Second serial communications port
COM3 : Third serial communications port
COM4 : Fourth serial communications port

User avatar
kgschlosser
Site Admin
Posts: 4026
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Z-Wave

Post by kgschlosser » Fri Aug 10, 2018 9:31 am

i found out why it is doing that BTW. the Windows API is written wrong.

It states that the following filenames are reserved

CON, PRN, AUX, NUL
COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9
LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9

It does not state folder name.

But anywho i changed it so it uses the network name that is provided by the user. It is going to parse the network name for illegal characters. which are
<, >, :, ", /, \, |, ?, *
and characters in the ordinal range 0-31 which are ASCII control characters and not human readable.


I also added a network scanning routine when a network is first added. this allows specific bits of information to be loaded. so it scans the network. stops the network saves the data. apply's the data and then restarts the network. I know this is goofy. but it works.

I also fixed a couple of glitches in the admin panel. things like setting the room name to a blank or a space. and same goes for a node name.

in the admin panel you have the ability to rename tree items. so click an item and then click again to edit the label. (not a double click). You are not allowed to change the name on all items. but most of them yes...

I added a hard coded "room" this is for housing the network controller. you are not allowed to change the network controller's name or it's room name. I did this intentionally for support purposes. it makes it easier on me.

give me a moment and i will add the new version that is fixed
If you like the work I have been doing then feel free to Image

User avatar
yokel22
Experienced User
Posts: 237
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Z-Wave

Post by yokel22 » Fri Aug 10, 2018 11:30 am

Take your time. I'm just trying to help work out initial bugs.

holdestmade
Experienced User
Posts: 129
Joined: Thu Dec 04, 2014 2:44 pm

Re: Z-Wave

Post by holdestmade » Fri Aug 10, 2018 4:17 pm

SO far mostly working.

Network added OK, door sensor and power switch added OK

Changes to the nodes appear i the log

GET works fine with the variables I tried.

SET has a little issue, When I fill the 1st 4 fields in I get this error:

Code: Select all

Traceback (most recent call last) (WIP-2018.06.03-12.44.49):
  File "C:\ProgramData\EventGhost\plugins\ZWave\__init__.py", line 1383, in on_prop
    for nod in network.nodes.values():
AttributeError: 'NoneType' object has no attribute 'nodes'
And as you can see there is no way to input "new value". If I press Test anyway, the switch does switch off.

Image

SET does work fine in a script:

Code: Select all

eg.plugins.ZWave.Set('ZWAVE', 'Office', 'Socket', 'Switch', 1)
Looking great though and works very quickly !

User avatar
kgschlosser
Site Admin
Posts: 4026
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Z-Wave

Post by kgschlosser » Fri Aug 10, 2018 6:26 pm

I found a couple more bugs.. well typos to be specific I am fixing them and I am also adding a pretty cool feature. it is going to show where your zwave network has bottlenecks. This is going to be a handy thing to let you know if you need to add a range extender to improve network performance.

zwave mesh networks are designed so that every hard wired device is also a range extender , so to speak.

so each device has neighbors that it can forward network packets to. these neighbors are devices that are within range. so if you have a switch in your media room and 2 floors up in your master bathroom you have another switch. these 2 devices would not be neighbors. if your zstick is in your media room and you have a single switch in your kitchen on the first floor. but on the 3rd floor you have 10 switches. well the 10 switches on the 3rd floor are not going to be neighbors of the zstick 2 floors down. however they will be neighbors of the one in the kitchen and so will the zstick. so anything you want to sent up to the rd floor would have to be routed through that kitchen switch. now if the kitchen switch is in the middle of doing something then any packet that needs to get sent to the 3rd floor will never make it there. because the kitchen switch is busy it will simply ignore whatever is coming into it.

This is why it is so very important to have a proper mesh network layout and not have any bottlenecks/congestion. A good rule of thumb is if you think a specific section of your house can have 5 different zwave actions going on at the same time. whether it be getting an update from the switch or sending a command to the switch. possibly a sensor reporting it's state then you need to have at least 10 routes from any of those devices back to the controller.

This thing i am doing up is going to give you the ability to analyze this. It is going to give you the ability to optimize either through the use of range extenders. adding additional devices maybe a simple rebuild of the network (RF is a very dynamic animal) or even set the routes manually.

I am going to institute some sort of an automatic network rebuid. where the user would be able to set specific parameters like so many actions/events being fired off in a specific duration of time into a region of the network and have it calculate the number of connection and give a warning about network oprimization and possibly even have it run a network rebuild if the user wanted.


The only issue with this is it is some very large plotting calculations. and EventGhost ram use jumps up to 250 meg. I am trying to figure out how to get it to come back down after generating the layout.


Here is an image of what I am talking about.
node_layout.png
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4026
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Z-Wave

Post by kgschlosser » Fri Aug 10, 2018 6:28 pm

I have fixed the issue with Set i still have to release it. I am also adding some new things as you can see. so when i am done with that the update will be posted.

You did find the administrative control panel yes?? It is in the plugin config dialog. look at the tabs you should see Settings and then your com port. I am going to change the comport out to the network name.
If you like the work I have been doing then feel free to Image

holdestmade
Experienced User
Posts: 129
Joined: Thu Dec 04, 2014 2:44 pm

Re: Z-Wave

Post by holdestmade » Sat Aug 11, 2018 7:44 am

Ok, great about SET.

Yes the control panel is cool, renaming and organising rooms and seeing all the variables I didn't know where available or controllable is great.

I can see lots of scripts coming and moving most of my zwave devices from smartthings (I finally dumped my Vera)

Thanks for work on this plugin.

Slightly off topic but, as I noticed it in this plugin dialog, is that I get a black bar across the bottom of the window. I have found it is when I have my 4k monitor dpi set to 150%. It's fine at 100% (although hard to read). Not important as I can resize the window and able to see everything in the window.

User avatar
kgschlosser
Site Admin
Posts: 4026
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Z-Wave

Post by kgschlosser » Sat Aug 11, 2018 8:01 am

ok ladies I am not to far off from another release. this one is going to have the Set action repaired. I am also going to add in that visualization of the network. I feel that it is extremely important to have an optimized network and being able to see the connections is going to be a great help.

The graph I am using is called a Chord graph. It is extremely expensive to plot. It uses up alot of memory. I am still working on how to clear the memory after it has been plotted. EG's memory consumption jumps from about 60 megs to 360 megs when plotting this graph. I have managed to get the use down to 120 megs after the image has been plotted. I am not sure what is staying resident. I am going to have to poke about and see what I can find out. and locate a way to free the memory.

Here is a final image of the graph.
node_layout.png
Pretty snazzy I think. If you had to look at the code that draws this silly thing you would go cross eyed. The curved text as a bit of a bitch. and to have 2 lines of it and make them fit in the spaces properly. I can't even begin to tell you how many time i have plotted this graph. it's more then one i will tell you that LOL.

this is how it works. the space on the graph that is allocated for each node is identical in size. that space if divided by the number of neighbors the node has. so the more neighbors the thinner the chords (ribbon) that represents the connection. This makes it pretty simple to identify the nodes that have a small number of connections. Simply follow the thick lines. the color is going to align with the node that has the lower number of neighbors. So if you have Node A, color is yellow and has 8 neighbors, one of the neighbors is Node B which is blue and has 6 neighbors the color of the connecting chord is going to be Blue.

I would love to be able to show the flow of data packets through the network on this graph. I need to learn more about the lower layers of the network to see if this can even be done.

I have not yet tested to see if I am even going to be able to bring the libraries over into the plugin that are needed to show this graph. if I am not then you will have to install python 2.7 and install the modules into that python (EG will load the modules from it). or if you ask really really really nicely i might build a version of EG that has them installed into it. we will see how things go.
If you like the work I have been doing then feel free to Image

Post Reply