lukasroegner / homebridge-dyson-pure-cool

Plugin for using the Dyson Pure Cool fans in homebridge.
MIT License
294 stars 51 forks source link

Support for the pure cool link #2

Closed Krocko closed 5 years ago

Krocko commented 5 years ago

Any chance to use your plugin with the pure cool link?

lukasroegner commented 5 years ago

Have you tried other plugins that support the pure cool link fans? Some plugins require your Dyson account credentials, some use a password that is written on a sticker on the device itself, can you tell me which method the pure cool link devices use?

Krocko commented 5 years ago

At the moment i use this plugin https://github.com/joe-ng/homebridge-dyson-link It is using mqtt i think. The plugin is working good for me, but i like that your plugin show the device as air purifier.

lukasroegner commented 5 years ago

I contributed to this project and I've also been using the plugin for my devices. However, it is designed to use some sort of blocking calls (i.e. if the devices are not responding instantly, the whole home bridge setup keeps showing "Updating..."). That's the main reason I wrote my own plugin that is more agnostic to networking issues.

Have you provided serial number and password for each of your devices or did you leave them out and just used the Dyson account credentials?

Krocko commented 5 years ago

I have provided serial number and password.

lukasroegner commented 5 years ago

I'm tending to write a separate plugin for the pure cool link devices, as 50% of the code of this plugin handles communication with the Dyson API.

Provided that I find some free time to work on a new plugin, could I contact you to test things out and help me with the data format the pure cool link devices use (seems quite similar to the new ones, however, some states are named differently)?

Krocko commented 5 years ago

That would be awesome! Sure i am happy to help.

lherlitz commented 5 years ago

I’d be happy to test this as well!

rp1989 commented 5 years ago

+1 - Happy to test this as well

ifeign commented 5 years ago

Any progress on this? I recently had my Dyson disconnect and knock out my entire Homebridge setup. I'd like to avoid running multiple Homebridge instances.

ukypayne commented 5 years ago

Also willing to help test this out.

Some very basic testing...

Editing the index.js and adding model 475 to the array 'platform.config.supportedProductTypes = ['438', '475', '520'];`

and then in the model name section

'switch (accessory.context.productType) { case '438': model = 'Dyson Pure Cool Tower'; hardwareRevision = 'TP04'; break; case '475': model = 'Dyson Pure Cool Link'; hardwareRevision = 'TP02'; break; case '520': model = 'Dyson Pure Cool Desk'; hardwareRevision = 'DP04'; break; } '

has brought data from the API into the log.

UPDATE - actually the TP02 did end up in my Home app. I was just in the wrong room when it auto-generated.

I do get an error in the log saying "cannot read property '1' of undefined". I don't have time to look into it more ATM, but log post is attached. Dyson Log.pdf

Krocko commented 5 years ago

Hello @lukasroegner. Any news?

ifeign commented 5 years ago

@ukypayne looks good, hopefully this means it's a simple matter

lukasroegner commented 5 years ago

@ukypayne Thank you so much for the log. Can you also provide a log for the other message types (this line in the code logs all MQTT messages: https://github.com/lukasroegner/homebridge-dyson-pure-cool/blob/583419a063ab052b4309f64b91e8a08e69715776/index.js#L551)?

The following types exist:

If I have samples for all those types, it should be super easy to add support for the TP02...I assume that the messages for the DP02 are actually the same.

lukasroegner commented 5 years ago

I finally managed to work on the project. Please use the development branch (you can install plugins via NPM by providing a GitHub URL, the branch name can be provided by a trailing #development) to try out support for the TP02. If anyone of you has a DP02, please provide the last part of your serial number (which is the model number), so that I can add it to the plugin.

All questions that arose are marked with a TODO comment in the code (index.js). I hope that I can fix all remaining issues if you provide logs of the messages that the plugin receives from the devices (see previous comment for types of messages).

Krocko commented 5 years ago

Hi Lukas. I installed the development branch. I got the following error:

Aug 12 19:33:13 raspberrypi homebridge[8097]: TypeError: Cannot read property 'removeCharacteristic' of undefined
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at DysonPureCoolPlatform.configureAccessory (/usr/local/lib/node_modules/homebridge-dyson-pure-cool/index.js:536:9)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at DysonPureCoolPlatform.addAccessory (/usr/local/lib/node_modules/homebridge-dyson-pure-cool/index.js:292:12)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at Request._callback (/usr/local/lib/node_modules/homebridge-dyson-pure-cool/index.js:215:18)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at Request.self.callback (/usr/local/lib/node_modules/homebridge-dyson-pure-cool/node_modules/request/request.js:185:22)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at Request.emit (events.js:203:13)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at Request.<anonymous> (/usr/local/lib/node_modules/homebridge-dyson-pure-cool/node_modules/request/request.js:1161:10)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at Request.emit (events.js:203:13)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/homebridge-dyson-pure-cool/node_modules/request/request.js:1083:12)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at Object.onceWrapper (events.js:291:20)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at IncomingMessage.emit (events.js:208:15)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at endReadableNT (_stream_readable.js:1168:12)
Aug 12 19:33:13 raspberrypi homebridge[8097]:     at processTicksAndRejections (internal/process/task_queues.js:77:11)
lukasroegner commented 5 years ago

@Krocko Updated the branch, there has been a bug in the fallback code that removed unnecessary characteristics. Please install again.

Krocko commented 5 years ago

Now it is working. But it looks really strange in the Home App. The labels are missing and some switches are missing.

But in the EVE app all options are available.

lukasroegner commented 5 years ago

@Krocko see #1

Can you provide the logs of the raw messages that the device sends? The following questions have to be solved:

Krocko commented 5 years ago

Here are some screenshots from the Dyson app:

And here is the log with the triggered states:

Dyson.log.txt

lukasroegner commented 5 years ago

@Krocko thank you so much. I'll work through the log.

Krocko commented 5 years ago

Thank you for working on this.

lukasroegner commented 5 years ago

@Krocko New version is on the development branch:

Can you tell me if you can correctly control the device from within the Home app?

Krocko commented 5 years ago
  • Changed filter life calculation (please check if percentage in the Home app is equal to the one in the Dyson app)

The Dyson app is showing 85% and the Home app is showing 84%

Can you tell me if you can correctly control the device from within the Home app?

It is possible but really difficult because of #1. And in the single device view i don't have the speed slider.

lukasroegner commented 5 years ago

The Dyson app is showing 85% and the Home app is showing 84%

Do you still have the manual or the box of the device, maybe the filter life in hours can be found there. Should be around 12*360=4320 hours. Maybe it is 4300 hours, which would result in 84,8% in your case.

Krocko commented 5 years ago

Yes you are right.

lukasroegner commented 5 years ago

@Krocko Thank you for your support, the new version is on the master branch and on NPM.

ukypayne commented 5 years ago

Great work! There is some way that you can have labels with the switches so it isn't as unclear with iOS 13. There are some other apps that have multiple switches and I can check to see what the coding difference is. If I have the time/knowledge I can possibly do a pull.

lukasroegner commented 5 years ago

@ukypayne Please comment in #6 for layout issues with iOS13. I do not understand your question as iOS13 > Beta 5 shows small labels for switches and they are named after the accessory name