View Full Version : ELK M1G Development Driver - Counter Polling
wuench
02-19-2010, 05:58 AM
Attached is a modification to the Elk M1 driver based on 2.0 to allow for the polling of counters. I have done limited testing on this, so YMMV.
In current versions of the Elk firmware counters do not send asynchronous updates when they change. The current Elk driver (2.0) prefers to rely on asynch notifications due to the slowness of polling for the data. Counters seem especially slow to return data when polled. So the downside of this driver may be poorer driver performance overall. It will take around 5-8 seconds for a counter to be updated once changed by the Elk.
The counters will only be updated manually by setting the UpdateCounters field to True.
Attachments are the packaged drivers in CQC 3.1 format and the raw driver and manifest files.
Ron Haley
02-19-2010, 05:53 PM
Thanks wuench - great news. How often are you polling?
wuench
02-19-2010, 08:00 PM
I am not sure exactly, I added it to the existing poll for custom values. It is around 5-10 seconds.
gacevich
02-20-2010, 02:53 AM
what types of things are you counting? i haven't found the need to use ELK counters, so i'm interested in what functionality i'm missing. thanks.
wuench
02-20-2010, 05:01 AM
I mostly use it for my sprinkler setup. But the key is that counter changes can be used to trigger Elk rules whereas custom values can't. There is a common config for sprinklers where a counter is used to determine which sprinkler zone is on so the next one can be triggered, so you can trigger them sequentially.
You can always use phantom outputs for binary triggers, but if you need a rule that triggers on <number> is greater than/less than x counters is the only way to do it.
Also be aware that unlike custom values, counters are reset to 0 whenever you restart the M1. So keep that in mind so you don't have rules triggering when you restart the M1 that you may not want to. With the current Elk driver, counters are only updated when the driver starts and whenever CQC writes a counter. If the Elk updates a counters, CQC doesn't know it, this driver fixes that.
Ron Haley
02-22-2010, 08:26 AM
Attached is a modification to the Elk M1 driver based on 2.0 to allow for the polling of counters. I have done limited testing on this, so YMMV.
In current versions of the Elk firmware counters do not send asynchronous updates when they change. The current Elk driver (2.0) prefers to rely on asynch notifications due to the slowness of polling for the data. Counters seem especially slow to return data when polled. So the downside of this driver may be poorer driver performance overall. It will take around 5-8 seconds for a counter to be updated once changed by the Elk. To help with the performance, you should only set the amount of counters needed when loading the driver, the more counters you set the more it will slow down driver polling.
Attachments are the packaged drivers in CQC 3.1 format and the raw driver and manifest files.
Really appreciate you doing this. It's been a problem for me for a long time.
What's the process of installing this? I'm running the ethernet connection to the Elk. Also, will it overwrite the current 2.0 driver. i.e. I just install it with same name Tag as the 2.0 driver?
wuench
02-22-2010, 10:35 AM
I changed the name so it won't overwrite anything. (Plus you can't really overwrite system drivers, they would just show up as duplicates). You will see a driver with -DEV in the name.
If you delete your old driver and install the new one with the same moniker, it will pick up your client driver config. If you change the name the client driver config won't copy over.
So just import the package, delete the old driver, install the new one with the same moniker. And you should be good.
Ron Haley
02-23-2010, 04:23 PM
Installed and seems to be working great!
Thanks again!!!
Ron Haley
02-24-2010, 09:29 AM
OK, a problem. I use the elk to control my UPB switches. It now takes 8-11 seconds for CQC to respond that the the light has changed state. I have 40 counters. I'm not using counters in the UPB code. So the counters seem to be slowing everything down. I'm on a gigabit net. For my app, I'd be happy if the counters only updated when I did a read from CQC.
wuench
02-24-2010, 01:30 PM
Yep, that's the drawback I was expecting. I noticed some slight delay too when the poll gets triggered, I am using maybe 4 counters. And that problem is all Elk. It takes forever to respond with counter values for some reason.
The delay is going to be directly related to the number of counters you use. That's why I mentioned only programing in the number of counters you need.
The only thing I could do is push out how often it polls, but then your counters won't update as often. And if you have a lot of them it's still going to go away for a long time, just less often.
Let me take a look maybe I can at least make it configurable.
Ron Haley
02-24-2010, 07:54 PM
The other possibility is to make it so that it only sends counter info when you directly request it. e.g. On a preload etc. Like you, I'm using counters for sprinklers, and need the counter info for display. I also input the daily ET, which then updates the moisture levels in the Elk, which in turn is used to determine when to water. I need to be able to read the counter prior to updating it.
Ron Haley
03-02-2010, 01:49 PM
Any further thoughts?
wuench
03-02-2010, 02:58 PM
Yeah, I can probably do both, allow you to configure the poll interval and manually poll. I just haven't had time to work on it.
Ron Haley
03-03-2010, 05:40 AM
No probs. Manual works great for me. Can do a read during preload or load. If only Elk had updated their protocol, and added stickies to counters.
Ron Haley
03-20-2010, 12:57 PM
When defining counters in the driver installation, it looks like if you say 5, it's 0-4. Do you think we could define 27-31?
wuench
03-21-2010, 09:24 AM
That's not something I setup, it is from Dean's driver update. What it really needs is for counters to be added to the Elk client side driver next time Dean makes a pass at it, like all the other items.
wuench
04-19-2010, 02:37 PM
OK, new driver update. Now you can only update manually via by setting UpdateCounters to True. If you want to update automatically, you can create a scheduled event to do it at an interval of your choosing.
Ron Haley
04-25-2010, 06:29 PM
OK, new driver update. Now you can only update manually via by setting UpdateCounters to True. If you want to update automatically, you can create a scheduled event to do it at an interval of your choosing.
Can you explain a little more. Update counters is where?
Thanks
wuench
04-25-2010, 07:13 PM
The UpdateCounters field, set it to True to trigger an update.
Ron Haley
04-26-2010, 08:17 AM
Thanks - I presume this will update all counters specified at the time of installing the drivers. Do I need to set it to false after the update, or is the command of setting it to true triggers a one off update?
wuench
04-26-2010, 10:50 AM
Yeah, you just set it to True and it will poll all the counters you have configured in the initial install. It is a write only field. No need to set it to false or anything.
Ron Haley
04-27-2010, 08:14 AM
Yeah, you just set it to True and it will poll all the counters you have configured in the initial install. It is a write only field. No need to set it to false or anything.
It works great - thanks!
Zanthic
07-16-2010, 08:21 AM
I was just trying out the counter functionality (thanks for adding this!) and have noticed something a little odd. You can change the counter value to anything except zero. When you send zero, CQC thinks its changed but it doesn't really. Looking at the log, it appears that the command is going out properly but I noticed when sending non-zero you get a cv command back but when sending zero you don't.
Also, just as a warning to others, using the internal counters inside the ELK rules is pretty flaky, and maybe not coincidentally, there are issues with setting the value to zero!
vBulletin v3.5.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.