Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Official 5.2 Beta Discussion Thread
I finally figured out what was going on, but that revelation required that I really go back and do a fairly wholesale rework of how I'm dealing with msgs. The whole security thing makes it really awkward. I just now got the changes rebuilding. I'll test them tomorrow. I'm getting a bit punch drunk here, which also contributed to my making a dumb decision that it took me probably an hour just to undo.

It's much different from the old ZW drivers, in that outgoing messages have to go through a couple of stages, and we can't just wait around while they do that, so there's a lot more tracking of states, and that's complicated by having to do retries. But, by moving it to that sort of scheme, now the encryption stuff can be well hidden away, and the main code doesn't need to be involved in getting nonces or doing encryption or decryption at all. It just has to say, I want this msg sent secure, or I expect this message to have come in securely.

For the more general case (the security class itself if sort of half secure and half not due to bootstrapping issues, so manual decisions have to be made) I'll set it up so that units can just call a method and say, is my so and so class marked secure, and that will return the flag to pass in to the msg sending methods. That way, it's driven by the unit configuration files very cleanly. Some devices of that type may secure a given command class and another may not, so that way there'll be no hard coded decisions on that front.

I'm sure I introduced a lot of errors during that huge rework, but I'll bang through them tomorrow and I think I'll be good to go now.
Dean Roddey
Software Geek Extraordinaire
Reply
I'm sooo close, but something the master controller isn't happy about. It seems to through the whole process totally happy-like, but it times out after a while saying that I didn't respond properly. I'm till trying to figure that out, but it's driving me batty. The master bumps the unit id each time I exclude and re-include it. It's currently at 95 (hex, which is 149 decimal.) So I've done 149 attempts over the last few days.

But the basic msg I/O architecture is obviously working now, and I've got my trace logging well refined which helps a lot with finding issues.
Dean Roddey
Software Geek Extraordinaire
Reply
Oh well still nothing. I'll pick it back up tomorrow.
Dean Roddey
Software Geek Extraordinaire
Reply
What a day. I spent the entire day building ever more elaborate machines that failed in ever more spectacular fashion. About an hour ago I gave up and went back to where i was this morning, made one change and it just worked. It's showing up in Vizia with a lock on it.

I think that the whole time it was waiting for me to send it my manufacturer id info at the end. Until I sent that it didn't consider the process complete for some reason. I have no clue what was going on there most of the day, but it was a train wreck pretty much.

Now I have to go back and implement many of the very good changes I made during the day, slowly and making sure that none of them break it again in the process. The stuff I did today was clearly making it closer to how it needs to be, but somewhere along the line I must have made some mistake that I just couldn't see.
Dean Roddey
Software Geek Extraordinaire
Reply
So I'm starting to see what was the issue. I just misunderstood something fairly fundamental. There's a lot of 'callbacks' involve in the Z-Wave API. Since it's just a serial connection it's not literally a callback as it would be if it was really code running down inside a Z-Wave unit. So 'callback ids' are used to match up the response to the request.

Managing these callback ids is messy so I wanted to centralize it in the outgoing message class. I was just setting one on each outgoing msg of a type that defines such a parameter, among those being the msgs sent to other modules. But, it turns out that, if you set the callback id but there's no callback coming (because of one not being asked for by the sender of the message), the Z-Stick just waits for that callback and times out.

So that was killing me. One type of callback is asking the receiving other module to send an ack that he received the message. That's optional and you don't always want to do it, so it's indicated by the sender of the message. I wasn't using them before but I wanted to add support for those where they were useful, and that's when I put in the centralized callback id stuff. That was causing any message that got sent that had nothing coming back to do a long timeout. And there are other scenarios. The start replication msg takes one, then end replication doesn't, etc...

Oy! It's sort of a fragile system and I've been going through and making sure I'm doing the right thing on any messages sent. So I'm now going through the whole inclusion/replication process, but with just some weirdness on my end that I need to figure out.
Dean Roddey
Software Geek Extraordinaire
Reply
So a friend passed me some of this guy's videos. He's just a ridiculous funk bassist with very unusual techniques.

