DeebotUniverse / Deebot-4-Home-Assistant

Home Assistant integration for deebot vacuums
https://deebot.readthedocs.io/integrations/home-assistant/
GNU General Public License v3.0
180 stars 40 forks source link

Charging status sensor #422

Closed dbochicchio closed 1 year ago

dbochicchio commented 1 year ago

Is there an existing issue for this?

Is your feature request related to a problem?

No response

Suggested solution

In a large house with max power in some zones, the bot will need to come back to the base station to recharge itself before completing. In this scenario, the reported status is "paused", and I cannot detect if the pause was related to the bot that is lost somewhere or being charged.

A new attribute on the battery entity is enough.

Thanks for this fantastic integration!

Api example request

No response

Alternatives you've considered

No response

Additional information

No response

edenhaus commented 1 year ago

What is the Status of the bot in the app?

dbochicchio commented 1 year ago

It's paused, but there should be a "ChargeState" event coming from the bot's API: https://github.com/mrbungle64/ecovacs-deebot.js/blob/master/library/ecovacs.js#L80

I used this lib before and I had the charging state correctly reported (plus, the bot position). Thanks!

edenhaus commented 1 year ago

Please activate debug logs and attach them here

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

dbochicchio commented 11 months ago

Sorry for the last response, I've been thru a crazy period lately.

Anyway, I turned on debug logs but there's nothing to see. From my understanding of the code, it's a completely different event.

Right now one of my bots is paused while charging, the app is reporting "paused" and I cannot determine if it's docked or lost somewhere. I'll probably just write some code on my own to determine if the battery is depleting or recharging to understand if the bot is lost or effectively recharging, but I think a couple of attributes/sensor to determine if it's docked or not could be used to anyone out there. Thanks!

edenhaus commented 11 months ago

Anyway, I turned on debug logs but there's nothing to see. From my understanding of the code, it's a completely different event.

If you really turned on the debug logs there are a lot of log entries including all data coming from the bot....

Right now one of my bots is paused while charging, the app is reporting "paused"

When also the ecovacs app reports your bots as paused there is nothing that I can do...

It's paused, but there should be a "ChargeState" event coming from the bot's API: mrbungle64/ecovacs-deebot.js@master/library/ecovacs.js#L80

it's a completely different event.

Not sure what you mean with these two comments but the charge state is handled https://github.com/DeebotUniverse/client.py/blob/dev/deebot_client/commands/json/charge_state.py

Right now one of my bots is paused while charging, the app is reporting "paused" and I cannot determine if it's docked or lost somewhere.

I can assure you that my bot is reported as docked in HA when it's docked and probably for the other ~10k users it is. It's probably an edge case of your bot. I'm willing to help, but you don't provide any data, the only thing you say it is not working...

I'll probably just write some code on my own to determine if the battery is depleting or recharging to understand if the bot is lost or effectively recharging, but I think a couple of attributes/sensor to determine if it's docked or not could be used to anyone out there.

Sure you can write your own code. Please feel free to open a PR so your code helps the community :)

dbochicchio commented 11 months ago

I appreciate your hard work, and I didn't mean to upset you. I'm sorry, I was not my intention.

Regarding my request, let me clarify. What I wanted to get was the charging state of the bot (so, docket and charging, or not docked and not charging). It is not related to my own situation, and I think everyone will benefit from it. In my case, it'd be used to understand if the bot has really finished its schedule, or it has come back to the dock because the battery is over, it needs to recharge and then start again.

There's no sign of this special case in logs. Of course, logs are generated, but there's no trace of the charging status. I could submit them anyway, but I doubt it will benefit you.

It's a request for a new attribute that, when using the JavaScript library, I was able to get. If you have no intention of adding it, I'm OK with that.

My code is mainly HA-related, so not very reusable. I'm not that proficient in Python, otherwise I'd have submitted a PR.

Thanks again!

edenhaus commented 11 months ago

If you have really activated debug logs, there must be for each event sent by the bot a log entry. Also, the library sends a StateEvent, so the information is already there.

Can you please add diagnostic information and the debug logs, so I can quickly check it myself.

dbochicchio commented 10 months ago

Here we go. Logs attached. deebot logs.txt

As I've said, the status is cleaning, because the requested job is not finished yet, but the bot is charging in its dock. So, the bot is docked trying to re-charge while the job is still pending. As I've said, I'm watching for battery events to understand if it's charging or discharging in order to determine if the job is really finished or not.

It took me a couple of weeks to be there because it is not common for the bot to be in this state and me at home to enable debug logs. Hope it helps.

Thanks for your time and help!

edenhaus commented 10 months ago

Please attach the diagnostic information of the device, which has the problems.

Your bot is always returning "isCharging":0,, which means he is not charging at least in the submitted logs. The logs contain only data of one minute, which is not enough. I need at least 1 minutes before the bot starts to returning to the docking station and 5 minutes after it started charging. Please write me also the time, when the bot reaches the docking station

dbochicchio commented 10 months ago

Not easy to catch, I'll try my best. In the meanwhile, is the isCharging property available somewhere as an attribute? Thanks.

edenhaus commented 10 months ago

Not easy to catch, I'll try my best.

Should be easy. Start debug logging and run a cleaning cycle and afterward cut the log file to include only the specified time.

is the isCharging property available somewhere as an attribute?

Nope as this is not required. If the property is equal to 1 the status will be reported as docked