Good evening,
I would like to create my own rule for spot cleaning and struggle a bit with the coding. Maybee someone has an idea how I can fix it.
my item:
String XiaVac_action_Control "Vacuum Control" (gXiaomiVac) {channel="miio:vacuum:046F78BA:actions#control" }
String XiaVac_Cleaning_Area "Spot Cleaning"
my Map:
Schlafzimmer=[21007,22127,26007,26577,1]
..
Kueche=[[25919,35920,27669,37470,1],[26495,32855,28295,35905,1]]
sitemap:
Switch item=XiaVac_Cleaning_Area mappings=[Kueche="Küche", Arbtszmmer ="Arbtszmmer", .. Schlafzimmer ="Schlafzimmer", Alles ="Alles"]
Switch item=XiaVac_action_Control mappings=[vacuum="Saugen", pause="Pause",spot="Spot", dock="Dock"]
What I like to do is the following:
If item Cleaning area gets an update e.g. Küche, then go to the map, take the coordinates and start zone cleanup. In the meantime, set the action_control item to “Spot” and after finishing clear the status of the area cleaning.
my rule looks like this at the moment:
rule "Zone Cleanup"
when
Item XiaVac_Cleaning_Area received update
then
// Only if the mi robot is currently on the dock
if (XiaVac_status_State.state == "Charging") {
val areaMap = transform("MAP", "vacuum_area.map", XiaVac_Cleaning_Area.state)
if (areaMap != "")
XiaVac_action_Command.sendCommand('app_zoned_clean[' + areaMap + ']')
}
end
the status change at the end should like like this:
rule "change status"
when
Item XiaVac_status_State changed to Charging
then
XiaVac_Cleaning_Area.postUpdate(0)
end
How can I merge these two rules and where is my logical bug at the moment? Thank you for helping me out here. At which point of my rule do I have to ad the Action_Control to Spot?