home-assistant-pure-i9
home-assistant-pure-i9 copied to clipboard
Add cleaning start, end and duration attributes
Add attributes to the vacuum, such as last cleaning. There are some base attributes that are defined in Home Assistant core. Start with them and work from there. Search _ATTR
in entity and vacuum.
Originally suggested in https://github.com/Ekman/home-assistant-pure-i9/issues/4.
Adding attributes:
- Last cleaning start
- Last cleaning end
- Last cleaning duration (seconds)
Should work pretty easily with CloudRobot.getCleaningSessions()
now.
Added first attribute in #29 task. I'll look into adding the rest of the attributes with @Phype recommendation.
Hey @Phype . I'm calling CloudRobot.getCleaningSessions()
but I get KeyError: cleaningSession
. I've double checked that my robots actually responds with the data using Postman and it does respond with a cleaning session. Do you have any idea what it could be? Here's the code.
Hmm, i'll look into it. item
is the object which comes from the cloud API, so probably there is a possibility that one of these JSON objects doesn't have a property because of some weird reason which never happened for me.
I've added a workaround, but you have to handle to incomplete data yourself. I guess this will never happen to newly created cleaningsessions from now on, so a simple fix to handle these incomplete objects would be to just ignore them, especially if you only want to display the data for the latest item anyway.
BTW, do you want access to the totalLifetimeCleanedArea
attribute?
This lists the total area cleaned in m² since the last reset. I can just copy it to the cleaning session object, the only question is if this really makes sense. I'd think this is more a property of the robot, and it's quite unintuitive having to get this property from the last cleaning session instead of sth. like 'CloudRobot.getTotalCleanedArea()' or something.
[
{
"id": "obfuscated",
"sessionId": 1337,
"timeStamp": "2021-11-20T14:14:39",
"cleanedArea": 18.87,
"totalLifetimeCleanedArea": 10318.514
}
]
Thanks for the heads up! Yes, for now I'm only including the latest cleaning session. When/if demands exists I might add more.
If you include the property totalLifetimeCleanedArea
in the library then I'll use it. I guess you can look at it from two perspectives:
- It's the total area cleaned - Makes more sense to have as a property on the robot and not on the cleaning sessions.
- It's the total area cleaned at that point in time - Then it makes sense to have it on the cleaning sessioon. If I'd want to know "what was the total area cleaned before last cleaning.
I don't really know when you'd use the second to be honest. I'll definitely only be displaying one total. 😅
- It's the total area cleaned - Makes more sense to have as a property on the robot and not on the cleaning sessions.
- It's the total area cleaned at that point in time - Then it makes sense to have it on the cleaning sessioon. If I'd want to know "what was the total area cleaned before last cleaning.
I don't really know when you'd use the second to be honest. I'll definitely only be displaying one total. 😅
I could think at least one use-case for both options:
- I want to know what happened in past
- I want to know how the current on-going cleaning is proceeding.
Regardless, as just a dummy integration user, I'd be happy to see either of those. ;)
Umm, @Ekman little help? I updated the PureI integration via HACS, integration is showing release now as 1.4.0 but I can't see any new entities for my vacuum. Do I need to re-integrate the device?
Weird @GitPetri !
Please add this to your configuration.yaml
and then send me your logs Settings -> System -> Logs
:
logger:
default: warn
logs:
custom_components.purei9: debug
purei9: debug
homeassistant.components.purei9: debug
Weird @GitPetri !
Please add this to your
configuration.yaml
and then send me your logsSettings -> System -> Logs
:logger: default: warn logs: custom_components.purei9: debug purei9: debug homeassistant.components.purei9: debug
Hmm, probably this: 2023-03-04 13:32:45.460 WARNING (SyncWorker_5) [custom_components.purei9.vacuum] DEPRECATED: Setup the integration using integration UI instead of configuration.yml.
Yup, that was it. I had old
vacuum:
- platform: purei9 email: !secret electrolux_user password: !secret electrolux_password
in my configuration.yaml. Commented those out, re-integrated the vacuum via integration UI and now it works
S.U.E. - Stupid User Error.
I'm glad to hear that! Just let me know if you have any more questions. 🙂