Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection problem F04 #164

Open
denissonwenergy opened this issue Nov 1, 2024 · 6 comments
Open

Connection problem F04 #164

denissonwenergy opened this issue Nov 1, 2024 · 6 comments
Labels

Comments

@denissonwenergy
Copy link

I saw your project on github: https://github.com/aldas/modbus-tcp-client.

I have a park with the following configuration: Teltonikas Gateways and energy meters connected via RS485.

I tried to use FC4 to connect to the IP+Port of the remote gateway (teltonika) and I get the connection refused error.

Unable to create client socket to tcp://177.xx.xxx.xxx:4000: Connection refused #0 /var/www/duodigit/energy/vendor/aldas/modbus-tcp-client/src/Network/BinaryStreamConnectionBuilder.php(33): ModbusTcpClient\Network\InternetDomainStreamCreator->createStream() #1 /var/www/duodigit/energy/ vendor/aldas/modbus-tcp-client/src/Network/BinaryStreamConnection.php(42): ModbusTcpClient\Network\BinaryStreamConnectionBuilder->ModbusTcpClient\Network{closure}() #2 /var/www/duodigit/energy/overip.php(137): ModbusTcpClient\Network\BinaryStreamConnection->connect() #3 /var/www/duodigit/energy/overip.php(40): getRegister() #4 /var/www/duodigit/energy/vendor/evenement/evenement/src/EventEmitterTrait.php(143): {closure}() #5 /var/www/duodigit/energy/vendor/react/socket/src/Socket Server.php(76): Evenement\EventEmitter->emit() #6 /var/www/duodigit/energy/vendor/evenement/evenement/src/EventEmitterTrait.php(143): React\Socket\SocketServer->React\Socket{closure}() #7 /var/www/duodigit/energy/vendor/react/socket/src/TcpServer.php(258): Evenement\EventEmitter->emit() #8 /var/www/duodigit/energy/vendor/react/socket/src/TcpServer.php(239): React\Socket\TcpServer->handleConnection() #9 /var/www/duodigit/energy/vendor/re act/event-loop/src/StreamSelectLoop.php(246): React\Socket\TcpServer->React\Socket{closure}() #10 /var/www/duodigit/energy/vendor/react/event-loop/src/StreamSelectLoop.php(213): React\EventLoop\StreamSelectLoop->waitForStreamActivity() #11 /var/www/duodigit/energy/overip.php(119): React\EventLoop\StreamSelectLoop->run()
#12 {main}

I would be very grateful for your help.

  • Environment:
  • OS: [e.g. Ubuntu20.10/...]
  • PHP version > 8
@denissonwenergy denissonwenergy changed the title Problema na conexão F04 Connection problem F04 Nov 1, 2024
@aldas
Copy link
Owner

aldas commented Nov 2, 2024

Connection refused implies that Server is not accepting connections. This is probably due to the firewall.

Teltonika guide says

To test the configuration, we could try to change some values in the Modbus PLC simulator and then try to read them via Modbus Master application. You might need to disable Firewall in both PC1 and PC2, or modify Firewall rules to allow both applications through the Firewall.

https://wiki.teltonika-networks.com/view/Data_transfer_from_Modbus_TCP_to_Modbus_RTU_Gateway#Testing_the_configuration

Firewall configuration guide is here https://wiki.teltonika-networks.com/view/Firewall_traffic_rules

also there is that section

In IP filter options on the bottom of the page, add IP addresses that will be allowed to reach your Modbus gateway (input 0.0.0.0/0 to allow any IP address).

so you might need to allow your IP there

@denissonwenergy
Copy link
Author

denissonwenergy commented Nov 3, 2024 via email

@aldas
Copy link
Owner

aldas commented Nov 3, 2024

I have one Teltonika RUT956 at my desk at work and have tried in locally Modbus (mostly through their modbus->mqtt thingie). I assume all their OSes are the same. I can check modbus server + connecting to it from local network tomorrow when I am at the office.

@denissonwenergy
Copy link
Author

denissonwenergy commented Nov 3, 2024 via email

@aldas
Copy link
Owner

aldas commented Nov 3, 2024

Could you help me little bit to understand your setup.

You have

  1. energy meters that are connected to Teltonika routers over RS485
  2. Teltonika routers at the "edge"
  3. Server at the "internet"

You have tried https://wiki.teltonika-networks.com/view/RUT200_Data_to_Server but this is not succient

You are now trying to use this library - by connecting periodically from 3. (from Server) to 2. (Teltonika) and your request end up in Connection refused?

Do you use https://wiki.teltonika-networks.com/view/RUT200_Modbus to expose your RS485 device as TCP port?

@denissonwenergy
Copy link
Author

denissonwenergy commented Nov 3, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants