I’m pretty new in balena and in coding in general. My project is to run a Modbus server in Python on a RevPI connect using balena to communicate in Modbus with other modules. I tried this code from “pyModbusTCP - the easy way to a Modbus TCP server with Python - YouTube” and it works but when I replace the IP by the IP of the RevPI it doesn’t work. Moreover in the RevPI there is 2 ethernet port with I think one IP adress for each one but one the balena board I can only one IP. My request is not very clear but if someone can help me on something it will be appricated.
Hello @Hugo thanks for your message. Your project looks super interesting!
I never used this pyModbusTCP project before, however do you have the devices on the same network? how do you connect the modbus device to the RevPi? over Ethernet?
Do you think you can share your docker-compose or Dockerfile template so i can try to replicate and see where is the issue?
Could you please confirm if you are using a special network, the network_mode or privileges on the docker-compose or Dockerfile? Would you mind to share it, so i can test on a machine here?
Now print(server_ip_address) does not print 192.168.1.200 but gives an error
Can you please tell how i can made my modbus server to run at IP address of 192.168.1.200
ALso i am not able to see the logs correctly however the client side of the modbus connection is working perfectly. I could read and write without problem. Its only the server side where i can niether see the logs nor the correct IP
Thanks @mpous for your support we solved the issue last week using a go around. we did not socket library as it might create problem. Apart from socket library rest works well
So we modified the resin-sample file in systems-connection balena image. We have assigned it the ipv4 address 192.168.1.200.
We just connected the modbus client
client =ModbusClient(host = “192.168.1.200”, port =12345)
and it worked