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

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

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

Conversation

Ulrar
Copy link

@Ulrar Ulrar commented Dec 12, 2022

This adds support for the Dyson Pure Hot+Cool Formaldehyde (527K).

This depends on shenxn/libdyson#36.
This solves #167

@Ulrar
Copy link
Author

Ulrar commented Dec 12, 2022

I've added a second commit fixing the class and unit of the formaldehyde sensor, which were not being seen by HA as a measurement class. Feel free to reject that second commit if that was setup that way on purpose, but I suspect it wasn't intentional.

@dustingrady
Copy link

dustingrady commented Dec 21, 2022

Great work! Hoping to see this merged soon. Been waiting for Formaldehyde sensor support for my TP09 :)

@Ulrar
Copy link
Author

Ulrar commented Dec 21, 2022

It should be easy to apply this (and related PR to libdyson) by hand on your system in the mean time, if you don't want to wait

@dustingrady
Copy link

dustingrady commented Dec 21, 2022

It should be easy to apply this (and related PR to libdyson) by hand on your system in the mean time, if you don't want to wait

It seems I get the following. I've seen others with this in the issues section.

Platform not found (cannot import name 'DysonPureHotCoolFormaldehyde' from 'libdyson' (/usr/local/lib/python3.10/site-packages/libdyson/init.py)).

@Ulrar
Copy link
Author

Ulrar commented Dec 21, 2022

Yeah you need to patch your libdyson with the content of that PR first, the code here depends on the lib already supporting the fan

@dustingrady
Copy link

dustingrady commented Dec 21, 2022

Yeah you need to patch your libdyson with the content of that PR first, the code here depends on the lib already supporting the fan

Gotcha, thank you. I made that change and the error is gone, but I do not see the HCHO sensor appear. I made sure the changes I added from your diff are in my sensor.py and that manifest.json points to the new lib like your previous comment. I've tried reloading the device and rebooting HA. Maybe I missed something.

Guessing maybe the isinstance isn't picking up my TP09. I'll have to see where the model info is stored so I can change it if is incorrect

Update: @Ulrar it seems it was the isinstance since mine is a DysonPureCoolFormaldehyde and doesn't have heat. After importing that and adding an isinstance check for it, it's working as expected. Thanks again, and Happy Holidays!

@Ulrar
Copy link
Author

Ulrar commented Dec 22, 2022

Ah yes, that's a different device.
If you know what code it is (get_devices.py says it) we could always add it to the PRs, should be easy enough

@dustingrady
Copy link

@Ulrar , I get libdyson.exceptions.DysonInvalidAuth when trying to use get_devices.py, similar to this post. I have a Dyson Pure Cool Formaldehyde TP09.

Modifying your changes to the following allow me to see the HCHO readings in HA that match my TP09

from libdyson import (
    Dyson360Eye,
    Dyson360Heurist,
    DysonDevice,
    DysonPureCoolLink,
    DysonPureHumidifyCool,
    DysonPurifierHumidifyCoolFormaldehyde,
    DysonPureHotCoolFormaldehyde,
    DysonPureCoolFormaldehyde,
)
if isinstance(device, DysonPurifierHumidifyCoolFormaldehyde) or isinstance(
            device, DysonPureHotCoolFormaldehyde) or isinstance(
            device, DysonPureCoolFormaldehyde):

I'm not sure what the best way to add it is since you have a PR pending. I can branch from your branch, or you can add, either way :P

@Ulrar
Copy link
Author

Ulrar commented Jan 3, 2023

Ah sorry, completely missed this.
Looking here it sounds like the product code might be 438E, does that sound right ?

Ideally you wouldn't just use this PR as is, since your device doesn't have heating, but we can add another instance without heating for that product code, assuming that's the right one.

@TerrorSource
Copy link

@Ulrar i have a HP09, got the serial and the credentials via libdyson.
I've downloaded dyson-local, did the changes to the sensor.py manually, restarted HA.
When i try to add the device i get "Failed to connect".

How can i solve that?

@Ulrar
Copy link
Author

Ulrar commented Jan 6, 2023

Have you made the changes to libdyson as well?
There's two PRs, one for the HA integration and one for the underlying libdyson, both are needed

@dustingrady
Copy link

dustingrady commented Jan 7, 2023

Ah sorry, completely missed this.

No worries.

Looking lukasroegner/homebridge-dyson-pure-cool#225 it sounds like the product code might be 438E, does that sound right ?

Yes, that is correct. I've been using the changes I mentioned above without issue for a couple weeks now.

@TerrorSource
Copy link

@Ulrar @dustingrady do you also use HomeAssistant? Cause i cant find the libdyson folder in HomeAssistant, i've done the changes in dyson-local files.

@Ulrar
Copy link
Author

Ulrar commented Jan 8, 2023

Yeah but I don't use Hass OS so I can't talk to it, I just use the docker container.
Have a look in the other PR, there's discussions about this

@TerrorSource
Copy link

I have created a fork of libdyson and added the code of @Ulrar into the fork so everyone can use it directly untill the maintainer of dyson-local merges Ulrar's code

source = shenxn/libdyson@6a8ed5c#diff-ef0658f150dc67e06f245eb9a355b958562f9f9cc24c8360f3e8c54417b7c3c2

In HomeAssistant edit /config/custom_components/dyson_local/manifest.json
replace the content with this:
{ "domain": "dyson_local", "name": "Dyson Local", "config_flow": true, "documentation": "https://github.com/shenxn/ha-dyson", "issue_tracker": "https://github.com/shenxn/ha-dyson/issues", "dependencies": ["zeroconf"], "codeowners": ["@shenxn"], "requirements": ["git+https://github.com/TerrorSource/libdyson.git@main#libdyson==0.9.1"], "version": "0.16.4-4", "iot_class": "local_polling" }

Restart HomeAssistant and add the Hot+Cool Formaldehyde via local method

@dustingrady
Copy link

Is the main project we're branching from still supported? I haven't seen any merges recently by the author.

@dotvezz
Copy link

dotvezz commented May 1, 2023

Support for both 527K devices (Formaldehyde and non-Formaldehyde) has been implemented on https://github.com/libdyson-wg/ha-dyson and https://github.com/libdyson-wg/libdyson-neon

@dustingrady sadly, while we're grateful for shenxn's building of the foundation, they are no longer active. the ha-dyson fork has been created to continue development of these projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants