apparently I'm too dumb to make commands work. Is there an example code available?
I have these reportings available, so api-mqtt works.
I try to command several variants without success ...
1) with mosquitt_pub
2) through some python library (haven't spend too much time on it)
I have these reportings available, so api-mqtt works.
myCaSSAndRA/status ready
myCaSSAndRA/robot {"status": "charging", "dockReason": null, "battery": {"soc": 81, "voltage": 27.3, "electricCurrent": -1.49}, "position": {"x": 2.56, "y": 5.28}, "target": {"x": 0.9, "y": 4.08}, "angle": 0.63}
myCaSSAndRA/maps {"loaded": "Perk1_full_20240719", "available": ["Kitchen_20240510", "Toilet_20240512", "Front_20240709", "Perk1_east_20240710a", "Perk1_east_20240710b", "Perk1_east_20240712", "Perk1_West_20240713e", "Toilet_temp", "Toilet_20240713b", "Front_noDock", "Front_20240713", "Perk1_east_nodock", "Perk1_east_20240713", "Kitchen_nodock", "Kitchen_20240713", "Font_20240714", "Perk1_full", "Perk1_full_nodock", "Perk1_full_20240714a", "Perk1_full_20240719"]}
myCaSSAndRA/tasks {"selected": [], "loaded": [], "available": ["CutPerk1"]}
myCaSSAndRA/mow parameters {"pattern": "lines", "width": 0.18, "angle": 38, "distancetoborder": 3, "mowarea": true, "mowborder": 4, "mowexclusion": true, "mowborderccw": true}
myCaSSAndRA/map {"mapId": "7c8d576e-6fb7-4398-bc8b-694a99de844a", "previewId": "ceac3763-1e46-4a53-896a-38bbfc5d682a", "mowprogressIdxPercent": 0, "mowprogressDistancePercent": 0}
I try to command several variants without success ...
1) with mosquitt_pub
the message with and without slashes, I do not manage to change the loaded map.mosquitto_pub -h 192.168.0.205 -t CaSSAndRA_api -u xxxx -P xxx -m "{\"maps\": {\"command\": \"load\", \"value\": [\"Toilet_20240713b\"]}}"
mosquitto_pub -h 192.168.0.205 -t "myCaSSAndRA/CaSSAndRA_api" -u xxx -P xxx -m "{\"maps\": {\"command\": \"load\", \"value\": [\"Toilet_20240713b\"]}}"
2) through some python library (haven't spend too much time on it)
import paho.mqtt.client as mqtt
import json
MQTT_HOST = "192.168.0.205"
MQTT_PORT = 1883
MQTT_KEEPALIVE_INTERVAL = 10
MQTT_TOPIC = "CaSSAndRA_api"
MQTT_MSG=json.dumps({"maps": {"command": "load", "value": ["Toilet_20240713b"]}})
mqttc = mqtt.Client()
mqttc.username_pw_set(username="xxx",password="xxxx")
mqttc.connect(MQTT_HOST, MQTT_PORT, MQTT_KEEPALIVE_INTERVAL)
mqttc.publish(MQTT_TOPIC, MQTT_MSG)
