MQTT driver publish comma decimal point

Forum Home Forums Communicating with Devices MQTT driver publish comma decimal point

Tagged: 

This topic contains 12 replies, has 3 voices, and was last updated by Mikhail Mikhail 3 weeks, 5 days ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #2906

    kumajaya
    Participant

    Opposite to http://forum.rapidscada.ru/?topic=%D0%B2%D0%BE%D0%BF%D1%80%D0%BE%D1%81%D1%8B-%D0%BF%D0%BE-scada-communicator/#post-5065 , I can’t publish proper value to Cayenne dashboard because MQTT driver push floating value with comma decimal point instead dot. Is this Rapid SCADA issue in general or MQTT driver specific? I have also opened the issue in github: https://github.com/bersim/OpenKPs/issues/4 Thanks in advance.

    #2908
    Mikhail
    Mikhail
    Moderator

    Hi,
    Try contacting the author of the driver by creating an issue on GitHub.
    This error is specific to the driver.

    #2912

    kumajaya
    Participant

    Thanks for your quick response Mikhail. Rapid SCADA data on Cayenne dashboard look really nice actually https://drive.google.com/file/d/1ZKeZvDKcrqf7rO28j8QGViMIN0yhSuxZ/view

    • This reply was modified 2 months, 3 weeks ago by  kumajaya.
    #2914

    kumajaya
    Participant

    Hi Mikhail, I found nothing in MQTT driver source code but plain double to string conversion https://github.com/bersim/OpenKPs/blob/1c0009699895bcc886c31169565681e76cacfae9/KpMQTT/MQTTPubTopic.cs#L62 and https://github.com/bersim/OpenKPs/blob/1c0009699895bcc886c31169565681e76cacfae9/KpMQTT/KpMQTTLogic.cs#L357 for publishing and plain string to double conversion (with regex filter for commas) https://github.com/bersim/OpenKPs/blob/1c0009699895bcc886c31169565681e76cacfae9/KpMQTT/KpMQTTLogic.cs#L238 for subscribing. Is this related to development environment locale setting? Since I don’t have development environment for building MQTT driver from source, if don’t mind please rebuild MQTT driver on yours machine and share the resulted binary to us. Thanks in advance.

    #2915
    Mikhail
    Mikhail
    Moderator

    Hi,

    mqtttp.Value.ToString() and Convert.ToDouble(pv) use the default conversion depending on system settings. If you know C#, can you install Visual Studio Community Edition and debug the source code? May be the MQTT Core receives data with comma.

    Cayenne dashboard is really nice!

    #2917

    kumajaya
    Participant

    I just opened a pull request to force use periode (.) as decimal separator. Please check https://github.com/bersim/OpenKPs/pull/5/files . Thank you.

    #2918
    Mikhail
    Mikhail
    Moderator

    Also you can use CultureInfo.InvariantCulture instead of creating NumberFormatInfo every time.

    #2919
    Mikhail
    Mikhail
    Moderator

    Note: I’m not an author of this driver ))

    #2920

    kumajaya
    Participant

    The last release fix the problem. With ThingSpeak help, Rapid SCADA data on home screen looks very nice: https://drive.google.com/file/d/1dm5cWsnaVaxClzg-uqL6XUmPee8KieM1/view

    #2921
    Mikhail
    Mikhail
    Moderator

    Wow, beautiful!

    #2922

    kumajaya
    Participant

    Or visualize Rapid SCADA data on Thingsboard dashboard: https://drive.google.com/file/d/1iu7C1IJTgvceWv4o-9pmIizj_fxtT2R3/view

    But need MQTT driver change to add message prefix and suffix to reconstruct json formatted payload 🙁

    #3059

    anunia
    Participant

    Hi kumajaya, did you get Rapid Scada and Thingsboard working together? I am trying to get it working but with no success :(.
    At the moment I just build the KpMQTT.dll, added the KP to Rapid and did create a config file for MQTT Comm Line

    ScadaCommSvcConfig.xml line

    <!--Line 6-->
        <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="200" 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="KpMQTTrs" Port="1883" UserName="" Password=""/>
      <RapSrvCnf ServerHost="127.0.0.1" ServerPort="10000" ServerUser="ScadaComm" ServerPwd="12345"/>
      <MqttSubTopics>
      	<Topic TopicName="/input/600" QosLevel="0" NumCnl="600"/>
      	<Topic TopicName="/input/601" QosLevel="0" NumCnl="601"/>
      </MqttSubTopics>
    </DevTemplate>

    Also, I did create the comm line, device and channels on SCADA-Administrator but I cannot communicate both systems. Could you 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)

    Thank you in advance!

    #3062
    Mikhail
    Mikhail
    Moderator

    To avoid duplication, use this link to post.

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.