I want a sensor/s that tells me the cleaned percentage of the current room and the already cleaned rooms.
What I know?
I know the area of each room, the order in which they are cleaned and the total current cleaned area from the ongoing cleanup polled every 10 seconds.
Example
Suppose I have this appartment:
A == 15sqm
B == 10sqm
C == 5 sqm
Order: A, B and C.
If I clean the three areas that’s pretty simple. Problem is I don’t always clean the three areas. I sometimes clean only one, sometimes B and C, sometimes A and C, etc…
I really don’t know how to get this done… any help will be appreciated.
How does the vac know which areas to clean? From that set a global/flow variable as to which areas are expected to be cleaned. When the vacuum stops send the total completed and use that flow variable in a function node.
You’ll need to account for all scenarios.
var room = global.get("area")
var total = //msg path to total cleaned
if ( room == "a" && total <= 14.9 ) {
msg.room_a = (total/15 * 100)
}
else if ( room == "a" && total > 14.9) {
msg.room_a = 100
}
else if (room == "ac" && total <= 14.9) {
msg.room_a = (total / 15 * 100)
}
else if (room == "ac" && total > 14.9) {
msg.room_a = 100
msg.room_c = (( total - 15 ) / 5) * 100
}
else {
msg.room_a = "unknown"
msg.room_b = "unknown"
msg.room_c = "unknown"
}
return msg;
Yeah I understand, problem is I have 6 rooms and making every possible combination… even disregarding the 6 rooms selected option a no room selected, it would still be 62 combinations and a particular if elif else setup for each one… I hope to find a more general equation, I’ll end up doing this if there isn’t anything better though.
I do know which rooms are being cleaned because they are set with and input boolean for every room through HA
So if room A and C and being cleaned, then:
input_boolean.ozmaca_zona_a and input_boolean.ozmaca_zona_c ==> on
input_boolean.ozmaca_zona_b ==> off
That is for this simplified example. I in fact have 6 inputs.
I do know the order in which they’ll always be cleaned regardless of which rooms you choose and the total area of each room as well as the total current cleaned area of the ongoing cleanup.
EDIT
The goal is to have a total cleaned area % for every area individually, a percentage that must increase as the cleanup goes on, not only 0 or 100%…
current_a is what I’m missing. I have total_a and total area of the ongoing cleanup which doesn’t distinguish when on room ends and another starts, it updates every 10 seconds but it shows the total cleaned area of the n number of rooms selected. It doesn’t tell the difference
I have no idea what information your vacuum outputs, or where it outputs said information. So, if you could post screenshots of your vacuums information (on the states page), I could help with actual templates that work out of the box.