Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[veSync] 131 and Vital Purifiers base support #15296

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

dag81
Copy link
Contributor

@dag81 dag81 commented Jul 23, 2023

Adjustments to add base support for Purifiers 131 and Vital model's
Signed-off-by: David Goodyear [email protected]

This correct's support for two 131 based models. It has been tested and updated via simulations of a proven working interface PyVeSync against the payloads generated from this updated revision.

This add's support for 2 new Vital named devices - the 100S and 200S.

Corrected humidifier mode support for 2 device models, added additional validation to humidifier support to ensure the new extra pet mode is not used, and apply restrictions based on the pyvesync lib setups.

Title

  • [veSync] Improve support for PUR131 devices
  • [veSync] Add base support for Vital 100S
  • [veSync] Add base support for Vital 200S
  • [veSync] Bug fix to stop console errors when manual scanning
  • [veSync] Add warm mist level for Oasis and 600S humidifiers models
  • [veSync] Updated Oasis and 600S to use humifier mode at protocol level for Auto in OpenHab
  • [veSync] Add's support for Oasis 1000 model

Description

This is a improvement to potentially add the support of PUR131 devices. The motivation is attempting to add missing devices to complete the support of the binding across the entire range.

This also add's base support for 2 new devices the Vital 100S and Vital 200S.

Includes bug fix, after cross checking the hue binding - added check for a null bridge reference, to prevent null pointer errors appearing.

Add's updates to support writing to the warm mist channel, tested via simulations again, against the pyvesync system.

Testing

Testing for this has been done by writing a simulator that interfaces to a know good implementation PyVeSync. The simulator then allowed cross comparison of its behaviors via this one to ensure they both interact with the external system correctly. The changes in this align the support for the PUR131 devices, so that they should work. The Vital support is based on simulations as well, and a few channel's have intentionally been removed for now, until issues in PyVeSync are closed and any adjustments made, and therefore mapped to this binding. The Vital support implemented has been confirmed as working in PyVeSync looking through the testing threads.

@dag81 dag81 marked this pull request as ready for review July 23, 2023 21:07
@dag81
Copy link
Contributor Author

dag81 commented Jul 23, 2023

I suspect the checks failed due to issues outside of this PR. The initial commit passed all checks. This one only has a README.md update, and spotless:apply locally does not change the file that was committed. How can I retry the checks for the PR, to get the necessary ticks?

@dag81 dag81 marked this pull request as draft July 23, 2023 21:34
@dag81 dag81 marked this pull request as ready for review July 23, 2023 22:31
@dag81 dag81 marked this pull request as draft July 24, 2023 01:16
@dag81
Copy link
Contributor Author

dag81 commented Jul 24, 2023

Converted back to draft, as no ones assigned yet, to save adding another PR later on, for 2 more set's of devices. Please advise on the first question however - for future reference - looks like it fixed between checkin's.

@lolodomo lolodomo added the enhancement An enhancement or new feature for an existing add-on label Jul 27, 2023
@dag81 dag81 force-pushed the bindings/vesync/pur131updates branch 2 times, most recently from 0570d7b to 554463e Compare July 28, 2023 17:13
@dag81 dag81 changed the title [veSync] PUR131 Corrections [veSync] 131 and Vital Purifiers base support Jul 28, 2023
@dag81 dag81 force-pushed the bindings/vesync/pur131updates branch from 1512491 to 61038d4 Compare July 28, 2023 17:33
@dag81 dag81 marked this pull request as ready for review July 28, 2023 18:22
@dag81 dag81 force-pushed the bindings/vesync/pur131updates branch from 2eab3b3 to 4aa47e5 Compare July 28, 2023 18:54
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/vesync-levoit-binding-help-testing-requested/144175/18

