ckamps / hubitat-driver-ha7net

Hubitat Drivers for HA7Net and 1-Wire Devices
0 stars 1 forks source link

Implement concurrency management #3

Closed ckamps closed 4 years ago

ckamps commented 4 years ago

Support concurrency management by requesting a lock of the 1-Wire bus from the HA7Net at the start of each operation. See the HA7Net User's Manual and Programmer's Guide for details.

ckamps commented 4 years ago

Analysis of HA7Net Concurrency Management and Locking Support

It appears that for most of the operations supported by these drivers, explicit HA7Net concurrency management is not needed and indeed not even supported by the HA7Net.

The one HA7Net interface currently used by these drivers that supports passing lock IDs is the /1Wire/Search.html interface. Other, higher level interfaces that are used by these drivers including /1Wire/ReadHumidity.html and /1Wire/ReadTemperature.html do not appear to support passing lock IDs.

It is believed that for these higher level interfaces, the HA7Net performs its own concurrency management as it carries out multiple actions on the 1-Wire bus for each invocation of the higher level interface.

Further, it is believed that when multiple requests for higher level interfaces occur, the HA7Net will queue them until either the currently executing higher level action has completed or a lock obtained by a client is either released or expires.

I have an outstanding email support request to the folks at EDS to confirm these understandings.

Recommended Enhancements

Given this understanding, it's recommended that the parent driver be enhanced to support concurrency management and locking when using the /1Wire/Search.html interface.

Additionally, since the multiple timeouts have occurred per day in at least one deployment of these drivers and the default HA7Net lock timeout value is 60 seconds, it's recommended that users of these drivers reduce the lock timeout value to 5 or so seconds.

ckamps commented 4 years ago

This issue will be left open until confirmation of the assumed locking behavior is received from EDS support.

ckamps commented 4 years ago

Per EDS support:

When you’re using the HA7Net’s “High-Level” interfaces to read 1Wire devices (Temperature.html in this case), you don’t need to worry about concurrency management on the 1-Wire bus, because as designed, the HA7Net’s high level interfaces handle that internally. i.e., when the HA7Net begins to process a high level request, it insures no other requests will touch the 1Wire bus until that high level request is complete. This is why we didn’t add support for the LockID parameter on the high level urls.

Which pretty much confirms what I was thinking.

Closing out this issue given that locking has been implemented for the Search interface, the only interface that the drivers currently use that supports the lock I’d.