bulldog5046 / ha_nespresso_integration

21 stars 4 forks source link

Error Brewing coffee Nespresso Prodigio #20

Closed Felipefuji closed 1 week ago

Felipefuji commented 1 week ago

After pairing. I have these entities. And I don't understand how I can make a coffee having only these 9 entities. image I don't see any that would allow me to carry out the action. Can you help me. In your screenshots I see that you have an entity that is: sensor.expert_milk_1dxxx_always_1 image

But there's nothing on my sensors related to my machine of that type. I don't have a sensor.prodigio_1cxxxx_always_1

I don't know what I'm doing wrong

I have created a simple button as the tutorial says, and when I execute the action, the machine does nothing. image

Felipefuji commented 1 week ago

Update: I have been able to update the machine's counter, but I still can't make a coffee. I am attaching a screenshot of the response it gives each time I attempt to brew a coffee.

image

If anyone can help me, I would greatly appreciate it.

Felipefuji commented 1 week ago

I'm adding a new update.

After reviewing the code I have discovered that the failure occurs in line 251 of the Nespresso.py file: buffer[8] = temp.value if self.devices[self._conn.address].configurations['temprature_control'] else Temprature.MEDIUM.value

In which a check is made if temperature control is available and if not the temperature is fixed in Medium. But in my case it failed at that point and generated an exception. That control is not performed correctly. I have solved it in my installation and it already works. Now I'm facing another problem and that is that. He already makes coffee but instead of making 1 coffee, he makes me 2 when I perform an execution. I will continue to look for solutions.

bulldog5046 commented 1 week ago

I'm adding a new update.

After reviewing the code I have discovered that the failure occurs in line 251 of the Nespresso.py file: buffer[8] = temp.value if self.devices[self._conn.address].configurations['temprature_control'] else Temprature.MEDIUM.value

In which a check is made if temperature control is available and if not the temperature is fixed in Medium. But in my case it failed at that point and generated an exception. That control is not performed correctly. I have solved it in my installation and it already works. Now I'm facing another problem and that is that. He already makes coffee but instead of making 1 coffee, he makes me 2 when I perform an execution. I will continue to look for solutions.

It's been a long time since I looked at this project but that sounds like a relatively easy fix. What did you set it to for a successful brew?

Felipefuji commented 1 week ago

Basically I am ignoring the use of finding out if the machine has temperature control or not, since I know that my machine does not have it. and the only thing I do is: if temp.value is None or temp.value == Temprature.MEDIUM.value: buffer[8] = Temprature.MEDIUM.value else: buffer[8] = temp.value I don't check anything else.

bulldog5046 commented 1 week ago

I've just pushed a commit to the main branch as this was a fairly obvious oversight on my part when i originally wrote it. Can you please test it and confirm resolution?

Felipefuji commented 1 week ago

Yes, this afternoon I will perform a test and confirm it. I'm working right now and it's a little complicated for me right now. Thanks for your response

Felipefuji commented 1 week ago

I managed to find a few minutes to test it, and it is now working correctly. However, I still have the problem that instead of making 1 coffee, it makes 2 coffees in a row. I will continue investigating what might be happening to solve it.

bulldog5046 commented 1 week ago

Enable the debug logging and see what's happening. The brewing operation works on a command and response model. The only way i can see two operations happening is if the response is not received in the wait window (5 seconds) and is then sent again. The debug log should show if the brew command is being repeated due to a lack of response, or even possible failing due to no response.

If the latter, we could disable the response check for this model machine.

Felipefuji commented 1 week ago

I am attaching the latest test performed: image

In the first block, the response is that the slider had not been opened, so it did not make the coffee.

In the second block, it shows that the slider had already been opened and the capsule deposited. It makes the request and seems to wait for a response, launching the request several times. Perhaps it should have a longer waiting period to allow time to receive the response. It would be better to remove the response wait since otherwise, the first block would never be executed. Is that correct?

bulldog5046 commented 1 week ago

Are you certain that you are getting a double brew? For my Expert machine I based the project on it will not brew again until the slider has been opened/closed. Is it possible you are just seeing the coffee then water making it look like 2 operations?

Removing the response check is possible and already built-in but it's not ideal if you have a machine that will respond.

Felipefuji commented 1 week ago

I agree that removing the answer would not be a good solution. The Prodigy machine when finishing the coffee should only throw away the capsule. I shouldn't throw water again.

I was trying to upload a video but I couldn't. The machine makes the coffee, throws the capsule and just after throws water again the same amount as the previous coffee.

bulldog5046 commented 1 week ago

I was trying to upload a video but I couldn't. The machine makes the coffee, throws the capsule and just after throws water again the same amount as the previous coffee.

This sounds correct to me for everything but an espresso? Is the issue with the type of recipe the machine is brewing?

Eg, My machine process:

bulldog5046 commented 1 week ago

There was an issue in the logs you provided above whereby the command/response retry cycle wasn't appropriately waiting. I've commit another bugfix to resolve that. If you could produce another log like the above it should only show the first attempt rather than 3. Possibly could address your other issue if you disagree with my previous comment.

Felipefuji commented 1 week ago

Thank you. I'll try as soon as I have some free time and I'm attaching more information.

Felipefuji commented 1 week ago

After several tests, it now works perfectly. Thank you very much for fixing the errors. If at any time I can be of help with this project, I will be happy to assist. Thank you very much. image