https://www.youtube.com/watch?v=by4o9GJZrWw
Dean Roddey
Software Geek Extraordinaire
Reply
Well howdy doodah day, I finally have it. I can consistently now join the network securely with no glitches. So, I need to do a little work wrt to automatically allowing more generic unit handler classes to decide whether any given class' commands should be sent securely, and to add the querying of secure command classes to my little info file gatherer, then I can get the lock added and work on a generic lock handler and that should prove for sure-like that I can do secure stuff.

So, I guess the reason for the above is that the code in the Z-Wave units can only handle one thing at a time. I thought 'thing' meant send one message at a time. So you always wait for the low level response that tells you the hardware controller has sent the last message before you send another. But, apparently that means an entire transaction, which includes the response if a callback id is provided. Another thing I worked out, which didn't exist back when I did the first one, is that if an async message comes in just after you send a message but before the controller has sent you the 'I sent it' response, you will get a cancel command. So you have to read the current message and acknowledge it, and then send your command again. So that's a 'thing at a time' as well, passing along an incoming msg to the driver and getting the acknowledgement back that it was received. So it has to cancel the outgoing message because that would be two things at once in his view.
Dean Roddey
Software Geek Extraordinaire
Reply
OK, I'm good to go tomorrow on adding the lock support and using the security stuff in anger. If that goes well, then the rest is downhill from here. A long slope, but downhill, at least as best I can tell how.
Dean Roddey
Software Geek Extraordinaire
Reply
I got the lock out and got it added, and I can't talk to it. It's probably something to do with beaming I think. I don't know if I am responsible for doing something special to enable beaming. There are some a couple example systems out there and they don't seem to do anything. They get the information about it being a beaming device because it reports itself as non-listening, so you have to check is it listening or is it beaming, and either means you can talk to it. And they use it for that purpose. But they don't seem to do anything to enable beaming support or the like.

There's nothing in any of my docs about it. Partly that's because my docs are out of date. They released the command class interfaces (the messages you can send t another device) but not the 'how to be a node on the network' stuff. I realized this sort of late in the process, but have managed to bull my way through it so far.

But if I try to talk to it, it just ignores me. Vizia can lock/unlock it, so clearly it's alive. So I'm kind of stuck again.
Dean Roddey
Software Geek Extraordinaire
Reply
Well, I hate to say it, but all of this work may have gone for nothing. I just can't figure out the beaming stuff. I'm assuming that's what it is at least. Everything else works fine.

I sent a question asking what is the least expensive scenario for a company like ours (who just needs the documentation and nothing else) to get access to that stuff these days. I'll see what the answer is. If it's $300 I do it. If it's still $3000, that's not likely.
Dean Roddey
Software Geek Extraordinaire
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Official 5.2 Beta Release Thread Dean Roddey 9 1,188 09-14-2017, 05:49 PM
Last Post: Dean Roddey
  Official 5.1 Beta Discussion Thread Dean Roddey 453 38,366 05-16-2017, 03:45 PM
Last Post: Dean Roddey
  Official 5.1 Beta Release Thread Dean Roddey 28 4,472 05-12-2017, 05:44 PM
Last Post: Dean Roddey
  Official 5.0 Beta Discussions Dean Roddey 2,019 108,425 11-09-2016, 04:34 PM
Last Post: Dean Roddey
  Official 5.0 Beta Release Thread Dean Roddey 15 6,273 11-01-2016, 10:32 AM
Last Post: Dean Roddey
  How to obtain Beta versions? willsauter 3 1,011 07-15-2016, 04:57 PM
Last Post: willsauter
  Official 4.7 Beta Release Thread Dean Roddey 21 6,527 04-23-2015, 04:20 PM
Last Post: Dean Roddey
  Official 4.7 Beta discussion thread Dean Roddey 295 28,769 04-23-2015, 04:19 PM
Last Post: Dean Roddey
  CQC hangs (latest beta) Bugman 7 2,049 11-19-2014, 05:03 PM
Last Post: Bugman
  4.6 Official Beta Discussions Thread Dean Roddey 514 33,712 11-04-2014, 03:57 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)