thoukydides / homebridge-homeconnect

Home Connect home appliances plugin for Homebridge
https://www.thouky.co.uk
ISC License
142 stars 15 forks source link

Dryer / Washer / WasherDryer power and remote start #3

Closed Nastras closed 4 years ago

Nastras commented 4 years ago

Hello, thank you very much for the great plugin. I think a lot of people have been waiting a long time for it. I have a question because it is not clear to me.

Is it possible with your plugin and the Dev API to turn a washing machine or dryer on and off? What about the remote start, can it be activated?

Thanks.

Best Regards

thoukydides commented 4 years ago

Is it possible with your plugin and the Dev API to turn a washing machine or dryer on and off?

Washer/Dryer appliances only have an "On" state. See:

If you mean starting a program then that can be supported theoretically, but is not currently implemented within this plugin. Given that you have to physically load the appliance this doesn't seem particularly useful...

What about the remote start, can it be activated?

Remote start needs to be enabled on the appliance itself. This is read-only via the API:

Nastras commented 4 years ago

Thanks for the quick answer.

That you can turn on the machine but not turn it off makes no sense in my eyes. But this is not because of your plugin but because of the API. I almost thought about the remote start. If I see it right, the integration of washing machine and dryer in HomeKit doesn't really make sense because of the API.

I will try it anyway and thank you again!

thoukydides commented 4 years ago

That you can turn on the machine but not turn it off makes no sense in my eyes. But this is not because of your plugin but because of the API.

Quite a few things about the API do not make any sense. For example, Fridge/Freezer appliances generate the same notification for both doors, indicating that a door has been opened or closed but not which one.

I almost thought about the remote start.

Remote start might have been useful for oven appliances, e.g. to start preheating. However, for some reason control of ovens and hobs isn't allowed without a special agreement. Even if it was, the fact that the remote start only remains enabled for 24 hours means that it wouldn't work much of the time.

If I see it right, the integration of washing machine and dryer in HomeKit doesn't really make sense because of the API.

I think the main use would be to trigger automations, e.g. to flash a light when the program finishes. That should work with the current version of this plugin.

Nastras commented 4 years ago

Somehow BSH makes their devices quite unsmart with their own api.

Glad you see it the way I do 😁

thoukydides commented 4 years ago

I have just added experimental support for starting/stopping programs (CoffeeMaker, Dishwasher, Dryer, Washer, and WasherDryer) or monitoring which programs are active (Oven). This is in version 0.8.0.

See issue #1 for some details.

@Nastras please let me know whether this works with your appliances.

Nastras commented 4 years ago

Cool that you keep working on the plugin. Thanks. Unfortunately I can't test it right now because I don't have a dev account. During registration an error occurred and I get a message that the account is blocked. I have opened a ticket but haven't received an answer yet. I think it is because of the holidays. As soon as I have the possibility I will test it with pleasure.

I'm sorry 😔

Nastras commented 4 years ago

Hello, now I have access to my developer account 🎉

I have installed your plugin and tested it with my washing machine.

  1. programs: are displayed 👍

  2. I get an error from the plugin in the log. The error is displayed again even after a restart of the homebridge.

0459240C-801D-4BED-B9BE-DF5B3BEE4D09
  1. I noticed that via Ifttt it is possible to turn off the washing machine or dryer. I am surprised that it is not possible via the API? 250F322D-C7BC-4B69-8DB7-AF675EFBDE1C

  2. in the Eve app a programmable switch is shown on the device. Why should it be? 50B9912D-F9C5-48D6-A932-8ED7BC1A2E41

In the HomeDash App, values are displayed to me as manufacturer specific without exact designation. Can you change this or is it the app? 727E89F3-5E56-4355-9C6D-A468B31E5180

Thank you!

Nastras commented 4 years ago

Hello, another error has occurred overnight:

2EBDCAF9-E3A0-4644-8767-ABC9E08C57D6

I have to tell you that the washing machine and dryer in my house are switched off after use. Could it be that he cannot connect to the devices?

FYI i using node 12.14.1 LTS 😉

thoukydides commented 4 years ago
  1. programs: are displayed 👍

Do the switches work? Can you use them to start or stop programs? Do they indicate which program is active, and when it starts or stops? Have you tried customising them as described on the Wiki: Customising Programs?

  1. I get an error from the plugin in the log. The error is displayed again even after a restart of the homebridge.

That is just a warning, not an error (see EventEmitter.defaultMaxListeners). It occurs because your appliance supports a large number of different programs, but does not affect the functionality.

I will suppress this warning in the next release.

  1. I noticed that via Ifttt it is possible to turn off the washing machine or dryer. I am surprised that it is not possible via the API?