@dag81 dag81 force-pushed the bindings/vesync/pur131updates branch 3 times, most recently from 43b02e1 to 78014c0 Compare July 31, 2023 13:00
@dag81 dag81 marked this pull request as draft July 31, 2023 14:41
@dag81 dag81 force-pushed the bindings/vesync/pur131updates branch 5 times, most recently from 5707696 to 240da85 Compare August 1, 2023 11:05
@dag81 dag81 marked this pull request as ready for review August 1, 2023 11:05
@dag81 dag81 force-pushed the bindings/vesync/pur131updates branch 2 times, most recently from eb2fea9 to a01cd5a Compare August 1, 2023 11:20
@dag81 dag81 force-pushed the bindings/vesync/pur131updates branch from ce90246 to 239b3d3 Compare August 6, 2023 21:48
@lsiepel
Copy link
Contributor

lsiepel commented Feb 21, 2024

@dag81 i might review this, but before that review, this PR has to build succesfull wihtout new SAT errors or warnigs. Can you sync your branches with openhab main, fix the conflicts and try to build it? Also the license headers should change to 2024.
If you need any help with those steps, please let me know.
Edit: Thing-upgrade instructison have to be added as some existings Things have channels added. See here: https://www.openhab.org/docs/developer/bindings/thing-xml.html#updating-thing-types

[veSync] protocol device id update

Signed-off-by: dag81 <[email protected]>
[veSync] protocol alignment to redundant data against pyvesync

Signed-off-by: dag81 <[email protected]>
[veSync] cleanup casting uses

Signed-off-by: dag81 <[email protected]>
@dag81 dag81 marked this pull request as ready for review November 24, 2024 19:31
@dag81
Copy link
Contributor Author

dag81 commented Nov 24, 2024

  1. Thing upgrade instructions for the added channels are mandatory for this PR.

Hi @lsiepel, Hopefully this finds you well. I was just looking through this and testing on a M4 build against the device I have, I think this likely need's to be merged asap. So will limit the clean-up's to make sure we can hopefully get this in before the cut-off - as otherwise the units switch to % with the new units model for a few bits, as this binding is a old one and my first one. Looking at it I will likely do a deeper pass on it to fully clean it all up, but figured first and most importantly the key is to have it operating like the original binding did, several releases back.
Regarding the point I've quoted - can you give an example of a binding that has these, that I can use as a reference please?

Reference to the documentation: https://www.openhab.org/docs/developer/bindings/thing-xml.html#updating-thing-types

homewizard is a binding that has these instructions.

The refactoring of this binding should be a seperate PR, als try to prevent breaking changes.

I've opened the PR as Ready, I have just got to look through this and add these bits. I did this in case you wanted to check anything else, while I add this final bit, then its open and ready, to save to time going to and fro. @lsiepel

[veSync] air purifier update instructions pass 1

Signed-off-by: dag81 <[email protected]>
[veSync] air purifier options attempt 1

Signed-off-by: dag81 <[email protected]>
[veSync] air humidifier update template base

Signed-off-by: dag81 <[email protected]>
[veSync] readme updates

Signed-off-by: dag81 <[email protected]>
[veSync] update script updates

Signed-off-by: dag81 <[email protected]>
[veSync] update script updates

Signed-off-by: dag81 <[email protected]>
@dag81
Copy link
Contributor Author

dag81 commented Nov 25, 2024

  1. Thing upgrade instructions for the added channels are mandatory for this PR.

Hi @lsiepel, Hopefully this finds you well. I was just looking through this and testing on a M4 build against the device I have, I think this likely need's to be merged asap. So will limit the clean-up's to make sure we can hopefully get this in before the cut-off - as otherwise the units switch to % with the new units model for a few bits, as this binding is a old one and my first one. Looking at it I will likely do a deeper pass on it to fully clean it all up, but figured first and most importantly the key is to have it operating like the original binding did, several releases back.
Regarding the point I've quoted - can you give an example of a binding that has these, that I can use as a reference please?

Reference to the documentation: https://www.openhab.org/docs/developer/bindings/thing-xml.html#updating-thing-types
homewizard is a binding that has these instructions.
The refactoring of this binding should be a seperate PR, als try to prevent breaking changes.

