Forum Home › Forums › Communicating with Devices › MQTT driver publish comma decimal point
Tagged: mqtt
- This topic has 15 replies, 4 voices, and was last updated 5 years, 10 months ago by Peter de Groot.
-
AuthorPosts
-
December 2, 2017 at 10:48 am #2906kumajayaParticipant
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.
December 2, 2017 at 2:09 pm #2908MikhailModeratorHi,
Try contacting the author of the driver by creating an issue on GitHub.
This error is specific to the driver.December 2, 2017 at 4:40 pm #2912kumajayaParticipantThanks 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 6 years, 4 months ago by kumajaya.
December 3, 2017 at 12:59 am #2914kumajayaParticipantHi 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.
December 4, 2017 at 7:20 am #2915MikhailModeratorHi,
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!
December 5, 2017 at 10:56 am #2917kumajayaParticipantI just opened a pull request to force use periode (.) as decimal separator. Please check https://github.com/bersim/OpenKPs/pull/5/files . Thank you.
December 5, 2017 at 4:46 pm #2918MikhailModeratorAlso you can use CultureInfo.InvariantCulture instead of creating NumberFormatInfo every time.
December 5, 2017 at 4:47 pm #2919MikhailModeratorNote: I’m not an author of this driver ))
December 6, 2017 at 11:39 am #2920kumajayaParticipantThe 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
December 7, 2017 at 10:10 am #2921MikhailModeratorWow, beautiful!
December 7, 2017 at 3:55 pm #2922kumajayaParticipantOr 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 🙁
January 28, 2018 at 8:02 pm #3059anuniaParticipantHi 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 LineScadaCommSvcConfig.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!
January 29, 2018 at 11:20 am #3062May 27, 2018 at 5:53 pm #3763Peter de GrootParticipantI am a happy user of Rapidscada, and would like to use it with MQTT, but I am not a programmer, and getting a lot of errors while building the MQTT project. Can anyone compile the project MQTT for me?
Much appreciated
Peter
May 28, 2018 at 6:16 pm #3764MikhailModeratorHi Peter,
I suggest to create an issue on GitHub https://github.com/bersim/OpenKPs/tree/master/KpMQTT
If you do this, the author of this driver receives a notificationIf you need, the dlls are here
-
AuthorPosts
- You must be logged in to reply to this topic.