There are quite a few things that the Home Connect IFTTT channels can do that are not supported via the public API. Have a look at my IFTTT Comparison. It is clearly not using the same API.

I have already provided you with a link to the Home Connect Power State documentation, where the Availability matrix shows that neither Off nor Standby are supported for Dryer/Washer/WasherDryer appliances.

Additionally, from version 0.11.0 of this plugin it actually queries each appliance for the power states that it supports. In your log file it says Cannot be switched off, which means that the appliance said it only supports On.

  1. in the Eve app a programmable switch is shown on the device. Why should it be?

Those are for events that can be used to trigger automations. As their names state, the first is triggered when a program finishes, and the second when a program is aborted.

See Supported Home Connect Functionality and Stateless Programmable Switch Services for Events on the Wiki for more details.

In the HomeDash App, values are displayed to me as manufacturer specific without exact designation. Can you change this or is it the app?

Apple have not defined HomeKit services and characteristis that are appropriate for home appliances. Hence, this plugin defines its own Home Appliance Service. It is up to individual apps how they handle this.

Apple's own Home app does not show it at all. Eve and Home+ handle it properly. Other apps like HomeDash take a different approach. I have no control over that.

The only thing I could do to change this would be to completely remove the functionality, but I am not going to do that.

Hello, another error has occurred overnight: I have to tell you that the washing machine and dryer in my house are switched off after use. Could it be that he cannot connect to the devices?

That is the error message returned by the Home Connect server. However, it is not one of the documented API Errors.

It looks like there was a problem within the Home Connect servers themselves. This particular error occurred when the plugin asked for a list of appliances in your account. This operation does not need to communicate with any of the appliances themselves, so it should work even if an appliance cannot currently be reached.

However, it looks like this plugin handled the error correctly, so it can be ignored.

thoukydides commented 4 years ago
  1. I get an error from the plugin in the log. The error is displayed again even after a restart of the homebridge.

That is just a warning, not an error (see EventEmitter.defaultMaxListeners). It occurs because your appliance supports a large number of different programs, but does not affect the functionality.

This warning is suppressed in v0.13.0.

In the HomeDash App, values are displayed to me as manufacturer specific without exact designation. Can you change this or is it the app?

Apple have not defined HomeKit services and characteristics that are appropriate for home appliances. Hence, this plugin defines its own Home Appliance Service. It is up to individual apps how they handle this.

Version v0.13.0 attaches those characteristics to the main power Switch service instead of using a non-standard Home Appliance service. That might work better with the HomeDash app.

Nastras commented 4 years ago

Do the switches work? Can you use them to start or stop programs? Do they indicate which program is active, and when it starts or stops? Have you tried customising them as described on the Wiki: Customising Programs?

I can't tell you because my wife hasn't washed yet. I will watch it this weekend 😉

There are quite a few things that the Home Connect IFTTT channels can do that are not supported via the public API. Have a look at my IFTTT Comparison. It is clearly not using the same API.

Amazing that an own api was created for ifttt.

I have already provided you with a link to the Home Connect Power State documentation, where the Availability matrix shows that neither Off nor Standby are supported for Dryer/Washer/WasherDryer appliances. Additionally, from version 0.11.0 of this plugin it actually queries each appliance for the power states that it supports. In your log file it says Cannot be switched off, which means that the appliance said it only supports On.

I knew that, just hoping there was a chance.

If I'm honest, the most important thing to me would be turning the machine on and off. And that is exactly what is not possible 🙄

But it's not your fault. Your plugin and your work is great 👍

That is the error message returned by the Home Connect server. However, it is not one of the documented API Errors.

Got an undocumented error today 😉 2FA6CFDC-6C94-4D09-AFE7-49B30D69A360

This warning is suppressed in v0.13.0. 👍👍👍 Thank you 👍👍👍

Version v0.13.0 attaches those characteristics to the main power Switch service instead of using a non-standard Home Appliance service. That might work better with the HomeDash app.

I have already installed the update but cannot see any changes. Will tell the developer of HD soon.

DF4BF0DE-449E-4764-9B58-57AF9BA66A5B

thoukydides commented 4 years ago

That is the error message returned by the Home Connect server. However, it is not one of the documented API Errors.

Got an undocumented error today 😉

I suspect that this is an HTTP 502 error.

Home Connect appears to be hosted on Amazon Web Services (AWS). This error is returned if the load balancing proxy has a timeout whilst waiting for the response from the server to which it forwarded the request.

Unfortunately the non-debug log does not provide sufficient information for me to investigate further. The only thing that it reveals is that the error occurred in response to requesting the events stream for your Dryer appliance. Presumably it did not receive this error for other requests, so my guess is that the Home Connect servers are slightly overloaded.

If this error is reproducible then please can you run Homebridge with debug enabled (using homebridge -D) and provide the relevant section of the log. (A raw text file would be more useful than a bitmap...)

