New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Charging state of robot vacuum as source for power consumption sensor #639
Comments
Currently the database only consists of lights. Which vacuum cleaner do you have? And how does the power behave? Is it a constant power when the device is actively vacuum cleaning? And another fixed value when idle? |
Hey @bramstroker, well, not sure that there's really a need to distinguish different device types. I'm at least fine with just vendor/device name. :)
The device is a Roborock S6 MaxV (Roborock is just a label for Xiaomi) — a pretty popular device.
Well the base has an idle power consumption all the time (when the device is running) and a different idle consumption when the device is docked. If the battery status is not 100% the device is charging, when it is reporting |
What do you mean by "power consumption curve based on the state-of-charge"? First we need to figure out how to define powercalc configuration for the vacuum cleaner using the existing configuration options (linear, states_power, templates) etc. |
When battery is empty enough it's charging at max current provided by power supply. Above ~80% power supply moves from "constant current" to "constant voltage" and power draw decreases expotentially. |
Is the state of charge (% battery) known to HA somehow when the device is in |
I’ve been giving this thought myself, and want to share those thoughts somewhere. I think an ideal implementation would be for a broad ‘charger’ class of devices. But complex is exactly right. Even more so, when there isn’t a consistent method to report the needed data across different integrations. Here’s a couple examples based on devices I own:
For mobile devices: considering that different chargers have different efficiency characteristics & power delivery standards, or that you might charge these devices away from home — this use case isn’t worth implementing. Implementing calibrated measurement also implies adding an additional mode to It’s a neat idea, but to implement it correctly would definitely take some work. |
Yes of course: The main state is So it's basically just a "lookup-table" for SoC and the average consumption for the SoC necessary. This is how the consumption while charging looks like: |
So, basically user need to discharge vacuum and run a script to watch a battery level sensor and ask for power consumption and each battery percentage. This builds a lookup table and rest seems more straightforward. |
Yep. But I guess it would be more accurate if we use the energy value on each SoC change instead. So it would automatically smooth out the power consumption for each SoC. |
@bramstroker ah and something specific to vacuum cleaners: They won't get empty all the way, usually. Mine stops cleaning at 20% to make sure it gets back to the dock on its own, regardless how big the home is. So I CAN discharge it more, by manually placing it somewhere and let it try to find the dock multiple times etc. but I don't think that's really necessary for a sensible energy profile. I think it's safe to assume that any battery charging rate in W below the minimum operation percentage is the same as the last in the profile. So I would just need a way to specify the HASS string for the SoC and the Shelly plug to make this work :) |
@RubenKelevra |
Agreed it looks more stable than I thought. I think that was like a 40% to 100% charging. The 2 W on/off is trickle charging plus standby current to keep the device running. |
@bramstroker I'll take later a peek at the script. Maybe I just implement it myself - if you're fine with that. Reason beeing that my device might be the exception in terms of linearity :) |
If I understand correctly the first stable 20 watt is ~40-80% charged, than the descending linear pattern from 15-8 watt is ~80-100% charged, and the last part trickle charge on 100%?
Sure, PR's are welcome as well. measure script can first ask what kind of device you are measuring. i.e.
My philosofy is alway to keep things simple first KISS and actually implement something more complex when it is actually needed. Regarding the implementation in the integration it can maybe look something like this.
- platform: powercalc
entity_id: vacuum.my_robot_cleaner
strategy_enabled_condition: '{{ is_state('vacuum.my_robot_cleaner', 'docked') }}'
linear:
attribute: battery_level
calibrate:
- 1 -> 20
- 79 -> 20
- 80 -> 15
- 99 -> 8
- 100 -> 1.5 Or when using LUT mode: - platform: powercalc
entity_id: vacuum.my_robot_cleaner
strategy_enabled_condition: '{{ is_state('vacuum.my_robot_cleaner', 'docked') }}'
lut: #this can be omitted as it is the default What do you think? |
Okay, I give a PR a shot. :)
Agreed. But I don't want to make it simple for me, but for the users. They shouldn't need to do any configurations, but instead have the device autodetected. :) That's why I wanted to make a LUT for that. |
The model.json files also provide possibilities for providing |
I agree, LUT with SoC-vs-wattage is most intuitive for use and flexible for future expansion. |
Great idea. I would love to measure state's of my sonos speaker, maybe different volumes, played vs paused, standby, and find some close map between that and watts |
When it is true it uses the configured strategy (
I have a Roborock S7 (which is nearly the same vacuum as the OP) and it behaves in exactly the same way, modulo slightly different levels of fully charged power use. It would be great to be able to use this in exactly the way you suggest here, but it doesn't seem to be working in the released branch. |
@wigster The |
Good news, I just worked some time on this and the code has been merged into master. #789 Any of you guys able to test this: - platform: powercalc
entity_id: vacuum.my_robot_cleaner
calculation_enabled_condition: "{{ is_state('vacuum.my_robot_cleaner', 'docked') }}"
linear:
attribute: battery_level
calibrate:
- 1 -> 20
- 79 -> 20
- 80 -> 15
- 99 -> 8
- 100 -> 1.5 This should work now. I am unable to test this fully as I don't have a robot cleaner myself. But did some testing using other attributes and entities. |
@bramstroker can we share those "profiles" (or maybe better calibrations?) in the database? It would be neat to have them just as part of the auto detection, like bulbs and switches - if that's possible? |
Sure, the model.json in library also supports fixed and linear mode. So we should be able to do something like this: {
"name": "Roborock S6 MaxV",
"supported_modes": [
"linear"
],
"measure_method": "manual",
"measure_device": ".....",
"measure_description": ".....",
"linear_config": {
"attribute": "battery_level"
"calibrate": {
"1": 20
"79": 20
"80": 15
"99": 8
"100": 1.5
}
}
}
|
Has been implemented with #792 {
"measure_description": "Test",
"measure_device": "Test",
"measure_method": "script",
"name": "Test",
"supported_modes": [
"linear"
],
"calculation_enabled_condition": "{{ is_state('[[entity]]', 'on') }}",
"linear_config": {
"attribute": "brightness",
"calibrate": [
"1 -> 40",
"79 -> 40",
"80 -> 15",
"99 -> 8",
"100 -> 1.5"
]
}
} |
Hi, I think this works exactly as it should for my vacuum. However, once small tweak request: I would like to be able to have |
@wigster Just to verify, I will change it as follows: assuming
|
Hmm, not sure that's quite when I meant. For the case of the vacuum, I think, we have the following situation. If calc_enabled is on = 40 W (to be precise, that linear scale). If calc_enabled is off (vacuum undocked), then it should be 0.25, because there is some residual power being taken by the docking station. The state of the vacuum device itself should not impact this at all, since if it turns itself off away from the dock, the dock doesn't know. |
Should be resolved with #819 Now it will be:
Can be tested by installing the master branch. |
@wigster @RubenKelevra Are any of you able to test the suggested configuration? If it is working correctly it can be submitted as a profile to the library. So other users can also use it without any manual configuration. |
@bramstroker sure, I was under the impression that there's something left to implement and thus the solution is only academical. :) |
@RubenKelevra Are you still able to add this configuration in a model.json to the library and test if this is working correct for your vacuum? Then we can close this issue. |
Lol, how is it still using power for half an hour when fully charged :-P. Yeah this is highly complicated to build something for. |
I was also thinking about having a look into smartphone charging using similar approach as implemented in this issue. The companion app passes charging state to HA afaik, so we should also maybe be able to use this somehow. Will do some testing on this. |
Phones have very flat charging curve, unless you are using some fast charging technique. In this case, my initial idea was to read notification bar, where AccuBattery displays charging stats. |
@bramstroker @KrzysztofHajdamowicz
Sometimes CC phase ends at higher upper percent (and of course higher voltage) - service life of accu depends on that - higher % of change to CV -> lower accu service life. High speed charging modifies only CC phase (in reality current is just not constant - it is based on temperature of battery). It looks like BMS of this vacuum cleaner reports 100% battery when in reality it is just after end of CC phase. Change CC -> CV is about at 85% real capacity of accu. |
This issue got a little bit out of control ;-). Maybe we can start a discussion how to integrate phone charging support in a seperate discussion part. Only thing left for this issue to be closed is getting some vacuum actually in the library. Than we can close this issue. |
Closing because of inactivity. |
Hey guys,
I was wondering if and how I can provide power consumption numbers for my robot vacuum to add it to the powercalc database for auto-detection?
The text was updated successfully, but these errors were encountered: