Send data to rapid Scada through JSON MQTT Message

Forum Home Forums Communicating with Devices Send data to rapid Scada through JSON MQTT Message

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #8207
    AvatarODONADO
    Participant

    Hi,

    I have a problem to get data through JSON MQTT Message. I download the KpMqtt zip file from RapidScada/scada-community github page and I copied and pasted 3 files (job.js, jint.dll and kpMQTT.dll) into SCADA\Scadacomm\KP folder and the last file (KpMqtt_Config.xml) to the Scadacomm config folder into the instance project. I created the line communication and de device and all works fine, when I publish a value to /mesparam1 and /mesparam2 topic, the value is shown in Rapid Scada but when I publish to /mesparam11 topic in JSON format (how is explained in the readme file) the new value doesn’t refresh in RapidScada.

    This link show the KpMqtt_Config file KpMqtt_Config

    This link show the rapidScada view after the last value sent by /mesparam1 and /mesparam2 topic RapidScada view

    This link show the message monitoring later than publish the JSON message by topic /mesparam11 MQTT messages logs

    Later than receive the /mesparam11 topic, the script publish the value received in the JSON message to the /mesparam10 topic, but this publish doesn’t change the channel 600 value, I would think that the publish should be to the /mesparam1 topic. I don’t know if i’m wrong in the config files. Could someone help me?

    Thank you very much.

    #8211
    MikhailMikhail
    Moderator

    Hi,

    Let me clarify the problem:
    1. You successfully read /mesparam1 and /mesparam2, right?
    2. Did you check in Webstation interface if channel 600 and 601 change?
    3. Is the problem that you cannot publish channel 600 to /mesparam10 or something else?

    #8216
    AvatarODONADO
    Participant

    Hi, Thanks for your answer.

    Let me explain better. In the config file (image 1) I subscribe to channel 600 and 601 by the topics /mesparam1 and /mesparam 2 respectively. When I publish a message from my cellphone (for example) to this topics the values change in the webstation without problem. Until here all is fine.

    The problem is when I try to send a value in JSON format. How is explain on the KpMqtt driver repository at the end of the page, a JSON format message like {“Num”:600,”Val”:200.3,”Stat”:0} is possible by the javascript script (job.js), and in the config file it’s specify in the <MqttSubJSs> node, where the topic is /mesparam11, so, when I publish a JSON format message from my cellphone to this /mesparam11 topic, I see that the value is recognize because the script responds to /mesparam10 topic with the new value (imgage 3), but in the webstation doesn’t change. Time later, there is a new automatic publish from /mesparam10 topic but with the old value, confirming that the value didn’t change.

    So, I understand this: channel 600 and 601 changes when receive a valid message from /mesparam1 and /mesparam2 topics and this is why the first procedure works, but the script when receive a message from /mesparam11 topic, it recognize the value, but doesn’t change in the webstation because the script publish the new value to /mesparam10 topic and it should publish to /mesparam1 topic to make the change, simulating the first procedure, so maybe there is a failure in the script.

    That is what I think, but I don’t know if my config file is wrong or maybe I’m omitting steps to setup the use of JSON format messages.

    Thank you very much

    #8227
    MikhailMikhail
    Moderator

    Hi,

    Thank you for the details. I’m not the initial author of the driver, but I have some thoughts about that.

    but in the webstation doesn’t change.

    The value can be transferred from the device driver to the Server app and then to Webstation, if it is presented in the list of device tags.
    What if you add /mesparam11 to MqttSubTopics section and bind to a channel 602?

    Are you a C# developer? If yes, I can help you with debugging the driver to understand how it works in accordance to your question.

    What is your final aim by sending JSON values?

    #8228
    MikhailMikhail
    Moderator

    The source code that process JS is here.

    #8229
    MikhailMikhail
    Moderator

    I think you should not send a value to the channel 600, because is it get from the device tags. You should create a separate input channel that has empty signal field.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.