Nastras commented 4 years ago

So far it is not reproducible. But I will let the plugin run in debug mode for the next days. If something happens again I will send you the log.

Nastras commented 4 years ago

Good morning, here's some information for you:

I regularly receive an error message, but I cannot reproduce it. I suppose it is related to the fact that the devices are not in standby or the HTTP 502 error? I have attached a log to you once, maybe you can optimize something?

Log.txt

thoukydides commented 4 years ago

The Home Connect API has been unreliable for the last few days. I have been seeing a large number of different error responses, including those that are shown in your log file. This happens even though my appliances are permanently connected.

I cannot do anything to prevent the errors since the plugin is making entirely valid and necessary requests, but the Home Connect server is failing to respond correctly.

However, given how many errors are being seen I probably need to review the plugin to make sure that it will always recover after these errors when the Home Connect servers do start behaving. In most cases it should be fine. Unfortunately, if the event stream is lost then some appliance state changes that occur before the event stream is re-established may be missed, so it might be possible to improve that. There are also some things that the plugin does once at start-up, where a failure will disable a feature until the plugin is restarted and the appliance capabilities are re-read, but I don't think it is worth the complexity required to improve that.

Nastras commented 4 years ago

Good to know.

I've also noticed that some of the values are sometimes not right. Sometimes it is indicated that the door is open although the washing machine is running :-)

thoukydides commented 4 years ago

I've also noticed that some of the values are sometimes not right. Sometimes it is indicated that the door is open although the washing machine is running :-)

I suspect that example was due to the server errors leaving this plugin in an inconsistent state:

Currently the plugin only polls the appliance state when

  1. The plugin is first started
  2. When it receives an event from the Home Connect servers saying that the appliance has connected

It does not routinely poll the Home Appliance servers since that would exceed the very strict rate limits. See:

The plugin currently relies on being able to re-establish the event stream quickly after a disconnection to minimise the risk of missing state updates. I was not expecting the Home Connect servers to be so unreliable. Changing this to poll the status when the event stream is re-established will fix that, but will also risk exceeded the rate limits...

Nastras commented 4 years ago

Thanks for the explanation. I have to say that I am a bit disappointed with the Home Connect API and its server and can't see any real use yet. But this has nothing to do with your work which is very good.

But I hope that it still improves.

Nastras commented 4 years ago

Hi @thoukydides, I just wanted to let you know that with the new version the API bugs are gone and the plugin runs more stable 👍 Good Job, Thank you!

I noticed something today while washing. After starting the washing machine, my wife paused for a moment to refill the machine. Then she continued the washing process.

In HomeKit the status of the door was shown as open until the end of the washing process. I guess the plugin didn't ask for the status after the pause or?

F20C6131-1713-4DC7-B13B-39EFCED23F5E

Also I wanted to ask you if you can display the duration of the units in minutes?

If the device in HomeKit tells me that it takes 4500 seconds to finish, it doesn't tell you anything right away. Minutes would make it a little easier.

thoukydides commented 4 years ago

Hi @thoukydides, I just wanted to let you know that with the new version the API bugs are gone

That is almost certainly due to the Home Connect team fixing the issues with their servers. I think they rolled out a new software version at the weekend and it had some teething problems. The unreliability issues appear to be resolved, but I am encountering other things that have broken.

The next release of this plugin will include some changes to make it more tolerant of errors. In particular it will check for any lost state if the event stream disconnects (as I proposed in an earlier response).

I noticed something today while washing. After starting the washing machine, my wife paused for a moment to refill the machine. Then she continued the washing process.

In HomeKit the status of the door was shown as open until the end of the washing process. I guess the plugin didn't ask for the status after the pause or?

This plugin relies on the Home Connect servers volunteering status updates for things like the door state via the event stream. It only polls the status when first connected or when the event stream is lost. It is not possible to poll frequently without exceeding the very strict Home Connect API rate limits, which results in further accesses being blocked for a period of time, and could even result in the client being permanently blocked.

If the Home Connect servers don't provide the status update then there is nothing that this plugin can do about it.

If you would like me to investigate then please provide a log with debug enabled (the -D option to Homebridge).

This issue does not occur with the Washer simulator on the Home Connect Developer Program website. I do not have access to a Home Connect washing machine, so cannot investigate without a debug log. A screenshot without debug level logging does not provide the information necessary to see what the Home Connect servers are sending, although I suspect that they are simply failing to provide the relevant event.

Also I wanted to ask you if you can display the duration of the units in minutes?

Apple have defined the Remaining Duration characteristic as being an integer time in seconds. It is up to individual HomeKit apps how they choose to present it. The Elgato Eve app shows it as minutes and seconds.

