Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Question
TomBaro 0
Hi everybody,
I'm using the TCP example code on this link
Please login or register to see this link.
Testing how reliably the connection is restored between the QA TCP client and an external third party server I found that sometimes Fibaro can't reconnect.
I physically disconnect the third party device by unplugging the RJ45 Ethernet connector, leaving it disconnected for a while and then reconnect it and check what's happening.
Sometimes the connection is succesfully restored and when I press a device "turn on" button, it is sent to the third party hardware and everything is fine, response is received.
[08.11.2020] [11:37:36 am] [DEBUG] [QUICKAPP572]: onAction: {"actionName":"turnOn","deviceId":573,"args":[573,"turnOn"]}
[08.11.2020] [11:37:36 am] [DEBUG] [QUICKAPP572]: child 573 channel1 turned on[08.11.2020] [11:37:36 am] [DEBUG] [QUICKAPP572]: command sent FN,ON,1
[08.11.2020] [11:37:36 am] [DEBUG] [QUICKAPP572]: onDataReceived >FN,OUT,ON,1 >[08.11.2020] [11:37:36 am] [DEBUG] [QUICKAPP572]: Command OUT param1 ON Channel 1
However other times nothing is sent and neither the success nor the failure callback functions are called
[08.11.2020] [11:33:39 am] [DEBUG] [QUICKAPP572]: onAction: {"args":[573,"turnOn"],"actionName":"turnOn","deviceId":573}
[08.11.2020] [11:33:39 am] [DEBUG] [QUICKAPP572]: child 573 channel1 turned on
and nothing else
It looks like Fibaro doesn't even try to send any commands. As if it wasn't aware of the connection. Most interestingly, monitoring the network shows that Fibaro responds to the server's keep alive messages, wich suggests that the low-level TCP socket connection is fine. It looks like the problem is with higher level Fibaro's socket handling. Sometimes the onInit() function is automatically called after a while which sorts out the connection. I just don't want to call onInit() unnecessarily from the QA code especially as I can't reliably detect when it is needed.
I've been stuck for a while, tried everything including adding a watchdog timer and using heartbeat messages but I can't really put my finger on anything. Fibaro randomly comes back with nothing, connection error, response error, etc. Unfortunately I can't see any pattern. It seems that the success and error callbacks are called randomly, they don't seem to have much to do with what's really happening.
Anybody with an insight? I can't really include any code as I've tried so many different versions and there's no pattern and it's hard to replicate the issue. I'm more after an expert who knows how Fibaro works behind the scenes or somebody who's experienced this and managed to get around it.
Thanks.
Link to comment
Share on other sites
20 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.