shenxn / libdyson

Python library for dyson devices
Apache License 2.0
64 stars 41 forks source link

Adding support for 527K - Dyson Pure Hot+Cool Formaldehyde #36

Open Ulrar opened 1 year ago

Ulrar commented 1 year ago

This adds support for the Dyson Pure Hot+Cool Formaldehyde (527K), all the sensors and functions are working.

This solves https://github.com/shenxn/libdyson/issues/31. This should IMHO supplant https://github.com/shenxn/libdyson/pull/30 which is missing the actual formaldehyde sensor.

I will also open a related PR in the HA dyson integration to make use of this sensor. Feel free to change whatever in here of course, this is the code I'm now running myself but happy to take suggestions / improvements !

javempt commented 1 year ago

Hi @Ulrar,

How did you point the home assistant add on to your updated library? I am having no luck - everything I try still points to the original library.

Thanks! :)

kitprice commented 1 year ago

Modify your manifest.json file by changing the requirements to:

"requirements": ["git+https://github.com/Ulrar/libdyson.git@main#libdyson==v0.8.12"],

javempt commented 1 year ago

Modify your manifest.json file by changing the requirements to:

"requirements": ["git+https://github.com/Ulrar/libdyson.git@main#libdyson==v0.8.12"],

legend, thank you so much!!!!!!

kitprice commented 1 year ago

Note: this might break if the libdyson version tag actually gets upgraded to v0.8.12 without the PR and the integration is updated. If that's the case, just keep the version pointed to a higher revision than what is actually in release.

dmrichards26 commented 1 year ago

Is there anything you need to do after updating the requirements to download the new version of the library?

I've modified /config/custom_components/dyson_local/manifest.json with the change you listed above, and restarted home assistant, but it still doesn't seem to be applying the changes (don't see the new device type in the integration setup dropdown).

I tried hard reloading the HA UI in case it was a caching issue, but no luck.

Thanks in advance.

kitprice commented 1 year ago

Is there anything you need to do after updating the requirements to download the new version of the library?

Be sure to delete the integration (Settings->Devices & Services), then add it back again. If you just try to configure it again, it is using the same installation as before.

shesmer commented 1 year ago

Any updates on this?

TerrorSource commented 1 year ago

Works! Please merge @shenxn

petrkotek commented 1 year ago

Friendly ping (looks like a few of us are looking forward to use this!)

dotvezz commented 1 year ago

Since @shenxn has been inactive for several months, I'm working on creating forks to supplant this repo and the ha- repos. Feel free to go check it out in the interim: https://github.com/libdyson-wg - and if anyone's interested in joining the organization so we have more than one maintainer, let me know! That'd be awesome.

Anyway, the reason I'm here in this comment section. I was working on merging the commits from these PRs and noticed there's a naming conflict on the Device Type. I just wanted to confirm: The get_devices.py script pulls "Device Type" straight from the Dyson API - does it report your Formaldehyde model as a Device Type: 527K.

Reason being, it reports my non-Formaldehyde model as the same:

Serial: X3V-US-[REDACTED]
Name: Dyson Purifier Hot+Cool™
Device Type: 527K
Credential: [REDACTED]

If that's the case, and Dyson is just being weird with these product type codes now, we'll probably want to find a new way to instantiate your new Formaldehyde class. As it stands, the logic here is perfectly sane, but if there really is a conflict then it would also try to pull formaldehyde readings from my incompatible model.

Ulrar commented 1 year ago

Hey @dotvezz,

That's awesome, I've been toying with the idea of doing it myself for a while but I don't think I'd have enough time, great to see someone else take it on !

Yes, get_devices.py does indeed return 527K for my formaldehyde hot+cool. That said when you add the integration you can choose what model it is, so as long as the name is descriptive I think that's okay, it might be slightly confusing but hopefully easy to fix for people.

TerrorSource commented 1 year ago

@dotvezz great idea. I’m not a programmer myself by I can still contribute as I own the 527K so if you create a new version or something needs to be tested with the model I own I can do it

charlie969 commented 1 year ago

Thanks @dotvezz , I'm also happy to test! I have an HP07 which I am currently struggling to get connected, as described here

dotvezz commented 1 year ago

@charlie969 getting my HP07 working is the whole reason why I started down this rabbit hole. Happy to report that it does actually work on my fork! Not HACS-ready yet, but maybe by the end of today - I'll make a note to post a comment to your linked issue when it's ready for you.

charlie969 commented 1 year ago

@dotvezz That's awesome! I've just started my Home Assistant journey, and the Dyson is the only device I've struggled to get connected. Looking forward to testing this out when it's ready!

dotvezz commented 1 year ago

Formaldehyde support for all relevant devices has been added on https://github.com/libdyson-wg/ha-dyson and https://github.com/libdyson-wg/libdyson-neon, which are new forks that are actively maintained and easy to migrate to from shenxn's repos