Add mashumaro for typing of the devices #32
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Okay so this is an interesting one.
In this PR I am adding mashumaro to make sure we type all the device data we get. The big benefit is that this is typed, which means we can accidentally request data from a device it doesn't have. We become a bit more wary about what data we receive and what data we have, instead of just receiving it and passing it through.
The downside of this, is that we now need explicit support for every device we want to use. But the benefit that will have is that we will have more real life test data when adding a new device, so we ensure that the API still works as expected.
This extra abstraction layer helps us to iron out little details switchbot put in their API, like the
00000000
or the same deviceId ashubDeviceId
.I think before we can release this we need to make sure we collect all the devices we currently support. And I will work on a home Assistant proof of concept to show the full picture