Merge pull request #408 from loosrob/add-neato-botvac

neatobotvac: obtain map boundary info
master
Michael Zanetti 2021-03-26 10:03:34 +01:00 committed by GitHub
commit 6d21e49cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -88,11 +88,14 @@ def setupThing(info):
logger.log("MapId type: ", type(mapId), " MapId contents: ", mapId) logger.log("MapId type: ", type(mapId), " MapId contents: ", mapId)
mapName = mapInfo2['name'] mapName = mapInfo2['name']
logger.log("MapName type: ", type(mapName), " MapName contents: ", mapName) logger.log("MapName type: ", type(mapName), " MapName contents: ", mapName)
mapIDshort = mapId rbtMapBound = robot.get_map_boundaries(mapId)
logger.log("rbtMapBound Type: ", type(rbtMapBound), "rbtMapBound Contents: ", rbtMapBound)
rbtBoundData = rbtMapBound.text
logger.log("rbtBoundData Type: ", type(rbtBoundData), "rbtBoundData Contents: ", rbtBoundData)
thingDescriptor.params = [ thingDescriptor.params = [
nymea.Param(robotThingSerialParamTypeId, robot.serial), nymea.Param(robotThingSerialParamTypeId, robot.serial),
nymea.Param(robotThingSecretParamTypeId, robot.secret), nymea.Param(robotThingSecretParamTypeId, robot.secret),
nymea.Param(robotThingMapIdParamTypeId, mapIDshort) nymea.Param(robotThingMapIdParamTypeId, mapId)
] ]
thingDescriptors.append(thingDescriptor) thingDescriptors.append(thingDescriptor)
@ -203,9 +206,11 @@ def executeAction(info):
# To do: get available boundaries to use with start_cleaning action # To do: get available boundaries to use with start_cleaning action
if info.actionTypeId == robotGetBoundariesActionTypeId: if info.actionTypeId == robotGetBoundariesActionTypeId:
# rbtMapBound = thingsAndRobots[info.thing].get_map_boundaries() mapIDparam = info.thing.paramValue(robotThingMapIdParamTypeId)
# rbtMapBoundJson = rbtMapBound.json() rbtMapBound = thingsAndRobots[info.thing].get_map_boundaries(mapIDparam)
# logger.log("Robot Map Boundaries", rbtMapBoundJson) logger.log("rbtMapBound Type: ", type(rbtMapBound), "rbtMapBound Contents: ", rbtMapBound)
rbtBoundData = rbtMapBound.text
logger.log("rbtBoundData Type: ", type(rbtBoundData), "rbtBoundData Contents: ", rbtBoundData)
threading.Timer(5, pollService).start() threading.Timer(5, pollService).start()
info.finish(nymea.ThingErrorNoError) info.finish(nymea.ThingErrorNoError)