Closed davet2001 closed 3 years ago
This looks great to me. Could it even be externalised into a configuration file, so new sensors don't even need code change to be supported?
Hey @davet2001 , sure I would love to have an improved source layout!
I am working on this now. Starting with some pytests so that I can verify the layout change later doesn't break something.
Ok, PR is ready for someone to review/approve it.
I just merged the changes. Thanks a lot to @davet2001 !
Can someone test the current master so I can prepare a new release?
Can close
I have been looking at https://github.com/padelt/temper-python and thinking of ways to support more sensors more easily, specifically to make it easier for people to contribute.
Currently there is a lot of logic looking at the product identifier spread through the driver. I assume it has evolved this way rather than intended from the start.
I would like to propose something like this:
Essentially, this defines the details of each sensor type in one place, then the rest of the driver uses that information, firstly when interrogating the device type, then when reading from it. It makes the rest of the file much simpler and smaller.
Before I work on this in more detail and submit a PR, do you support this approach?
Dave