gijzelaerr / python-snap7

A Python wrapper for the snap7 PLC communication library
http://python-snap7.readthedocs.org/
MIT License
643 stars 245 forks source link

Item not available (Still) #361

Closed GameModes closed 2 years ago

GameModes commented 2 years ago

Good day, I want to connect Python with my S7 PLC machine, but I have received some (security) errors when I enter some of the default codes. This is the error:

b'CPU: Item not available'

This happens for at least: read_area, get_protection & get_plc_datetime

I found out this Issue is a security issue with this discussion and followed it: https://github.com/gijzelaerr/python-snap7/discussions/323 and turned on "Permit acces with PUT/GET communication from remote partner" with Tia portal (which I'm not an expert on) and downloaded it to my device. Still this didn't help. Though I'm not sure if the "Permit Access" setting is truly on the PLC. I have compiled and downloaded it on the device and more, I dont know. Any ideas what to do next? Or is this the final answer? https://github.com/gijzelaerr/python-snap7/discussions/323#discussioncomment-2356784

with kind regards, Ruben

swamper123 commented 2 years ago

Hey Ho :)

b'CPU: Item not available' can be caused either:

or

What have to be configured and what is supported is shown here. These configs have to be done and loaded on the PLC.

It seems that snap7 was installed and loaded correctly, since you received an error message from snap7 and it isn't a Pythonerror which shows up (that would be our fault then).

read_area should work on all devices.

GameModes commented 2 years ago

Hey,

"The DB was wrongly configured" is probably the fault. because if "read_area should work on all devices." then my command: ` client.read_area(snap7.types.Areas.DB, 1, 10, 4)

` is because of the DB. Is there a command for read_area that doesnt involve db that I can use? And the "DB" is that the database implemented in the PLC siemens machine or something else?

Because my goal is to read a value from the PLC with their PLC address like: "M0" or "DB24.20" and get the current value of it. But I cant figure out the correct command to receive such data.