From 7187d54b3b2fd06b8969a4c1de5b00335a21553e Mon Sep 17 00:00:00 2001 From: loosrob <79396812+loosrob@users.noreply.github.com> Date: Sun, 11 Apr 2021 16:03:05 +0200 Subject: [PATCH] align actions with cleaning robot interface & use settings when cleaning --- neatobotvac/integrationpluginneatobotvac.py | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/neatobotvac/integrationpluginneatobotvac.py b/neatobotvac/integrationpluginneatobotvac.py index 3085fbd7..ef033245 100644 --- a/neatobotvac/integrationpluginneatobotvac.py +++ b/neatobotvac/integrationpluginneatobotvac.py @@ -176,7 +176,7 @@ def pollService(): pollTimer.start() -def executeAction(info): +def executeAction(info): if info.actionTypeId == robotStartCleaningActionTypeId: refreshRobot(info.thing) if info.thing.stateValue(robotRobotStateStateTypeId) == "paused": @@ -210,6 +210,28 @@ def executeAction(info): info.finish(nymea.ThingErrorNoError) return +def cleanWithRobot(robotThing, mapID, boundaryID): + # To do: add a parameter to the start action which takes a zone id --> this should now be represented by mapID & boundaryID + robot = thingsAndRobots[robotThing] + logger.log("Cleaning with robot:", robot, robotThing) + boolEco = robotThing.setting(robotSettingsEcoParamTypeId) + boolCare = robotThing.setting(robotSettingsCareParamTypeId) + boolNogo = robotThing.setting(robotSettingsNoGoLinesParamTypeId) + if boolEco == False: + intEco = 2 + else: + intEco = 1 + if boolCare == False: + intCare = 1 + else: + intCare = 2 + if boolNogo == False: + intNogo = 2 + else: + intNogo = 4 + logger.log("Settings: Eco:", boolEco, "Care:", boolCare, "Enable nogo:", boolNogo, "mapID:", mapID, "boundaryID:", boundaryID) + thingsAndRobots[robotThing].start_cleaning(mode=intEco, navigation_mode=intCare, category=intNogo, boundary_id=boundaryID, map_id=mapID) + refreshRobot(robotThing) def cleanWithRobot(robotThing, mapID, boundaryID): # To do: add a parameter to the start action which takes a zone id --> this should now be represented by mapID & boundaryID @@ -299,7 +321,6 @@ def executeBrowserItem(info): info.finish(nymea.ThingErrorItemNotExecutable) - def deinit(): global pollTimer # If we started a poll timer, cancel it on shutdown.