Onewire update interval & caching

Hi,

when discussing PR55921 (Adding support for another onewire device, a question about latency came up.

For binary onewire sensors there might be a need for updating their state in almost real time. For instance, they might be used to detect open doors and windows. In such a scenario, a maximum latency of about 2 seconds is desirable I believe.

To make this possible, I was thinking about offering two additional things to the user:

  1. Make scan_interval adjustable for the onewire platform (via yaml config)
  2. Add an uncached config option (boolean) for onewire sensors.

I’m interested in your opinions!

Also mentioning @epenet as code owner.

1 Like

I think the main issue is that owfs uses polling not push (Classifying the Internet of Things - Home Assistant). As far as I’m aware, push is not available on owfs, regardless of the library used to communicate with it.

Regarding the scan_interval and uncached options, both might be useful but should be disabled by default. Depending on the number of devices connected to the bus, it might overload the bus…

You might also be interested in this thread where someone is planning to use a more async way to talk to owserver: WIP: Replacing onewire with an owserver-based library - #20 by frederickjh

I agree. Onewire devices don’t support push as they need to be explicitly polled by a master device.

Regarding the different ways to set config values: what would be the best way to make optional config entries so the user can decide on a per-entity basis? I’m a bit puzzled looking at config flows vs. yaml.

I’ve checked the link you provided: while there’s certainly some good stuff in there worth considering I think HA’s onewire implementation is in a pretty good shape right now.

I’m really not sure how to set the scan interval per entity. You might wish to discuss it on discord with the core devs.