I've opened the PR as Ready, I have just got to look through this and add these bits. I did this in case you wanted to check anything else, while I add this final bit, then its open and ready, to save to time going to and fro. @lsiepel

@lsiepel

I've had a first pass at the upgrade instructions file's. I will have to test them out over the next couple of days. (If its doing what I think that's really nice - I always hated having to say sorry just remote it and re-add then it should appear). In regards to these update scripts my "interpretation" which please correct if I'm wrong, is that the systems caching at a thing id level. So its applying these to its cache used for all defined devices, on boot up, to apply the updates so the channels / updates appear.

What I'm not sure about was the options bit. I've redefined it as I suspect it overwrites whatever it has based on what's defined, so the update to add the pet mode will add it once it runs?

Finally, a few channels types are re-used between two things. As my guess / interpretation is that the system duplicates the data for each thing the instructions are for, so if a typeId is re-used, this should be updated in every thing update definition, as its keyed to those thing's in the cache. Is this correct do you know?

I'll test anyway - but if you know the answers to above that would be great just to find out if its working how I suspect, in order to ensure those instructions have precisely what is required.

I think its ready for another pass now 🤞, so will change the PR status.

Hopefully you had a good weekend, and thanks for all the help in getting these PR's through, hopefully before the next release :)

@dag81 dag81 requested a review from lsiepel November 25, 2024 00:16
[veSync] Air purifier update modifications

Signed-off-by: dag81 <[email protected]>
[veSync] Air humidifier update modifications

Signed-off-by: dag81 <[email protected]>
@dag81
Copy link
Contributor Author

dag81 commented Nov 27, 2024

@lsiepel this one is ready again when you are ready.

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, i left some comments, nothing big.

bundles/org.openhab.binding.vesync/README.md Outdated Show resolved Hide resolved
| **humiditySetpoint** | Number:Dimensionless | Humidity % set point to reach | 200S, Dual200S, 300S, 600S, OasisMist, OasisMist1000 | [30...80] | |
| warmEnabled | Switch | Indicator for warm mist mode | 600S, OasisMist | | |
| **warmLevel** | Number:Dimensionless | The current warm mist level set | 600S, OasisMist | [0..3] | one |
| errorCode | Number:Dimensionless | The error code reported by the device | OasisMist1000 | | one |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect a ordinairy DecimalType, but if it needs to be QuantityType, please also adjust the item exmaple file (it lacks the Dimensionless part)

Copy link
Contributor Author

@dag81 dag81 Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume to keep everything aligned leave these as are now? The reason they were all done as dimensionless numbers was in the original PR if I remember correctly it was requested everything had unit's, so that was the best fit.

@@ -242,14 +263,14 @@
</channel-type>

<channel-type id="deviceAFConfigAutoPrefRoomSizeType">
<item-type>Number:Dimensionless</item-type>
<item-type unitHint="one">Number:Dimensionless</item-type>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a channel that should use UoM

Suggested change
<item-type unitHint="one">Number:Dimensionless</item-type>
<item-type>Number:Area</item-type>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been updated now, and is mapping correctly.

Comment on lines 14 to 19
<update-channel id="mistLevel">
<type>vesync:deviceMistLevelType</type>
</update-channel>
<update-channel id="warmLevel">
<type>vesync:warmLevel</type>
</update-channel>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only setting the unitHint would not require update channel instructions if im not mistaken.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was trying to do that but realised it must use those when the instances are made. The only one kept is the fan mode one, as there are new options it does appear to apply with this update-channel added.

Copy link
Contributor

@lsiepel lsiepel Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if that is actually needed. But it won't harm either. I don't have the time to test now, sorry. You could look at thje json db before and after the new binding is used without performing the upgrade.
In the json db you can check if the options are cached and or if they are updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will leave in just in case. The xml definitions read like it isn't required, but it seemed to make a difference so will leave in just in case.

[veSync] PR feedback updates 1

Signed-off-by: dag81 <[email protected]>
[veSync] PR feedback updates 1

Signed-off-by: dag81 <[email protected]>
@dag81
Copy link
Contributor Author

dag81 commented Nov 27, 2024

@lsiepel - Regarding the bits about the units. That a interesting one. Everyone I've added the unitHint of "one" to, is to ensure it doesn't present the value as a % which the system now appears to do since the UoM model came into play.

Really everything that has had that unitHint added as "one" should generally be a DecimalType rather than a Dimensionless number, to sort this out. However, rather than be inconsistent in the binding I kept it as it was, as this would def. be a breaking change.

Correcting the new one I suspect would actually confuse people more? I could do the whole lot but that would break most peoples configurations at that point, and that's the primarily reason I held off updating them all adding the missing area unit. I'd rather go through them all and update if this is the correct approach and acceptable given the amount it would break config's. In this case I kept the incorrect unit for consistency with rather than implementing a sweeping breaking change.

What do you reckon - align it all with several breaking changes, or keep it consistently wrong?

@dag81 dag81 requested a review from lsiepel November 27, 2024 20:56
[veSync] PR feedback updates 2

Signed-off-by: dag81 <[email protected]>
@lsiepel
Copy link
Contributor

lsiepel commented Nov 27, 2024

While reading and thinking about your post, I came to this:
We prefer to have scoped and specific PR’s as that makes it easier to review, reduces riscs and improves the visibility in the release notes.

This PR is not only adding support for some devices but also corrects other things. While greatly appreciated, users won’t expect breaking changes to their 600 device based on the release notes title that states that it add support for 100 device.

That being said I think the breaking changes need to happen and they are relative simple to correct. If possible it is best to extract those changes to a separate PR, if that is ok with you.

[veSync] PR feedback updates 3

Signed-off-by: dag81 <[email protected]>
@dag81
Copy link
Contributor Author

dag81 commented Nov 27, 2024

@lsiepel I couldn't see how to change the state to request another pass - I think it's good for another pass to see if the changes done and not done seem sensible, whenever you are ready please have a quick look. Thank you again!!! ;)