The only way for this plugin to provide the duration in minutes would be to define a custom characteristic, but most HomeKit apps wouldn't show it all then. They certainly would not know to interpret it as minutes.

If the device in HomeKit tells me that it takes 4500 seconds to finish, it doesn't tell you anything right away. Minutes would make it a little easier.

I agree. If the HomeKit app that you use just shows seconds then I suggest you contact its author to suggest an enhancement. As I said, the Eve app handles this well.

Nastras commented 4 years ago

Many thanks again for the detailed Reply!

If you would like me to investigate then please provide a log with debug enabled (the -D option to Homebridge).

I had switched off the debug mode in the meantime, sorry. I would have to reproduce the event first.

But maybe I have an idea how to simplify debugging in the future. I know it from the homebridge-hue plugin, where the plugin automatically creates a debug file that the user can provide to the developer in case of problems. Maybe it would be something for your plugin?

I agree. If the HomeKit app that you use just shows seconds then I suggest you contact its author to suggest an enhancement. As I said, the Eve app handles this well.

I was not aware that it depends on the plugin primarily how the time is displayed. I will ask the developer of the app.

thoukydides commented 4 years ago

If you would like me to investigate then please provide a log with debug enabled (the -D option to Homebridge).

I had switched off the debug mode in the meantime, sorry. I would have to reproduce the event first.

No worries. I will take a look whenever you manage to capture a debug log of the issue.

But maybe I have an idea how to simplify debugging in the future. I know it from the homebridge-hue plugin, where the plugin automatically creates a debug file that the user can provide to the developer in case of problems. Maybe it would be something for your plugin?

Quoting from the README.md for homebridge-hue:

Troubleshooting

...

Debug Log File

The homebridge-hue plugin outputs an info message for each HomeKit characteristic value it sets and for each HomeKit characteristic value change notification it receives. When homebridge is started with -D, homebridge-hue outputs a debug message for each request it makes to the bridge / gateway, for each state change it detects while polling the bridge / gateway, and for each push notification it receives from the deCONZ gateway. Additionally, it issues a debug message for each bridge / gateway resource it detects. .. Compress the log file by issuing gzip homebridge.log.

Debug Dump File

To aid troubleshooting, on startup, homebridge-hue dumps its environment, including its config.json settings and the full state of all bridges / gateways into a gzipped json file, homebridge-hue.json.gz. IP addresses, and bridge / gateway usernames are masked. This file is created in the user directory, ~/.homebridge by default.

Raising Issues

If you need help, please open an issue on GitHub. Please attach a copy of homebridge.log.gz (see Debug Log File) and of homebridge-hue.json.gz (see Debug Dump File). Please do not copy/paste large amounts of logging.

Hence, the author asks for both:

  1. A Homebridge log file captured in debug mode (-D).
  2. The homebridge-hue Debug Dump File.

The former provides information about the dynamic run-time behaviour, including the interactions with other devices. The latter Debug Dump File only provides static configuration information; it does not replace the need for the Homebridge log file.

Capturing additional static information would not have helped with diagnosing any of the issues that have been raised on this plugin so far (including your washing machine door status). It is the dynamic behaviour captured in the Homebridge log file that is needed.

thoukydides commented 4 years ago

I've also noticed that some of the values are sometimes not right. Sometimes it is indicated that the door is open although the washing machine is running :-)

In HomeKit the status of the door was shown as open until the end of the washing process. I guess the plugin didn't ask for the status after the pause or?

I might have just spotted the cause of this door status discrepancy.

Re-reading the API documentation, BSH.Common.Status.DoorState can take three different values:

I hadn't spotted this because the appliance simulators only generate the Open and Closed values... as does my Oven during normal use (it only locks the door during pyrolytic cleaning cycles).

My guess is that your washing machine is probably sending the Locked value while a program is running... which the current plugin would treat the same as Open. If this is the case then it will be immediately obvious from a -D debug log.

I will include a fix for this in the next release regardless.

thoukydides commented 4 years ago

I might have just spotted the cause of this door status discrepancy. ... I will include a fix for this in the next release regardless.

Should be fixed in 0.16.1.

Nastras commented 4 years ago

Good morning @thoukydides

thank you for your effort, as soon as my "wife" .-) uses the washing machine or the dryer I will watch it and let you know if it is fixed.

Nastras commented 4 years ago

So after the first wash I can say that the status of the door is now displayed correctly. Good work Thank you!

thoukydides commented 4 years ago

So after the first wash I can say that the status of the door is now displayed correctly.

Thank you @Nastras for confirming that the door status is now working.

I think that Dryer/Washer/WasherDryer appliances are now supported as well as can be subject to the Home Connect API and HomeKit limitations, so I am going to close this issue. If you discover any new problems then please open a new issue.