Closed jatin-28 closed 6 years ago
Hi, thanks for trying out. The library is in the early stage - every feedback or help is welcomed. As for your questions:
sendSecureCommand
in case you need to touch something which is "ui protected". So to try out just put it there, we can consider to make it optional for the future.LoxoneWebsocketAT
. Generally spoken since the library is now pretty basic, you need to gather the loxone command yourself or with the help of Protocol
class.The example I pushed the example skeleton here: https://github.com/Smarteon/loxone-java/tree/example Feel free to elaborate on it suggest improvements or just improve and create PR from that ;-)
Excellent thanks. I did do something similar but had authentication failure. Unfortunately, had the same again. I'm using the same user and pass as loxone app. But am using local ip address.
Hi, the local IP shouldn't be a problem, the example logs a lot of things on stderr, if you could share it, it is easier to help. Or at least what's the last message you got on stdout? Also, what's your environment? I tested the example under openjdk8, it also works in android. It can be also the issue of crypto libs since different JDKs deliver a different set of crypto algorithms (i.e. AES is used which is not part of all the JDKs) .
Additionally: are you able at least to get a loxone config using HTTP? That should be quick validation you have the credentials correct since that uses simple HTTP with Basic auth (no crypto magic there).
Thanks Jimirocks. I was not putting the correct password on the arguments. During debugging I was wondering why the base64 encoded value was different then the one from the browser! The command turns the light on/off but for some reason after there is a websocket exception, could be during shutdown.
I tried with the secured command but this throws a BufferUnderflowException. (Note the light doesnt turn on)
Log output:
[WebSocketConnectReadThread-15] TRACE cz.smarteon.loxone.LoxoneWebsocketClient - Incoming message header MessageHeader{kind=EVENT_TEXT, sizeEstimated=false, messageSize=2844} [WebSocketConnectReadThread-15] ERROR cz.smarteon.loxone.LoxoneWebsocketClient - Can't read binary message e446df0e7e01fbf6ffff4f9f46c06fba000000000000000000000000000000000f010000303a6d6f64653d2d333b6e616d653d5c224661627269632050726f74656374696f6e5c222c313a6d6f64653d2d343b6e616d653d5c225761726d65725c222c323a6d6f64653d2d353b6e616d653d5c22436f6f6c65725c222c333a6d6f64653d333b6e616d653d5c224d6f6e6461795c222c343a6d6f64653d343b6e616d653d5c22547565736461795c222c353a6d6f64653d353b6e616d653d5c225765646e65736461795c222c363a6d6f64653d363b6e616d653d5c2254687572736461795c222c373a6d6f64653d373b6e616d653d5c224672696461795c222c383a6d6f64653d383b6e616d653d5c2253617475726461795c222c393a6d6f64653d393b6e616d653d5c2253756e6461795c2200e446df0e7e01fcf6ffff4f9f46c06fba000000000000000000000000000000000f010000303a6d6f64653d2d333b6e616d653d5c224661627269632050726f74656374696f6e5c222c313a6d6f64653d2d343b6e616d653d5c225761726d65725c222c323a6d6f64653d2d353b6e616d653d5c22436f6f6c65725c222c333a6d6f64653d333b6e616d653d5c224d6f6e6461795c222c343a6d6f64653d343b6e616d653d5c22547565736461795c222c353a6d6f64653d353b6e616d653d5c225765646e65736461795c222c363a6d6f64653d363b6e616d653d5c2254687572736461795c222c373a6d6f64653d373b6e616d653d5c224672696461795c222c383a6d6f64653d383b6e616d653d5c2253617475726461795c222c393a6d6f64653d393b6e616d653d5c2253756e6461795c2200a2e78b1050012ce4ffff79894c5e899100000000000000000000000000000000050000005b3737385d000000a2e78b1050012de4ffff79894c5e899100000000000000000000000000000000060100005b7b226e616d65223a226d6f74696f6e222c226964223a312c22737461746963223a66616c73652c2275736564223a337d2c7b226e616d65223a224c45442073706f74222c226964223a322c22737461746963223a66616c73657d2c7b226e616d65223a2243656e7472652073706f7473222c226964223a332c22737461746963223a66616c73657d2c7b226e616d65223a224c45442063656e747265222c226964223a342c22737461746963223a66616c73657d2c7b226e616d65223a22427269676874222c226964223a3737372c22737461746963223a66616c73657d2c7b226e616d65223a224f6666222c226964223a3737382c22737461746963223a747275657d5d0000a2e78b1050012ee4ffff79894c5e899100000000000000000000000000000000110000005b312c322c332c342c3737372c3737385d000000a2e78b1050012fe4ffff79894c5e899100000000000000000000000000000000020000005b5d0000e446df0e0801baf6ffffeb260b0bafcd000000000000000000000000000000000f010000303a6d6f64653d2d333b6e616d653d5c224661627269632050726f74656374696f6e5c222c313a6d6f64653d2d343b6e616d653d5c225761726d65725c222c323a6d6f64653d2d353b6e616d653d5c22436f6f6c65725c222c333a6d6f64653d333b6e616d653d5c224d6f6e6461795c222c343a6d6f64653d343b6e616d653d5c22547565736461795c222c353a6d6f64653d353b6e616d653d5c225765646e65736461795c222c363a6d6f64653d363b6e616d653d5c2254687572736461795c222c373a6d6f64653d373b6e616d653d5c224672696461795c222c383a6d6f64653d383b6e616d653d5c2253617475726461795c222c393a6d6f64653d393b6e616d653d5c2253756e6461795c2200e446df0e0801bbf6ffffeb260b0bafcd000000000000000000000000000000000f010000303a6d6f64653d2d333b6e616d653d5c224661627269632050726f74656374696f6e5c222c313a6d6f64653d2d343b6e616d653d5c225761726d65725c222c323a6d6f64653d2d353b6e616d653d5c22436f6f6c65725c222c333a6d6f64653d333b6e616d653d5c224d6f6e6461795c222c343a6d6f64653d343b6e616d653d5c22547565736461795c222c353a6d6f64653d353b6e616d653d5c225765646e65736461795c222c363a6d6f64653d363b6e616d653d5c2254687572736461795c222c373a6d6f64653d373b6e616d653d5c224672696461795c222c383a6d6f64653d383b6e616d653d5c2253617475726461795c222c393a6d6f64653d393b6e616d653d5c2253756e6461795c220097002a10cf0273edffff6ee0cbfa8da6000000000000000000000000000000009500000032303138303630333132333731357c32303138303630353037323732317c32303138303630353139333434347c32303138303630383138343731367c32303138303630383230313131397c32303138303630393131333935367c32303138303631323037353630347c32303138303631323136323934347c32303138303631323139313435367c3230313830363133323031323239000000b2e78b102400df23ffffad53c181931700000000000000000000000000000000050000005b3737385d000000b2e78b102400e023ffffad53c181931700000000000000000000000000000000820000005b7b226e616d65223a224d6f74696f6e222c226964223a312c22737461746963223a66616c73652c2275736564223a317d2c7b226e616d65223a22427269676874222c226964223a3737372c22737461746963223a66616c73657d2c7b226e616d65223a224f6666222c226964223a3737382c22737461746963223a747275657d5d0000b2e78b102400e123ffffad53c1819317000000000000000000000000000000000b0000005b312c3737372c3737385d00b2e78b102400e223ffffad53c181931700000000000000000000000000000000020000005b5d00006be78b10c00269cbffff45faed4e2a8c00000000000000000000000000000000050000005b3737385d0000006be78b10c0026acbffff45faed4e2a8c00000000000000000000000000000000820000005b7b226e616d65223a224d6f74696f6e222c226964223a312c22737461746963223a66616c73652c2275736564223a317d2c7b226e616d65223a22427269676874222c226964223a3737372c22737461746963223a66616c73657d2c7b226e616d65223a224f6666222c226964223a3737382c22737461746963223a747275657d5d00006be78b10c0026bcbffff45faed4e2a8c000000000000000000000000000000000b0000005b312c3737372c3737385d006be78b10c0026ccbffff45faed4e2a8c00000000000000000000000000000000020000005b5d00006ae7df0eb803e78dffffd7c57a8eaa7b0000000000000000000000000000000013010000303a6d6f64653d303b6e616d653d5c225075626c696320486f6c696461795c222c313a6d6f64653d313b6e616d653d5c22486f6c696461795c222c323a6d6f64653d323b6e616d653d5c225363686f6f6c20486f6c69646179735c222c333a6d6f64653d333b6e616d653d5c224d6f6e6461795c222c343a6d6f64653d343b6e616d653d5c22547565736461795c222c353a6d6f64653d353b6e616d653d5c225765646e65736461795c222c363a6d6f64653d363b6e616d653d5c2254687572736461795c222c373a6d6f64653d373b6e616d653d5c224672696461795c222c383a6d6f64653d383b6e616d653d5c2253617475726461795c222c393a6d6f64653d393b6e616d653d5c2253756e6461795c2200ffe57d0e8503fe93ffffb304361e1e650000000000000000000000000000000000000000e64779102a01169dffffb304361e1e650000000000000000000000000000000000000000 java.nio.BufferUnderflowException at java.nio.Buffer.nextGetIndex(Buffer.java:506) at java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:361) at cz.smarteon.loxone.Codec.readUnsingedInt(Codec.java:193) at cz.smarteon.loxone.Codec.readUnsingedInt(Codec.java:186) at cz.smarteon.loxone.Codec.readTextEvents(Codec.java:138) at cz.smarteon.loxone.LoxoneWebSocket.processEvents(LoxoneWebSocket.java:240) at cz.smarteon.loxone.LoxoneWebsocketClient.onMessage(LoxoneWebsocketClient.java:59) at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:467) at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:702) at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:367) at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:212) at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:389) at java.lang.Thread.run(Thread.java:748) [WebSocketConnectReadThread-15] TRACE cz.smarteon.loxone.LoxoneWebsocketClient - Incoming message header MessageHeader{kind=EVENT_DAYTIMER, sizeEstimated=false, messageSize=1268}
Hi glad to here, you are able to do at least something!
Regarding secure command - if the control is not UI password protected (look for isSecured
in config) the secure command won't work for that.
Regarding the exception - it comes from parsing of some TEXT_EVENT, this shouldn't influence the commands processing, however, it's probably a BUG in events parsing.
Just to explain - after login, the library subscribes for events from miniserver, these typically flow in binary format and are processed in async manner - this can be pretty confusing, but if you send the text command, you should get text response, the errors in parsing binary messages are not related to those text commands.
Hmm may be we could make this subscription optional?
Thanks! Didn't realise that regarding issecured! But many thanks for the library. If I spot any issues will either raise or try and fix. The fact that you have unit tests will hopefully keep this library robust.
I used your library to access my miniServer Gen 1 V9.1 and it worked on the first try! Many Thanks - this saved me hours
Hi, Trying the library out. Had a look at the tests and added a test to send commands but I think I have the connection details incorrect. Do you need to have a password for api logging in and ui logging? Normally you don't need both. What is the deviceid?