Heyhey
I wrote a Script to lety roborock Clean Up some rooms.
It has to Clean more than one battery load allows, so I created one wait until the battery has recharged.
When my Robot finished cleaning I want to Set an Input boolean to true, to start mopping after the Vacuum hast vacuumed.
But in my Script the boolean IS Set to true, when my Robot STARTS the second vaccuming (after the wait).
But obviously the boolean has to geht true AFTER vacuuming jas finished.
alias: RoboterVorneAllesSaugen
sequence:
- if:
- condition: numeric_state
entity_id: vacuum.roborockladenvorne
attribute: battery_level
below: 95
alias: Wenn Batterie unter 95%
then:
- wait_for_trigger:
- platform: numeric_state
entity_id: vacuum.roborockladenvorne
attribute: battery_level
above: 94
continue_on_timeout: false
alias: Warten auf Batterie über 94%
- service: vacuum.set_fan_speed
data:
fan_speed: turbo
target:
entity_id: vacuum.roborockladenvorne
alias: Fan Speed Turbo
- service: vacuum.send_command
data:
command: set_water_box_custom_mode
params: 200
target:
entity_id: vacuum.roborockladenvorne
alias: Wischen aus
- service: vacuum.send_command
data:
command: set_mop_mode
params: 300
target:
entity_id: vacuum.roborockladenvorne
alias: Strecke Standart
- service: roborock.vacuum_clean_segment
data:
segments:
- 27
- 26
- 30
- 28
target:
entity_id: vacuum.roborockladenvorne
alias: Eingangsbereich | Mittelgang hinten u vorne | Katze saugen
- wait_for_trigger:
- platform: numeric_state
entity_id: vacuum.roborockladenvorne
attribute: battery_level
above: 94
alias: Warten bis Batterie über 94%
continue_on_timeout: false
alias: Warten bis Batterie über 94%
timeout:
hours: 4
minutes: 0
seconds: 0
milliseconds: 0
- service: vacuum.set_fan_speed
data:
fan_speed: balanced
target:
entity_id: vacuum.roborockladenvorne
alias: Fan Speed normal
- service: vacuum.send_command
data:
command: set_water_box_custom_mode
params: 200
target:
entity_id: vacuum.roborockladenvorne
alias: Wischen aus
- service: vacuum.send_command
data:
command: set_mop_mode
params: 300
target:
entity_id: vacuum.roborockladenvorne
alias: Strecke Standart
- service: roborock.vacuum_clean_segment
data:
segments:
- 23
- 21
target:
entity_id: vacuum.roborockladenvorne
alias: Aqua und Terra | Nager und Vogel saugen
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.roborockvornefertiggesaugt
mode: single
icon: mdi:robot-vacuum
Somehow IT feels wrong to put another wait (for Robot being docked, for example) in there.
Is there a better way to achive the boolean being Set at the really end?
Or am I wrong and another wait is Just perfectly fine?
Instead of a Boolean use another helper, like a text for names of the step, like vac1, vac2, mop1,…, finish or use a number helper for just the steps, like 1,2,3…
You set it to new values underway.
When first part of the vacuum is done then set the value of a text helper to vac1
Then when the second part of the vacuum is done then set the value to vac2 and so on.
When the script is done then set the value to finished.
Now you have a progress indicator instead of a finished indicator.
If you want a finished indicator then make a template on the text helper that looks for state set to the finish text.
A finished helper is all I need.
But even with your idea of more helpers, the problem stays the same.
Lets say, step1 helper - should be set after the first vacuumising and the second after the second vacuumising (after the work after the wait is done).
If I say:
roborock clean some rooms
input_boolean vac2_finished set true
Then the boolean is set to true right after the robot STARTS cleaning.
But obviously it should be set to true after robot FINISHED.
Ofcourse I am (as shown in my code).
But here the problem again.
If I put these two actions in:
robo clean some rooms
set input boolean true
Then Home Assistant performs the command to roborock for cleanin rooms and directly after sending the commands to the robot puts the input boolean tp true.
(and now again my question from post 1)
If I put - wait for robo being docked
between these 2 Actions, my boolean will ne true when robo has FINISHED the vacuumizing (as it should)
But question is, is there another way achieving this?
You are trying to use a Boolean helper that can hold two value states to show three or more.
It is not possible.
You can choose text or number instead or some other multiple state variable.
You can also choose to use two Boolean helpers, like a pair of bits, but you can not rely on only one Boolean.
wtf
Im not sure you get me wrong, or I get you wrong.
What I want is:
Setting ONE boolean to true AFTER ALL the vacuumizing is done.
If I now do:
robo clean first rooms
robo wait for battery to charge to 95%
robo clean second rooms
input boolean set true
The Robo cleans first rooms and waits for battery.
Home Assistant then sends the commands for cleaning second rooms, but doesnt wait for this to be finished. THe input boolean is set to true right after the clean 2nd rooms command is set.
But ofcourse the boolean should be true when the WORK IS COMPLETELY DONE (not when cleaning 2nd rooms starts).
To achieve this, id say:
robo clean first rooms
robo wait for battery to charge to 95%
robo clean second rooms
wait for robo being docked
input boolean set true
But this another wait feels kinda wrong. Im wondering if there is another way.
AHH, so it is not the two parts of the scripts.
It is just that the script does not wait for the clean command to physical finish before proceeding.
You need to find a way to detect the cleaning have finished or you might try to guesstimate it,like with timing or so.
The command might not be able to provide that information.