|
Re: MQTT [message #1722011 is a reply to message #1721820] |
Tue, 02 February 2016 09:05 |
|
I added a short tutorial for you to the 4diac help files (ide source, will be contained within any new release) and the documentation provided on the 4diac website. please find it under Using Communication Protocols/MQTT with Eclipse Paho
|
|
|
|
Re: MQTT [message #1726158 is a reply to message #1725997] |
Thu, 10 March 2016 08:40 |
|
Hi,
may I ask soem question to better understand your use case?
Where is the temperature is coming from? Do you read it from one FORTE and want to comunicate it between two FORTEs via MQTT? If yes you also need to define a Publisher as well.
Are you providing the temperature value to someone else or is someon providing you the temperature value via MQTT? In this case you would need more information on the data format of your MQTT payload. Unfortunately MQTT does not define a payload format.
Cheers,
Alois
|
|
|
|
Re: MQTT [message #1726196 is a reply to message #1726181] |
Thu, 10 March 2016 13:50 |
|
Ok,
in this case you would have publishers in FORTE for the sensor topics and publshers for the PWM outputs. However you can not use the simple form as descirbed in the docs (i.e., fbdk[].mqtt[xxxx]) . You would need to implement your own communication layer that will take the mqtt packet and transform it to IEC datatypes and vice versa. If you have plain strings you maybe can go with Monika's raw layer.
Cheers,
Alois
|
|
|
Re: MQTT [message #1726200 is a reply to message #1726196] |
Thu, 10 March 2016 14:16 |
|
in case you want to send and receive STRING values you can use the raw layer by just specifying raw[].mqtt[...] please consider that you have to use a publisher with one SD_1 input and a subscriber with one RD_1 output
[Updated on: Thu, 10 March 2016 14:17] Report message to a moderator
|
|
|
|
Re: MQTT [message #1726230 is a reply to message #1726210] |
Thu, 10 March 2016 16:12 |
|
HI,
STRING_TO_x FBs and functions are existing. The FBs can be found in the IEC 61131-3 folder as they are defined in IEC 61131-3. The functions can directly be used in any ST code you write (e.g., myRealVar = STRING_TO_REAL(myStringvar).
I hope this helps.
Alois
|
|
|
|
|
|
Re: MQTT [message #1726336 is a reply to message #1726266] |
Fri, 11 March 2016 14:20 |
Martin Melik Merkumians Messages: 117 Registered: March 2016 |
Senior Member |
|
|
In this case, it is probably the easiest way to add print messages in the MQTTHandler.
In order to check if the client successfully connected to the broker, check the return value of the MQTTClient_connection function
Taken from the Paho client example
if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS)
{
printf("Failed to connect, return code %d\n", rc);
exit(-1);
}
HTH,
Martin
PS: If the connect was not successful this will also be observable via the STATUS output not showing the string OK
[Updated on: Fri, 11 March 2016 14:22] Report message to a moderator
|
|
|
|
|
|
|
Re: MQTT [message #1726568 is a reply to message #1726430] |
Mon, 14 March 2016 17:21 |
|
Hi Joseph,
the genrate communication FB feature currently only understands the clasic IEC 61499 UDP Publish/subscribe communication. If you would like to have MQTT communication you need to adjust the values for the ID parameter of the generated publish subscribe FBs according to the values described in the documentation.
Cheers,
Alois
|
|
|
|
Re: MQTT [message #1726654 is a reply to message #1726592] |
Tue, 15 March 2016 11:15 |
|
Hi would it be ok for you to post your project here? or at least screenshots of your fb networks?
If you have issues on the UDP Pub/Sub it may be a problem with your network setup (i.e., firewalls, UDP multicast routing, loop back device).
/Alois
|
|
|
|
Re: MQTT [message #1726723 is a reply to message #1726699] |
Tue, 15 March 2016 21:37 |
|
Hi,
would you mind zipping me the whol project directory. Makes it easier for me to import it into my 4DIAC workspace.
Alois
|
|
|
|
Re: MQTT [message #1726830 is a reply to message #1726736] |
Wed, 16 March 2016 17:43 |
|
Hi Joseph,
thanks this made it much easier. When you watch the outputs of your subscribe blcok which is subscribing to your mqtt topic what outputs do you get? You are using the fbdk layer as top layer configuration for your mqtt subscriber. With that our subscriber assumes that the payload of your mqtt message is encoding according to the definitions in the IEC 61499 Compliance Profile for Feasibility demonstrations. I don't think this is correct as this normally would only work if your the other end of your mqtt communication would also use this encoding. I guess here you better use for first tests the raw layer as suggested by Monika.
Alois
|
|
|
|
Re: MQTT [message #1748011 is a reply to message #1721820] |
Thu, 17 November 2016 16:53 |
|
I am also having issues with MQTT Subscribe.
My SUBSCRIBE_1 block has:
- ID set to use a raw layer ("raw[].mqtt[%broker_uri%, 4diac-benjamin-sub, 4diac/stop]")]
- QI = TRUE
but the STATUS is always "TERMINATED".
If I try to switch to fbdk, the STATUS is "INVALID_ID"
In both cases, MQTT messages can't be received.
FWIW, I have in the same app a working PUBLISH_1 FB, that uses the very same broker URI.
My blog: http://blog.benjamin-cabe.com
|
|
|
|
|
|
Re: MQTT [message #1750576 is a reply to message #1750575] |
Thu, 22 December 2016 22:13 |
|
Which FORTE version are you using. We fixed an issue in MQTT code for version 1.8.3 which we released today. Could you please give it a try?
|
|
|
Powered by
FUDForum. Page generated in 0.08927 seconds