[veSync] PR feedback updates 3

Signed-off-by: dag81 <[email protected]>
@dag81
Copy link
Contributor Author

dag81 commented Nov 27, 2024

While reading and thinking about your post, I came to this: We prefer to have scoped and specific PR’s as that makes it easier to review, reduces riscs and improves the visibility in the release notes.

This PR is not only adding support for some devices but also corrects other things. While greatly appreciated, users won’t expect breaking changes to their 600 device based on the release notes title that states that it add support for 100 device.

That being said I think the breaking changes need to happen and they are relative simple to correct. If possible it is best to extract those changes to a separate PR, if that is ok with you.

Yeah I was thinking before of doing a second pass on this one, as I can see further room to clean it up including those channel definitions. I did correct the Numer:Area one to the correct units, so I believe that's the only breaking change. All of the other's, I'll modify to basic Numbers and re-test, for a new PR. I presume this is what you're thinking as well from the comments?

P.S For some reason I only just saw this an hour after you posted it so apologies on the delay replying.

[veSync] MIST Model Updates

Signed-off-by: dag81 <[email protected]>
@dag81 dag81 force-pushed the bindings/vesync/pur131updates branch from 034e3b4 to d3abbc5 Compare November 28, 2024 02:53
@dag81
Copy link
Contributor Author

dag81 commented Nov 28, 2024

Just adding a comment since the last update. Apologies I had to force-push to over-write a mistaken push from a different local copy, used during testing. On comparing the protocol implementation ported from well over a year ago, it looks like they found some variances for the EU regional model. So this last change is to, add the bespoke behaviour for that variant, and ensure the units are identified correctly. (Another one to look at on my next refactor - cleaning up this identification behaviour further to a prioritised 2-pass approach). Behaviours verified against the spec using the simulator - so this should be fine for the Mist Humidifiers, based on the latest data available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[vesync] Levoit Vital 100s Air Purifier support
4 participants