libdyson-wg / ha-dyson

Home Assistant custom integration for Wi-Fi connected Dyson devices
MIT License
228 stars 26 forks source link

In manual add, no option for PH03 units, only PH01 and PH04 #7

Closed kddude closed 1 year ago

kddude commented 1 year ago

I have a PH01 and a PH03 unit, both called "Pure Humidify+Cool", but they have different Device Types from each other. PH01:358, and PH03:358K.

When manually adding a unit, there are dropdown options for "Pure Humidify+Cool", and "Pure Humidify+Cool Formaldehyde". The former corresponds in the code to 358, and the latter to 358E.

I am able to successfully add my PH01 unit without issue because it is a 358, which works when selecting "Pure Humidify+Cool", but when I try to add my PH03 I get an error like this:

{"type":"form","flow_id":"f1848c43c17a5a7094dfc020bf8cd1d9","handler":"dyson_local","step_id":"manual","data_schema":[{"type":"string","name":"serial","required":true,"default":"(serial)"},{"type":"string","name":"credential","required":true,"default":"(credential)"},{"type":"select","options":[["N223","360 Eye robot vacuum"],["276","360 Heurist robot vacuum"],["438","Pure Cool"],["438K","Purifier Cool"],["438E","Pure Cool Formaldehyde"],["520","Pure Cool Desk"],["475","Pure Cool Link"],["469","Pure Cool Link Desk"],["527","Pure Hot+Cool"],["527E","Pure Hot+Cool (New)"],["455","Pure Hot+Cool Link"],["358","Pure Humidify+Cool"],["358E","Purifier Humidify+Cool Formaldehyde"],["527K","Purifier Hot+Cool"]],"name":"device_type","required":true,"default":"358E"},{"type":"string","name":"host","optional":true,"default":""}],"errors":{"base":"cannot_connect"},"description_placeholders":null,"last_step":null}

I have tried selecting "Pure Humidify+Cool" and "Pure Humidify+Cool Formaldehyde" and both produce the same error.

I've tried connecting the device via. the cloud project as well, and while it discovers it and shows it available to configure on my Devices page, it still returns the same error when attempting to add the discovered device.

Would it be possible to add support for 358K units? If not, is there a workaround I can use in the mean time to manually send the type as 358K?

dotvezz commented 1 year ago

Hi @kddude! sorry for the slow reply here.

This is related to a funky problem with Dyson's product codes and how libdyson uses them to identify devices. You're unfortunately impacted by this. The short version is, the K-suffixed product codes can represent Formaldehyde and non-Formaldehyde devices. (~E-suffixed product codes are exclusively formaldehyde as far as I've seen so far~ edit: BOTH K and E seem to apply to both Formaldehyde and non-Formaldehyde models).

Since 358K hasn't yet been configured in libdyson, I'm adding it and cutting a new release of it and this integration. It should get you (and anyone else who has the same issue) up and running, but it isn't a complete fix because someone else might be unlucky enough to have a Formaldehyde unit with the K product code.

The new release should be available by the time you see this comment, but if it isn't, feel free to check HACS for an update to version v0.17.1 by restarting your Home Assistant. The release is here: https://github.com/libdyson-wg/ha-dyson/releases/tag/v0.17.1

Let me know if you have any issues/questions!

dotvezz commented 1 year ago

If you're curious about the Formaldehyde effort, I haven't documented it terribly well yet but there's some information in this PR comment over on the libdyson-neon repo: https://github.com/libdyson-wg/libdyson-neon/pull/7#issuecomment-1501923127.

And for more fun, there's even a user in this other PR (https://github.com/libdyson-wg/libdyson-neon/pull/5#issuecomment-1502018811) that has BOTH the 358K and 358E and they're both "Purifier Cool+Humidify Formaldehyde" apparently.

Anyway I'm just frustrated with Dyson for the inconsistent name collision here. But definitely working on long-term solutions!

kddude commented 1 year ago

Hey, thanks for getting back and pushing this! I'm testing it right now and am not finding success, so I'm trying to determine if libdyson isn't getting properly installed in my HA instance or if this section I commented on is causing it. Any thoughts?

I'm trying to implement the fix myself in my fork for testing but am having trouble getting HASS to download my updated libdyson-neon.

Definitely a frustrating experience dealing with all the similar names and numbers and naming inconsistencies, I get it! Thanks for your work on this

dotvezz commented 1 year ago

Hey, great catch on the other pull request. I've added the missing K and released a new version. Look for 0.17.2 this time! Let me know if it continues to not work though!

kddude commented 1 year ago

Looks good in the code! I don't think you pushed a release, however, so I used main and it's working :) Thanks for your work on this!

dotvezz commented 1 year ago

Cool deal! I wonder what went wrong with the release last night. I must have forgotten to click the "Publish" button or something. It's up now if you decide to switch back to the normal releases: https://github.com/libdyson-wg/ha-dyson/releases/tag/v0.17.2

Closing this issue, and I'll make sure to take better care about releases in the future :sweat_smile:.