Home assistant - modbus - Siemens 1200 plc

Hi, I posted this question also on the FB community, but with lack on response I’ll give it a try here.

I’m experimenting with HA for 2 months now. Slightly different then most of you guys do. All the lights and switched were already controlled by a Siemens 1200 PLC. I want to use HA as an extra layer on top of the PLC. I managed already to have mqtt communication. But I would like to try Modbus TCP also, it looks less complicated to me. Unfortunately I can’t get it working.

Because I’m not experienced with HA and modbus it’s hard to start debugging.

A lot of examples I found on the net are written in the old yaml syntax, this makes it even more confusing.

Can anyone push me in the right direction?

For example:

Show me how to write one bit high in the PLC with a switch or button.

on FB they advice me to use NodeRed. I definitely will give it a try, bur for now I want to work with HA only, it should work…

Thanks in advance!

You have read the description of the integration Modbus in HA:

Offcourse :wink: I read it many times, but like I told, I don’t know how to start debugging, the plc says it’s trying to establish connection.
Maybe to start, is HA modbus a modbus master of slave?
I assumed its a master (= TCP client) and my plc is the slave (TCP server), don’t know if this is correct.

I forgot to post example of my code.
I kept it simple, don’t know if it’s correct, but like I said, all new for me…

image

Btw: MQTT works, it’s connected to the same PLC

image

Hello, i use Node Red in Home Assistant to communicate with a Logo Siemens OBA-7 and work also with Siemens 1200

This is my config for the Logo:

i stopped to use Siemens 1200

Hello Ventilo,

Any chance you could share a demo project or similar that I could import?
I’m trying to get Node Red also to work with a Siemens S7 300 setup here.
But I’m not able to set this all up to get the sort of “hello world” effect :slight_smile:

Hello, you have a lot of video on Youtube
The big lines:

Don’t forget to actived PUT/GET in S7 PLC

On Node Red you need to install S7 Palette

You have a lot of information in the Help of Node Red

Hello Ventilo,
I have tried to search youtube and other places but I’m not able to find the option you have shown here “permit access with PUT/GET” with Step7 and a CPU315-2PN/DP. I’m starting to think that the CPU does not support this option. Everything I find regarding PUT/GET for this CPU is to use Siemens standard blocks for it to read write to some DBs. And that is basically when communicating between two or more PLC’s.

So anyone who have done modbus communication in HA with a CPU315-2PN/DP?

Br
T

What software do you use? Tia Portal or the older Simatic Step 7 software?

Btw: I have a working S7 communication through Node_Red in the meantime. but I’m afraid for lack of support/updates within a couple of years. That’s why I focussed on the Modbus connection. I managed to get it working since last week with Siemens 1200.

I’m using Simatic Manager STEP-7 (so the older)
My current program is very extensive and converting to TIA Portal will be a massive job and therefore I have not done that. I however (just as a test) added a CPU315-2PN/DP CPU to a new project in Tia Portal and the options for setting “permit access with PUT/GET” is not there in the place where it can be found for 1200 CPU’s.

Probably you will find the answers in this documentation (read the one for S7-300)

https://support.industry.siemens.com/cs/document/82212115/how-do-you-configure-and-program-an-s7-connection-and-the-“put”-and-“get”-instructions-for-data-transfer-between-two-s7-cpus-?dti=0&lc=en-US

It looks like there is no Put/get option for this CPU, but you should be able to get it working in Simatic Manager.

I do not really believe that it will be possible with the above function you have linked to. Or it will be very complex when reading/writing to some DB’s only

Some years ago I used this GET/PUT function when I was transferring data between two CPU’s. It was working but everything but simple.

So it might be that I have to move on and away from HS if I’m not able to solve this issue. My PLC is basically the only place where all my data/measurements/control are and without this I have no real use for HS today. :frowning:

For those who are still searching for modbus communication between HA and Siemens PLC:
afbeelding

afbeelding

afbeelding

Hello,

can you please show me a Picture from your DB6 values?

LG Lou