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

Not always responding #13

Open
exdirectory opened this issue Oct 6, 2016 · 11 comments
Open

Not always responding #13

exdirectory opened this issue Oct 6, 2016 · 11 comments
Assignees

Comments

@exdirectory
Copy link

Taking your example where the mac address is known, i found i had to create a loop to send the on or off signal three times to get a consistent result, i.e. the device turned on or off.

Have you a similar experience?

@tavalin
Copy link
Owner

tavalin commented Oct 7, 2016

Yes and something that needs thinking about. UDP offers no guarantee of message delivery so some sort of retry/acknowledgement system would be useful.

@exdirectory
Copy link
Author

Is there any acknowledgement from the orvibo sent out? It seems the app is more consistent.

@tavalin
Copy link
Owner

tavalin commented Oct 16, 2016

Yes, if the command was successfully received by the socket, you should get a response confirming the new state.

I'm just looking for a good way to handle the combination of request-response commands from the library, with the unsolicited messages that arrive if the status is changed from something other than the library.

@tavalin
Copy link
Owner

tavalin commented Nov 2, 2016

@exdirectory I'm in the process of doing an overhaul of the network code. It should retry messages if it doesn't get a response from the device so once this is merged you shouldn't need to send commands in a loop.

@tavalin tavalin self-assigned this Nov 2, 2016
@exdirectory
Copy link
Author

ok great, will wait for your commit and try that, cheers

@sscalvo
Copy link

sscalvo commented Nov 3, 2016

Dear Tavalin
First at all, thnk you for your SDK and your efforts!
I am also looking forward for that loop fix. I just bought an orvibo S20 and will start playing with your SDK next week. I just need my permanently-plugged tablet to switch ON the orvibo whenever battery level goes below say 20% and switch it back OFF when gets fully loaded.. I'll let you know how it goes
Thanks a lot!

@tavalin
Copy link
Owner

tavalin commented Nov 11, 2016

Could you give the dev branch a try if possible? I have pushed the new code with the message retry mechanism (although I haven't finished retrofitting the IR code)

@exdirectory
Copy link
Author

Just tested the dev branch, initial reaction is this is not fixed, i removed the code to repeat the call 3 times, i then tried to turn on, nothing, tried again, nothing, third time and then it worked, then it worked seamlessly with a single call. But gave it 5 mins, tried to turn off and got no success, turned off again and it worked. So in short, think it has not helped.

@exdirectory
Copy link
Author

exdirectory commented Nov 11, 2016

This is the code i am using...

      JSONObject json = new JSONObject();
      try {
         if (orvibo == null) {
            orvibo = OrviboClient.getInstance();
            orvibo.connect();
         }
         if (orvibo.isConnected()) {
            Socket socket = orvibo.socketWithDeviceId(ORVIBO_MAC_ADDRESS);
            //socket.find();
            socket.subscribe();

            // try three times
            //for (int n=0; n<3; n++) {
               if (turnOnOrvibo)
                  socket.on();
               else
                  socket.off();
            //}
            json.put("success",  Boolean.TRUE);
         }
      }
      catch (SocketException e) {
         e.printStackTrace();
         json.put("success",  Boolean.FALSE);
      }
      return json;

@tavalin
Copy link
Owner

tavalin commented Nov 12, 2016

Any chance you could send a debug log?

To enable logging I added slf4j-simple to my test program and use the following VM options:

-Dorg.slf4j.simpleLogger.defaultLogLevel=debug -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat="dd-MM-yyyy HH:mm:ss:SSS" -Dorg.slf4j.simpleLogger.logFile="System.out"

I'd expect a line such as:

12-11-2016 11:45:34:288 [main] DEBUG com.github.tavalin.orvibo.messages.request.RetryableMessage - Response received

if the Socket replied

or

12-11-2016 11:46:45:312 [main] DEBUG com.github.tavalin.orvibo.messages.request.RetryableMessage - No response

if the socket didn't send a reply.

@exdirectory
Copy link
Author

Sure, may not get chance until tomorrow evening though, will let you know.

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

No branches or pull requests

3 participants