Closed rezendel closed 3 years ago
Maybe you need provide user and password for your broker in mosquito_pub command ?
mosquitto_pub -t /json/ABCDEF/id_sen1/attrs -m '{"h": 70, "t": 15}' -h <mosquitto_broker> -p <mosquitto_port> -u <user> -P '<passwrod>'
Thank you Alvaro, I was missing the -P and '' on the message sorry :(
But now it worked on the terminal, I just need to work on device now.
Thank you very much.
I solved the issue for the device as well. Thank you very much!
Hello, I hope this message finds you well.
I just started to use fiware for a academic project, so apologies if I ask something trivial.
I'am trying to use the following command line structure to publish on the to the iot-json agent, but I could not get it to work from terminal. (try to send gps data)
$ mosquitto_pub -t /json/ABCDEF/id_sen1/attrs -m '{"h": 70, "t": 15}' -h -p -u
please see my code.
mosquitto_pub -t /json/4jggokgpepnvsb2uv4s40d59ov/gps002/attrs -m {"l": [10.2424, 45.5642]}' \ -h localhost -p 1883
when I try this command it works fine:
sudo docker run -it --rm --name mqtt-publisher --network \ fiware_default efrecon/mqtt-client pub -h mosquitto -m '{"l": [65.2424, 45.5642]}' \ -t "/4jggokgpepnvsb2uv4s40d59ov/gps002/attrs"
I am using a architecture with orion context broker + IoT Agent Json + MQTT Broker
I am also trying to send coordinate data from a ESP32 using arduino library, I could not get the data to topic as well. I can get a MQTT connection but it looks like that the data doesn't reach the mqtt topic.
After the code serialize using Json the message format looks like this. {"l":"[23.6666, 24.6574]"}, I'm not sure if this would be a issue.
I don't know if my code on this could help, but here it is:
// Author Leandro Rezende // 06/12/2020 19h
include // SPI bus
include //
include
include
include
include
include
// para testes rede local
include
//Dados para conexão ao WiFi
const char SSID = "Rolima"; const char PWD = "38362945";
//const char SSID = "JULIANA"; //const char PWD = "lela7910";
// função para conexão ao wifi
void connectToWiFi(){
} // fim da função wifi
/////////////////////// MQTT
const char mqtt_server = "192.168.15.134"; const char Device_Fiware ="urn:ngsi-ld:Gps:002"; //const char* Device_Fiware ="gps002"; WiFiClient espClient; PubSubClient mqttClient(espClient);
String value; /// conectando no topico do dojo
void connectToFiware(){ mqttClient.setServer(mqtt_server,1883);
} // fim código conexão Fiware
//publica no Fiware
void PublicaFiware(){
}
void setup() { // put your setup code here, to run once:
}
void loop() { // put your main code here, to run repeatedly:
PublicaFiware();
}
Thank you