I’m using a Raspi 4 with “Node Red” 3.0.2. Further, I have a “Cumulocity IOT Plattfrom Free Trial” running.
Detailed explanation of the problem:
I’m trying to connect over MQTT and create a device according the description “Hello MQTT” under “MQTT client examples” from Cumulocity IOT Guide.
cumulocity(.)com/guides/device-integration/mqtt-examples/#hello-mqtt
I use a “mqtt out” node configured as follows:
Topic: s/us
Payload: 100, My first MQTT device, c8y_MQTTdevice
mqtt-Server: env979ZXY.eu-latest.cumulocity(.)com/mqtt
User: env979ZXY/emailadress_for_cumulocityIOT_Login
PW: Password_for_cumulocityIOT_Login
Error messages / full error message screenshot / log file:
The Node-Red Flow with the mqtt-client, can not connect to the cumulocity plattfrom and also not create a device in the cumulocity platfrom over SMARTREST.
Does anybody has an example how to connect and create a device and measurement with node-red, mqtt and SMARTREST?
Thank you for your help or any ideas, what I could try.
Thank you for the tips.
The problem is, that I cannot subscribe to any topic or publish something, becasue Node-Red can not connect to the Cumulocity Platfrom.
Hi,
just tried it out, it’s definitely working. Try changing:
Server from eu-latest.cumulocity.com to mqtt.eu-latest.cumulocity.com (note the mqtt. prefix at beginning)
changing protocol from MQTT V3.1 (legacy) to MQTT V3.1.1
activate the TLS checkbox (that’s important, Node Red won’t connect on port 8883 otherwise)
Neither with Node Red or with Python code as shown in the “MQTT client examples” descriptions
It’s strange that also Python code does not connect though. Is this running within a company network/VPN where network policies might block MQTT? To be sure, maybe try running it in e.g. a mobile hotspot or a network you’re sure there’s nothing blocking outgoing MQTT traffic.
Settings looking similar as on my side now and it should also work on trial tenants. If that’s helpful, I can PN you the flow I’m using tomorrow.
Could be that this issue is about your User. Can you login to the UI and navigate to Administration > Accounts > Users > your “hofmar” user and paste a screenshot? I would like to see if the global roles on the right side are editable + the assigned roles of this user.
Note that:
In general there’s a bootstrapping process via MQTT where you would register your client on Cumulocity and receive a device-user back. Devices are expected to use this user, especially in productive environments. The process is described here: Startup Phase
For testing purposes you can also use your personal user. But you have to make sure it is not a User managed by an external authorization/SSO Server. The screenshot above should tell if that’s the case.
Thank you for your help.
Everything is checked and editable.
Yes, please send me the flow if possible.
If you have a flow for http request with REST, please also send it to me, because this is also not working.
I’ve sent you a flow with MQTT and HTTP Nodes that did work for me.
If you have a flow for http request with REST, please also send it to me, because this is also not working.
That’s an important hint that I would prioritize here. Can you do API Calls with this User at all (e.g. using Postman, Insomnia or any other API client)? What’s the server response for your failing requests?
Thank you for the response. @Stefan_Witschel: I have tried with 8883 and 1883, but a connection is not established. @Murat_Bayram: I have tried with alias “Martin” and user “hofmar” from the same user, but a connection was not established.
@Korbinian_Butz: I will try your flows and give you an aswer. But the user looks like it should work?
It seems you have connectivity issues… If you can’t connect via python or node-red it seems that some firewall is blocking your outgoing connection to cumulocity on port 8883, 1883.
@Murat_Bayram@Stefan_Witschel : The same node red device is connected to AWS IOT Core over MQTT and a MQTT Broker in the internet. So that should not be the issue. I will try again later
Thank you for the support, now I was able to connect.
It seems, that first the problem was, that I have tried to connect with a user with external origin.
Then later the problem was a typo in the password from the new user.
It helped to do the API call and receive the error, to find out, that there was a typo.
Thank you very much for your effort in supporting me.