Code Monkey home page Code Monkey logo

mqtt-siemens-s7-300's People

Contributors

carstenmaul avatar christofgroschke avatar feilner avatar roanbrand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mqtt-siemens-s7-300's Issues

Can't connect with mosquitto (CPU313C and CP343-1 Lean)

Hi, I'm using the hardware that has been used in the test of the maker.

Unfortunately, it does not connect. What can I do possibly wrong?

The IP-Address of the internal adapter has to be configured within the hardware configuration tool (HW Config), click on the PN-IO object
IP address is 192.168.0.1 of the CP module with subnet 255.255.255.0
The connection must be configured in Simatic Manager "Connections"
Has been made, see attachment
you must set the MQTT Functionblock parameter connectionID to the connection ID configured in Simatic Manager "Connections"
What is the connection ID? I used now the backplane connection, see attachment
you must set the MQTT Functionblock parameter cpLADDR to the address of the CP module. Example for a MQTT FB call in OB1 configured for external Ethernet (CP)usage: MQTT.DB71(net_config := DB_NET_CONFIG, connectionID := 1, cpLADDR := W#16#100);
I compiled the example and changed connectionID to 3 (because it is the backplane connection MPI address, is that correct?). I kept cpLADDR the same, because start address is 256 and that 16#100

Did I do something wrong?

Connections
StartAddress
MPIaddressAsConnectionID

Mix of MQTT connection state and MQTT connect error codes leads to conflict?

Hello,

in the function block MQtt within this code block
CASE (intState) OF 0 : // Wait for received packet start IF ((Data.runTime - Data.lastInActivity) >= Globals.MQTT_SOCKET_TIMEOUT) THEN Data._state := Globals.MQTT_CONNECTION_TIMEOUT; ELSIF available() THEN myPacketReader.iBegin := true; intState := 1; END_IF; 1 : // Read complete packet IF (myPacketReader.xDone) THEN IF (myPacketReader.result = 4) THEN IF Data.buffer[3] = 0 THEN Data.lastInActivity := Data.runTime; Data.pingOutstanding := false; Data._state := Globals.MQTT_CONNECTED; // here Data._state is used for a defined state. ELSE Data._state := BYTE_TO_INT(Data.buffer[3]); // here Data.state is used to store error codes returned by a connack packet END_IF; // ELSE maybe need equivalent/workaround to client->stop() END_IF; END_IF; END_CASE;

Please look at the Data._state assignmends within CASE (intState) OF = 1 code block.
There are two Data._state assignments.
The first assignment assigns a defined state
Data._state := Globals.MQTT_CONNECTED
The second assignment assigns an connack error code to Data._state:
Data._state := BYTE_TO_INT(Data.buffer[3])

Data.buffer[3] holds the connack error code returned by a connack mqtt package.

The problem is:
within Globals. the state "1" is assigned as Globals.MQTT_CONNECTED
within the MQtt docomentation this value is already taken by an connack error code:
0x01 Connection Refused, unacceptable protocol version
So if the error returned is 0x01, in my opion the code will set Data._state to Globals.MQTT_CONNECTED, which is wrong state.

Please refer to http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349257
(MQtt documentation section 3.2.2.3 "Connect Return code")

I can only send 4 digits

hi, is this project still used by anyone?

i got it working but i can only send max 4 digits.

image

he send 4 digits of my message (array of byte) and after that connection lost and the username + password of the mqtt server.

my problem is i want to use a s7-315 plc. the new official siemens blocks works great on an s7-1500. so the only working blocks for s7-3xx i found were these here.

Guide to get this working?

Hello..
First of all - awesome project.... :)
i'm trying to understand the basics in this program - after this i wanna try to port it to the TIA Portal and the S7-1500/1200 (Seems like the program allmost can be compiled under a 1500 CPU) Has any of ya guys tried to compile this under the TIA portal and a 1500/1200 Controller?

Is there any guide or sample Siemens project where i can see how it works?

What's the difference between PUBLISH, WRITE and WRITESTRING - how to use the WRITE if i need to send a header and a value to a MQTT broker?

Cannot compile makefile

Hi,

I know this is now an inactive topic for some time but I would really like to use this functionality in my project but im having problems compiling all blocks successfully.

I can't figure out how to run the make file to generate the project so im doing it manually which is probably why im coming up with the issues.

Can you please let me know how to generate the project with the make file?.

Thanks in advance.

Regards,

Paul.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.