v6, DrvDsMqtt not publishing anything.

Forum Home Forums Uncategorized Issues v6, DrvDsMqtt not publishing anything.

Tagged: , ,

Viewing 15 posts - 1 through 15 (of 32 total)
  • Author
    Posts
  • #11414
    zzz
    Participant

    Config as follows

    
        <DataSource active="true" code="MqttServer" name="Mqtt Publish" driver="DrvDsMqtt">
          <Option name="ClientID" value="esp_rs6" />
          <Option name="DataLifetime" value="60" />
          <Option name="DetailedLog" value="True" />
          <Option name="DeviceFilter" value="" />
          <Option name="MaxQueueSize" value="1000" />
          <Option name="Password" value="C8080E774B59B0C6694063BDE2428352" />
          <Option name="Port" value="1883" />
          <Option name="ProtocolVersion" value="Unknown" />  
          <Option name="PublishFormat" value="{&quot;Val&quot;: @val,&quot;Stat&quot;: @stat}" />
          <Option name="QosLevel" value="1" />
          <Option name="Retain" value="False" />
          <Option name="RootTopic" value="Communicator" />
          <Option name="Server" value="127.0.0.1" />
          <Option name="Timeout" value="10000" />
          <Option name="UndefinedValue" value="NaN" />
          <Option name="Username" value="esp_rs6" />
    

    – tried protocol version 3.11/3.1/5.0, 3.x give errors can’t conenct.
    – tried both topic “Communicator/” and “Communicator”
    – Qos tried both 0 and 1 nothing changed.
    – DrvDsMqtt_MqttServer.log reports successfully subscribed to command topic
    – After that in ScadaComm.txt, Mqtt Publish‘s current data queue vary from 0~3/1000.
    – But in tcpdump -ni lo tcp port 1833 in console, no port 1833 traffic is captured after drv log report connected, subscribed.
    – MQTTExpolorer show no new topic/message on broker.

    • This topic was modified 1 year, 6 months ago by zzz.
    #11421
    kumajaya
    Participant

    Let me try later today since I have my own Mqtt server locally and on the cloud.

    #11425
    Mikhail
    Moderator

    Screenshots and logs may help.

    I tested the MQTT data source with the following parameters:

    ClientID = 
    DataLifetime = 60
    DetailedLog = False
    DeviceFilter = 
    MaxQueueSize = 1000
    Password = C8080E774B59B0C6694063BDE2428352
    Port = 1883
    ProtocolVersion = Unknown
    PublishFormat = 
    QosLevel = 0
    Retain = False
    RootTopic = Communicator/
    Server = broker.mqtt-dashboard.com
    Timeout = 10000
    UndefinedValue = NaN
    Username = 

    Communication channel options:

    ClientID = 
    Password = C8080E774B59B0C6694063BDE2428352
    Port = 1883
    ProtocolVersion = Unknown
    Server = broker.mqtt-dashboard.com
    Timeout = 10000
    Username = 
    #11434
    zzz
    Participant

    I suggest try mosquitto -v -c /etc/mosquitto/mosquitto.conf
    Here is my mosquitto output

    
    1666794716: mosquitto version 2.0.11 starting
    1666794716: Config loaded from /etc/mosquitto/mosquitto.conf.
    1666794716: Opening ipv4 listen socket on port 1883.
    1666794716: mosquitto version 2.0.11 running
    1666795011: New connection from 127.0.0.1:37370 on port 1883.
    1666795011: New client connected from 127.0.0.1:37370 as esp_rs6 (p2, c1, k15, u'esp_rs6').
    1666795011: No will message specified.
    1666795011: Sending CONNACK to esp_rs6 (0, 0)
    1666795011: Received SUBSCRIBE from esp_rs6
    1666795011:     Communicatorcommand (QoS 2)
    1666795011: esp_rs6 2 Communicatorcommand
    1666795011: Sending SUBACK to esp_rs6
    1666795026: Received PINGREQ from esp_rs6
    1666795026: Sending PINGRESP to esp_rs6
    1666795041: Received PINGREQ from esp_rs6
    1666795041: Sending PINGRESP to esp_rs6
    1666795056: Received PINGREQ from esp_rs6
    1666795056: Sending PINGRESP to esp_rs6
    1666795071: Received PINGREQ from esp_rs6
    1666795071: Sending PINGRESP to esp_rs6
    ... PINGs only
    
    

    The configuration is identical to Mik’s above except for the ClientID, UserName.

    
    <DataSource active="true" code="MqttServer" name="Mqtt Publish" driver="DrvDsMqtt">
          <Option name="ClientID" value="esp_rs6" />
          <Option name="DataLifetime" value="60" />
          <Option name="DetailedLog" value="False" />
          <Option name="DeviceFilter" value="" />
          <Option name="MaxQueueSize" value="1000" />
          <Option name="Password" value="C8080E774B59B0C6694063BDE2428352" />
          <Option name="Port" value="1883" />
          <Option name="ProtocolVersion" value="Unknown" />
          <Option name="PublishFormat" value="" />
          <Option name="QosLevel" value="0" />
          <Option name="Retain" value="False" />
          <Option name="RootTopic" value="Communicator/" />
          <Option name="Server" value="127.0.0.1" />
          <Option name="Timeout" value="10000" />
          <Option name="UndefinedValue" value="NaN" />
          <Option name="Username" value="esp_rs6" />
        </DataSource>
    
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    2022-10-26 22:51:03 MQTT data source started
    2022-10-26 22:51:03 Detailed log is disabled
    
    2022-10-26 22:51:03 Connect to 127.0.0.1:1883
    Connected successfully
    
    2022-10-26 22:51:03 Subscribe to command topic
    
    /* restarted ScadaComm to change setting */
    2022-10-26 22:53:59 Disconnect from 127.0.0.1:1883
    
    2022-10-26 22:53:59 MQTT data source stopped
    
    #11435
    zzz
    Participant

    Maybe this is also related ?

    
      <GeneralOptions>
        <IsBound>                   true</IsBound>
        <SendModifiedData>          false</SendModifiedData>
        <SendAllDataPeriod>         60</SendAllDataPeriod>
        <EnableCommands>            true</EnableCommands>
        <EnableFileCommands>        true</EnableFileCommands>
        <StartLinesOnCommand>       false</StartLinesOnCommand>
        <MaxLogSize>                1</MaxLogSize>
      <GeneralOptions>
    
    #11436
    zzz
    Participant

    Does this send any channel data ?
    or only listens for command on Communicator/Command ?

    If it listens for command only, maybe I can check if the command works?
    But how should I issue any command over DsDrvMqtt ?

    Just a side note,

    4.7.1.1 Topic level separator

    The forward slash (‘/’ U+002F) is used to separate each level within a topic tree and provide a hierarchical structure to the Topic Names… Adjacent Topic level separators indicate a zero length topic level.

    Strictly speaking, Communicator/ is a sub topic of Communicator with a zero-length sub level topic ‘. Maybe the trailing “/” should be left out.

    • This reply was modified 1 year, 6 months ago by zzz.
    #11450
    Mikhail
    Moderator

    Let me try later today since I have my own Mqtt server locally and on the cloud.


    @kumajaya
    , if you already have tried the MQTT publishing data source, could you share the experience?

    #11451
    Mikhail
    Moderator

    @zzz, do you get data from Communicator to ScadaServer successfully?

    #11453
    zzz
    Participant

    I think its working. The basic aspects of v6 work as expected now. Data polled from plc, and I can view minute data plot of all 77 channels for the last 2 days in webstation. It’s just that I didn’t notice any activity in mqtt broker.

    Again I recommend giving Mqtt Exploer a try. By default it subscribes to server root(#), all topics are visible in a clean tree. It also allows for charting of values in JSON payloads in just a few clicks. Very nice for debugging and server topics exploring.

    #11457
    zzz
    Participant

    I lost access to my previous instance due to power outage. Just re-setup a new one, this time the Hello World project from repo/Project folder is used. MqttDsDrv is enabled. The output from broker is similar.

    
    1667115000: Loading config file /etc/mosquitto/conf.d/remote-p1883.conf
    1667115000: mosquitto version 2.0.11 starting
    1667115000: Config loaded from /etc/mosquitto/mosquitto.conf.
    1667115000: Opening ipv4 listen socket on port 1883.
    1667115000: mosquitto version 2.0.11 running
    1667115001: New connection from 127.0.0.1:35846 on port 1883.
    1667115001: New client connected from 127.0.0.1:35846 as esp_rs6a (p2, c1, k15, u'esp_rs6a').
    1667115001: No will message specified.
    1667115001: Sending CONNACK to esp_rs6a (0, 0)
    1667115001: Received SUBSCRIBE from esp_rs6a
    1667115001:     Communicator/command (QoS 2)
    1667115001: esp_rs6a 2 Communicator/command
    1667115001: Sending SUBACK to esp_rs6a
    1667115016: Received PINGREQ from esp_rs6a
    1667115016: Sending PINGRESP to esp_rs6a
    1667115031: Received PINGREQ from esp_rs6a
    1667115031: Sending PINGRESP to esp_rs6a
    

    To get mosquitto to output the above message in console,
    I forgot one thing:
    log_dest stderr must but be put into the config file e.g.

    
    /etc/mosquitto/conf.d/console_test.conf
    
    log_dest stderr
    listener 1883 127.0.0.1
    protocol mqtt
    allow_anonymous true
    persistence false
    

    Also mosquitto service must be stopped before running mosquitto in console.
    Or mosquitto will not start and gives no error message.

    
    systemctrl stop mosqiutto
    mosquitto -v -c /etc/mosquitto/mosquitto.conf
    
    • This reply was modified 1 year, 5 months ago by zzz.
    • This reply was modified 1 year, 5 months ago by zzz.
    • This reply was modified 1 year, 5 months ago by zzz.
    #11467
    Mikhail
    Moderator

    So does the MQTT data source publish data or not?

    #11468
    zzz
    Participant

    If it works, it should look sth. like below.

    
    root# mosquitto -v -c /etc/mosquitto/mosquitto.conf 
    1667213406: Loading config file /etc/mosquitto/conf.d/log+cache.conf
    1667213406: Loading config file /etc/mosquitto/conf.d/remote-p1883.conf
    1667213406: mosquitto version 2.0.11 starting
    1667213406: Config loaded from /etc/mosquitto/mosquitto.conf.
    1667213406: Opening ipv4 listen socket on port 1883.
    1667213406: mosquitto version 2.0.11 running
    1667213407: New connection from 127.0.0.1:59420 on port 1883.
    1667213407: New client connected from 127.0.0.1:59420 as esp_debug (p2, c1, k60, u'esp_debug').
    1667213407: No will message specified.
    1667213407: Sending CONNACK to esp_debug (0, 0)
    1667213407: Received SUBSCRIBE from esp_debug
    1667213407:     # (QoS 0)
    1667213407: esp_debug 0 #
    1667213407: Sending SUBACK to esp_debug
    1667213409: Received PUBLISH from esp_debug (d0, q0, r0, m0, 'Communicator/test', ... (17 bytes))
    1667213409: Sending PUBLISH to esp_debug (d0, q0, r0, m0, 'Communicator/test', ... (17 bytes))
    

    client_id esp_debug is publishing a 17 bytes long message to topic Communicator/test

    #11469
    Mikhail
    Moderator

    Communicator/ is a sub topic of Communicator with a zero-length sub level topic ‘. Maybe the trailing “/” should be left out.

    “Communicator/” is used in conjunction with other topic parts, for example Communicator/line001/device001/Sin

    You should tick the Detailed log checkbox in the data source properties. The file DrvDsMqtt_XXX.log contains information about sending data, for example:

    2022-11-02 11:35:16 Send Communicator/line001/device001/Sin = -0.5229836122997832
    2022-11-02 11:35:16 Send Communicator/line001/device001/Sqr = 1
    2022-11-02 11:35:16 Send Communicator/line001/device001/Tri = 5.255433325000013
    2022-11-02 11:35:16 Send Communicator/line001/device001/DO = NaN
    #11472
    zzz
    Participant

    For the ds1 box which runs the Hello world project, after being left there a day, after a simple restart I have log and mqtt message working suddently.

    
    2022-11-02 20:48:06 Send Communicator/line001/device001/RA = [8.23553587241761, 1.7859521750263974, 8.98281170950074]
    2022-11-02 20:48:07 Send Communicator/line001/device001/Sin = -0.9474630312854811
    2022-11-02 20:48:07 Send Communicator/line001/device001/Tri = 11.89087025833328
    2022-11-02 20:48:07 Send Communicator/line001/device001/RA = [3.225585997960694, 7.005090602011139, 0.8210334274466347]
    2022-11-02 20:48:08 Send Communicator/line001/device001/Sin = -0.9468726164272638
    2022-11-02 20:48:08 Send Communicator/line001/device001/Sqr = 1
    2022-11-02 20:48:08 Send Communicator/line001/device001/Tri = 11.8732918
    
    
    1667393441: Received PUBLISH from esp_rs6a (d0, q0, r0, m0, 'Communicator/line001/device001/RA', ... (59 bytes))
    1667393442: Received PUBLISH from esp_rs6a (d0, q0, r0, m0, 'Communicator/line001/device001/Sin', ... (19 bytes))
    1667393442: Received PUBLISH from esp_rs6a (d0, q0, r0, m0, 'Communicator/line001/device001/Tri', ... (17 bytes))
    1667393442: Received PUBLISH from esp_rs6a (d0, q0, r0, m0, 'Communicator/line001/device001/RA', ... (57 bytes))
    1667393443: Received PUBLISH from esp_rs6a (d0, q0, r0, m0, 
    

    But for the server, that I have regain access to, which connect to real devices and has more registers, the problem persists.
    Is there anything else that I haven’t thought of ? (e.g. I have figured out the InfluxDB stuff, its b/c 77 channels are not bound to the archive one by one)

    The detailed log doesn’t offer much which is why I resolved to mosquitto log. Below is the detailed log you requested:

    
    --------------------------------------------------------------------------------
    2022-11-02 20:21:42 MQTT data source started
    
    2022-11-02 20:21:42 Connect to 127.0.0.1:1883
    Connected successfully
    
    2022-11-02 20:21:42 Subscribe to command topic
    
    2022-11-02 20:28:54 Disconnect from 127.0.0.1:1883
    
    2022-11-02 20:28:54 MQTT data source stopped
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    2022-11-02 20:29:06 MQTT data source started
    
    2022-11-02 20:29:06 Connect to 127.0.0.1:1883
    Connected successfully
    
    2022-11-02 20:29:06 Subscribe to command topic
    
    2022-11-02 20:45:42 Disconnect from 127.0.0.1:1883
    
    2022-11-02 20:45:43 MQTT data source stopped
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    2022-11-02 20:45:55 MQTT data source started
    
    2022-11-02 20:45:55 Connect to 127.0.0.1:1883
    Connected successfully
    
    2022-11-02 20:45:55 Subscribe to command topic
    
    

    The mosquitto log only have PINGREQ/RSP stuff, not gonna repeat it here.

    The Communicator setting on server is basically identical to the box running helloworld project. I think there is something else I am missed, what could that be?

    working copy in hello world project

    
        <DataSource active="true" code="MqttPublish" name="Mqtt Publish" driver="DrvDsMqtt">
          <Option name="ClientID"     value="esp_rs6a" />
          <Option name="DataLifetime" value="60" />
          <Option name="DetailedLog"  value="True" />
          <Option name="DeviceFilter" value="" />
          <Option name="MaxQueueSize" value="1000" />
          <Option name="Password"     value="C8080E774B59B0C6694063BDE2428352" />
          <Option name="Port"         value="1883" />
          <Option name="ProtocolVersion" value="Unknown" />
          <Option name="PublishFormat" value="" />
          <Option name="QosLevel"     value="0" />
          <Option name="Retain"       value="False" />
          <Option name="RootTopic"    value="Communicator/" />
          <Option name="Server"       value="127.0.0.1" />
          <Option name="Timeout"      value="10000" />
          <Option name="UndefinedValue" value="NaN" />
          <Option name="Username"     value="esp_rs6a" />
        </DataSource>
    

    problematic server

    
        <DataSource active="true" code="MqttServer" name="Mqtt Publish" driver="DrvDsMqtt">
          <Option name="ClientID"     value="esp_rs6" />
          <Option name="DataLifetime" value="60" />
          <Option name="DetailedLog"  value="True" />
          <Option name="DeviceFilter" value="" />
          <Option name="MaxQueueSize" value="1000" />
          <Option name="Password"     value="C8080E774B59B0C6694063BDE2428352" />
          <Option name="Port"         value="1883" />
          <Option name="ProtocolVersion" value="Unknown" />
          <Option name="PublishFormat" value="" />
          <Option name="QosLevel"      value="0" />
          <Option name="Retain"        value="False" />
          <Option name="RootTopic"     value="Communicator/" />
          <Option name="Server"        value="127.0.0.1" />
          <Option name="Timeout"       value="10000" />
          <Option name="UndefinedValue" value="NaN" />
          <Option name="Username"      value="esp_rs6" />
        </DataSource>
    
    • This reply was modified 1 year, 5 months ago by zzz.
    #11475
    zzz
    Participant
    
        <IsBound>             true</IsBound>
        <SendModifiedData>    true</SendModifiedData>
        <SendAllDataPeriod>   60</SendAllDataPeriod>
        <EnableCommands>      true</EnableCommands>
        <EnableFileCommands>  true</EnableFileCommands>
        <StartLinesOnCommand> false</StartLinesOnCommand>
        <MaxLogSize>          1</MaxLogSize>
    
Viewing 15 posts - 1 through 15 (of 32 total)
  • You must be logged in to reply to this topic.