gwww / upb-lib

Universal Powerline Bus library - interacts with UPB PIMs
MIT License
4 stars 2 forks source link

Configure tx_count and the heartbeat timeout via flags #6

Closed mag1024 closed 2 years ago

mag1024 commented 2 years ago

tx count of 2 seems to be required for the devices on my network to respond. I don't know for sure, but I suspect it is related to the presence of a repeater. I found this oblique reference in the some repeater documentation that corroborates this theory:

UPStart normally uses uni-packet transmissions to communicate to UPB™ devices however, once the TPR is added to the network, it will automatically switch to using multi-packet transmissions. UPStart indicates that it has switched to two-time multi-packets by displaying TX=2 in the status bar.

While I was at it, I also added the ability to configure the heartbeat timeout for TCP as requested in #5. It was also triggering for me spuriously.

Closes #5

gwww commented 2 years ago

Thanks! I'm reviewing the code now.

How have you tested these changes?

Are you planning on updated the config_flow in HA with options? If so, please use the current values for TX and heartbeat as the default.

mag1024 commented 2 years ago

I tested by running a local Home Assistant instance with a hacked up upb integration -- I guess I'll need to upstream those changes as well. Seems like these kind of parameters might be better off as an Options rather than a Config flow. Either way will keep the tx count defaulting to 1 -- and won't expose the deadline explicitly at all. Might just make a "flags" text box.

gwww commented 2 years ago

Sounds good. Options is right on. I'm OK if you just expose TX count. Probably should not expose flags as a general field is my sense. I'll look some more at the code over the weekend... no time to review right now. If you get started on the option(s) in HA I'll see that code too. Thanks again!

gwww commented 2 years ago

Thanks!

gwww commented 2 years ago

I just published 0.5 to PyPi. I have reviewed the code and seems OK. I'm not in a position to test the on my UPB network until later this week, so I relying on you to test.