What did you build/automated today (with pictures)?

Well i have no pictures, but i have wanted to post on this thread for a while.
Today i automated the emptying of my Xiaomi Vacuum (Named NooNoo, Part of the WAF)
Nothing ground breaking and simple compared to most i see.

Basically, it goes cleaning, once it’s done a total meter squared greater then the set amount and its done the cleanup (while we are at work). It will go home to charge, once fully charged it will drive itself to the bin for us to do the manual bit once home. Press the home button on the vacuum and it heads home, OpenHab resets its counters for next time.

Items

String NooNooCommand	"NooNoo Command"		{ channel="miio:vacuum:03DAB0FE:actions#commands" }
Number NooNooBattery	"NooNoo Battery"		{ channel="miio:vacuum:03DAB0FE:status#battery" }
Number NooNooCurrentCleanArea  "NooNoo Current Clean Area" { channel="miio:vacuum:03DAB0FE:status#clean_area" }
Number NooNooTotalCleanArea
String NooNooStatus  "NooNoo Current Action" { channel="miio:vacuum:03DAB0FE:status#state" }
Switch NooNooEmptyMode	"NooNoo Needs Emptying"

Rules

rule "NooNoo Status updates"
    when   
            Item NooNooStatus changed
    then
        var Number EmptyAmount = 50
        logInfo("Rule","NooNoo status rule start")
        if (NooNooStatus.state == "Returning Dock" && NooNooTotalCleanArea.state < EmptyAmount) {
                logInfo("Rule","NooNoo Not ready to be emptyed")
                var Number TotalArea = NooNooTotalCleanArea.state as Number
                var Number CurrentArea = NooNooCurrentCleanArea.state as Number
                NooNooTotalCleanArea.sendCommand( TotalArea + CurrentArea ) }
        else if(NooNooStatus.state == "Charging" && NooNooTotalCleanArea.state > EmptyAmount) { 
                logInfo("Rule","NooNoo Ready to be emptyed but going to charge")
                NooNooEmptyMode.sendCommand( ON ) }
        else if(NooNooStatus.state == "Returning Dock" && NooNooEmptyMode.state == ON ) { 
                logInfo("Rule","NooNoo Has been emptyed")
                NooNooEmptyMode.sendCommand( OFF )
                NooNooTotalCleanArea.sendCommand( 0 ) }
end

rule "NooNoo go to be emptyed"
    when   
            Item NooNooBattery changed
    then
        //logInfo("Rule","NooNoo battery ping")
         if (NooNooBattery.state == 100 && NooNooEmptyMode.state == ON ) {
                 logInfo("Rule","NooNoo Going to sit by the bin")
                NooNooCommand.sendCommand("app_goto_target[25813,27057]")
             }
end

I would have liked to get it down to a single rule, but time wasn’t permitting.

7 Likes