KpMQTT and Thingsboard

Forum Home Forums Communicating with Devices KpMQTT and Thingsboard

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #3060
    anunia
    Participant

    Hi there, I am trying to get working Rapid Scada and Thingsboard together but without success 🙁
    At the moment, I did build KpMQTT.dll and did create a new comm line and communication file for MQTT but I can’t get the communicator working, maybe I am missing something about MQTT and this driver… I want to publish Rapid Scada data to Thingsboard server (i.e: collect some data using a Modbus device and replicate some channels data into new ones MQTT channels to publish this data to Thingsboard).

    These are my config files:
    ScadaCommSvcConfig.xml line

        <CommLine active="true" bind="true" number="6" name="MQTT">
          <CommChannel type="" />
          <LineParams>
            <Param name="ReqTriesCnt" value="3" descr="Device request retries count on error" />
            <Param name="CycleDelay" value="0" descr="Delay after request cycle, ms" />
            <Param name="CmdEnabled" value="true" descr="Commands enabled" />
            <Param name="ReqAfterCmd" value="false" descr="Request device after command" />
            <Param name="DetailedLog" value="true" descr="Write detailed information to the log" />
          </LineParams>
          <CustomParams />
          <ReqSequence>
            <KP active="true" bind="false" number="61" name="Test MQTT" dll="KpMQTT.dll" address="0" callNum="" timeout="0" delay="1000" time="00:00:00" period="00:00:00" cmdLine="KpMQTT_Config.xml" />
          </ReqSequence>
        </CommLine>

    KpMQTT_Config.xml file

    <?xml version="1.0" encoding="utf-8"?>
    <DevTemplate>
      <MqttParams Hostname="127.0.0.1" ClientID="" Port="1883" UserName="" Password=""/>
      <RapSrvCnf ServerHost="127.0.0.1" ServerPort="10000" ServerUser="ScadaComm" ServerPwd="12345"/>
      <MqttPubTopics>
      	<Topic TopicName="/input/600" QosLevel="0" NumCnl="600" PubBehavior="OnChange" Retain="true" NDS="."/>
      	<Topic TopicName="/input/601" QosLevel="0" NumCnl="601" PubBehavior="OnChange" Retain="true" NDS="."/>
      </MqttPubTopics>
    </DevTemplate>

    Also, I did create the comm line, device and channels for MQTT on SCADA-Administrator but I cannot communicate both systems.
    Could anyone give me some advice about what am I doing wrong or what do I need to add please?
    I guess I am missing the channel mapping between Rapid Scada and Thingsboard device (telemetry data), also, I can`t figure out where to place the device ACCESS_TOKEN

    Thank you in advance!

    #3061
    Mikhail
    Moderator

    Hi,

    Did you check the log of the communication line? Is there something useful?
    I recommend to contact the author of the MQTT driver. His email is shared on the GitHub page.

    #3063
    anunia
    Participant

    Hi Mikhail, you are right, I did contact the author so I will to publish the solution here later.

    #5942
    kumajaya
    Participant

    Sorry for my late reply, ThingsBoard expect json formatted payload: https://github.com/kumajaya/scada-community/commit/a8a7bce35deb4c3f1e0ae604be3685b47d2e1027

    #5943
    kumajaya
    Participant

    Example config, ACCESS_TOKEN as UserName:

    <?xml version="1.0" encoding="utf-8"?>
    <DevTemplate>
    	<MqttParams Hostname="127.0.0.1" ClientID="KpMQTTrs111" Port="1884" UserName="owMdAakfgOlUOUwF0mpB" Password=""/>
    	<RapSrvCnf ServerHost="127.0.0.1" ServerPort="10000" ServerUser="ScadaComm" ServerPwd="12345"/>
    	<MqttSubTopics>
    	</MqttSubTopics>
    	<MqttPubTopics>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="13" Prefix="{ &quot;p0&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="14" Prefix="{ &quot;p1&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="15" Prefix="{ &quot;p2&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="16" Prefix="{ &quot;p3&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="26" Prefix="{ &quot;p4&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="27" Prefix="{ &quot;p5&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="28" Prefix="{ &quot;p6&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="29" Prefix="{ &quot;p7&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="31" Prefix="{ &quot;p8&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="33" Prefix="{ &quot;p9&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="30" Prefix="{ &quot;v0&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="32" Prefix="{ &quot;v1&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    		<Topic TopicName="v1/devices/me/telemetry" QosLevel="1" NumCnl="25" Prefix="{ &quot;v2&quot;:" Suffix=" }" PubBehavior="OnChange" Retain="false" NDS="."/>
    	</MqttPubTopics>
    	<MqttPubCmds>
    	</MqttPubCmds>
    	<MqttSubCmds>
    	</MqttSubCmds>
    	<MqttSubJSs>
    	</MqttSubJSs>
    </DevTemplate>
    #5945
    Mikhail
    Moderator

    Do you mean that the issue is fixed?

    The latest version of KpMqtt.dll is available at https://github.com/RapidScada/scada-community/releases

    #5946
    kumajaya
    Participant
    #5947
    Mikhail
    Moderator

    Could you explain:
    1. What is Thingsboard?
    2. Why this device can not be polled as usual?

    #5948
    kumajaya
    Participant

    From ThingsBoard’s FAQ https://thingsboard.io/docs/faq/#what-is-thingsboard :
    ThingsBoard is an open-source server-side platform that allows you to monitor and control your IoT devices. It is free for both personal and commercial usage and you can deploy it anywhere.

    ThingsBoard’s Mqtt API reference: https://thingsboard.io/docs/reference/mqtt-api/

    ThingsBoard's Dashboard

    • This reply was modified 2 years, 8 months ago by kumajaya.
    #5950
    kumajaya
    Participant

    Update for example dashboard from my personal project:
    ThingsBoard Dashboard

    Big screen ThingsBoard Dashboard

    • This reply was modified 2 years, 8 months ago by kumajaya.
    #5952
    kumajaya
    Participant

    I have found why my old binary more reliable maintain connection to ThingsBoard than the current version. Revert https://github.com/bersim/OpenKPs/commit/cbf039eccbbd17b1ae6b0c66dd4db04237b4969f restore reconnection feature.

    #5953
    Mikhail
    Moderator

    Yes, this is a significant bug.
    We plan to refactor the driver inside the https://github.com/RapidScada/scada-community repository.

    #5954
    kumajaya
    Participant

    It’s good if you rebase it to upstream Strider Mqtt https://github.com/ericvoid/StriderMqtt I’m not that expert to rewrite a driver from scratch.

    #9285
    german
    Participant

    Hello every one. I received the Json data feedback from thingsboard server as below
    Receive packet
    v1/devices/me/rpc/request/450 = {“method”:”setValue”,”params”:true}
    Now I want to get value of Attribute “method” and “params”. Can everyone help me. Thanks so much.

    #9286
    Mikhail
    Moderator

    Hi,

    You need to parse the response using JavaScript engine of the driver.
    kp_mqtt_5.0.4.0.zip contains KpMqtt_Job.js which can be used as example.
    But string values are not supported. Can you change method value to a number?

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