Closed helson22 closed 1 month ago
Can you please post your config file, I think you removed something... maybe the example file is not updated.
I just found your example config file with curly braces and square brackets - JSON-format? I need those, right?
Initially I edited the the config.yaml in the addon_config/XXXXXXX_mqtt_S7-connector directory. Maybe this was too old?
For now, just add the device_name: something unique
that suits you to every. I thought I made this optional but its not. I'll check it in the coming week.
so your devices section looks lie this:
devices:
- name: Test Light dimable
type: light
state: DB999,X0.0
device_name: Test device 2
device_name
optionalOk, so this was a good hint - thx.
now I have PLC connected without any errors when starting the service.
The add-on also made a MQTT-Entity with the devicename. In my case I definded a light. So two buttons show up. Unfortunately I get a '2024-10-5 14:59:45 ## WARNING ## Error while writing to PLC !' in the log when clicking on them.
Good to hear we are making progress now ;) I test everything myself due to my situation so it is nice if someone else reports problems. What is the configured "Access level" in your PLC? Please try "Full access" and make sure PUT/GET is enabled (this is just below the access level settings.
Please post me a screen shot of the DB you're trying to write.
:-)
Just checked the settings. Full access already granted, PUT/GET enabled, too.
Is this sufficient?
Maybe its the "Optimized data block access" check in the DB settings? I can't remove the check. (grayed out). I read if removed TIA will show adresses in the DB-Table.
What steps do I have to do to remove this check?
The picture you showed is a screenshot of the instance declaration of an FB, not the DB. In a DB it normally is possible but I am not shure if it works for an instance DB. I always work with 1 separate DB which I use for all data that needs to communicated.
Please try to create a separate DB (Daten Baustein/Data Block) and repeat the steps to clear the "optimize access block access" check box. (P.S. my TIA is in English)
Add some data types to the block. and compile it. Please note that if you change this block (put something before an existing line) the offset changes! I always use spare bytes and the command to maintain and remember the position like this: If you add something and compile and you see the offset int equal anymore to the comment, remove/add a spare to fix it 😉
You always need to compile the block to show the offset values.
Hi again :-)
I managed to get a connection between you add-on and a global DB. a test mqtt switch can now change the value in the DB.
Maybe you can give me a hint how to synchronize values. I know what value in an instance DB has to be set to true to switch the light on. There is the possibility to make something like this:
IF DB100.MyBool THEN DB200.MyOutput := TRUE; ELSE DB200.MyOutput := FALSE; END_IF;
And if I switch manually on a hardware switch this must be written vice-verca to let HA know whats going on.
How is best practice for this situation?
Many thanks!
this should work... at least here it is working 😉 I see your update time is set to 10000 (10 seconds) maybe change this to 500 (0.5 sec).
a lower value is not advisable, but it should work if you don't have to many things you need to poll.
Hello,
finally (not much time available atm) I achieved setting up a connection, wo read and write simple bool variables in plc.
Thank you very much
Hello,
I have troubles to find the adresses in TIA portal which should be placed in teh config.yaml.
Seems that I'm doing someting wrong:
I have datablock DB70 an a bit in device-layout 30.3 for example - should be DB70,X30.3
`## INIT ## log level is set to: 4 MQTT Connected PLC Connected /usr/src/mqtt-s7-connector/index.js:53 new_device.discovery_topic = config.discovery_prefix; ^
TypeError: Cannot set properties of undefined (setting 'discovery_topic') at /usr/src/mqtt-s7-connector/index.js:53:32 at Array.forEach ()
at init (/usr/src/mqtt-s7-connector/index.js:49:19)
at NodeS7.connectCallback (/usr/src/mqtt-s7-connector/plc.js:51:3)
at NodeS7.onPDUReply (/usr/src/mqtt-s7-connector/node_modules/nodes7/nodeS7.js:432:9)
at Socket. (/usr/src/mqtt-s7-connector/node_modules/nodes7/nodeS7.js:370:19)
at Socket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
`
I played with the addresses and values in the config. As far as I now the adresses should work but I'm not sure. Sorry I'm not familiar with all these PLC things - I only can find the I/Q Adresses in TIA portal.
Can you point me to the right view in TIA portal where I can see the whole adress to be placed in the config , please?
Is it possible that I need a setting in the PLC to allow reading/setting things?
Thank you very much in advance. BR