Skip to content

Commit

Permalink
Fixed bug in multiple roomba config
Browse files Browse the repository at this point in the history
  • Loading branch information
NickWaterton committed Jul 7, 2017
1 parent fc80692 commit 90e5202
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ optional arguments:
and + default: #)
-T BROKERFEEDBACK, --brokerFeedback BROKERFEEDBACK
Topic on broker to publish feedback to (default:
/roomba</name>/feedback)
/roomba/feedback</name>)
-C BROKERCOMMAND, --brokerCommand BROKERCOMMAND
Topic on broker to publish commands to (default:
/roomba</name>/command
/roomba/command</name>)
-S BROKERSETTING, --brokerSetting BROKERSETTING
Topic on broker to publish settings to (default:
/roomba</name>/setting
/roomba/setting</name>)
-b BROKER, --broker BROKER
ipaddress of MQTT broker (default: None)
-p PORT, --port PORT MQTT broker port number (default: 1883)
Expand Down
10 changes: 5 additions & 5 deletions roomba.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,13 +1485,13 @@ def broker_on_connect(client, userdata, flags, rc):
mqttc.subscribe(brokerCommand)
else:
for myroomba in roomba_list:
mqttc.subscribe(myroomba.roombaName+"/"+brokerCommand)
mqttc.subscribe(brokerCommand+"/"+myroomba.roombaName)
if brokerSetting != "":
if len(roombas) == 1:
mqttc.subscribe(brokerSetting)
else:
for myroomba in roomba_list:
mqttc.subscribe(myroomba.roombaName+"/"+brokerSetting)
mqttc.subscribe(brokerSetting+"/"+myroomba.roombaName)

def broker_on_message(mosq, obj, msg):
#publish to roomba, if there is more than one roomba, the roombaName is added to the topic to publish to
Expand Down Expand Up @@ -1670,9 +1670,9 @@ def setup_logger(logger_name, log_file, level=logging.DEBUG, console=False):
parser.add_argument('-f','--configfile', action='store',type=str, default="./config.ini", help='config file name (default: ./config.ini)')
parser.add_argument('-n','--roombaName', action='store',type=str, default="", help='optional Roomba name (default: "")')
parser.add_argument('-t','--topic', action='store',type=str, default="#", help='Roomba MQTT Topic to subscribe to (can use wildcards # and + default: #)')
parser.add_argument('-T','--brokerFeedback', action='store',type=str, default="/roomba/feedback", help='Topic on broker to publish feedback to (default: /roomba</name>/feedback)')
parser.add_argument('-C','--brokerCommand', action='store',type=str, default="/roomba/command", help='Topic on broker to publish commands to (default: /roomba</name>/command')
parser.add_argument('-S','--brokerSetting', action='store',type=str, default="/roomba/setting", help='Topic on broker to publish settings to (default: /roomba</name>/setting')
parser.add_argument('-T','--brokerFeedback', action='store',type=str, default="/roomba/feedback", help='Topic on broker to publish feedback to (default: /roomba/feedback</name>)')
parser.add_argument('-C','--brokerCommand', action='store',type=str, default="/roomba/command", help='Topic on broker to publish commands to (default: /roomba/command</name>)')
parser.add_argument('-S','--brokerSetting', action='store',type=str, default="/roomba/setting", help='Topic on broker to publish settings to (default: /roomba/setting</name>)')
parser.add_argument('-b','--broker', action='store',type=str, default=None, help='ipaddress of MQTT broker (default: None)')
parser.add_argument('-p','--port', action='store',type=int, default=1883, help='MQTT broker port number (default: 1883)')
parser.add_argument('-U','--user', action='store',type=str, default=None, help='MQTT broker user name (default: None)')
Expand Down

0 comments on commit 90e5202

Please sign in to comment.