eclipse / kuksa.val

kuksa.val
Apache License 2.0
89 stars 52 forks source link

issue with kuksa-client, got disconnected after some use. #733

Closed kulta4 closed 4 months ago

kulta4 commented 4 months ago

Hi There! I have run this "kuksa-client"(python) with databroker "docker run -it --rm --net=host ghcr.io/eclipse/kuksa.val/databroker:master --insecure" it worked well for some times then it troughing error "disconnected" and the subscribe part is not working as before, I mean I able to saw the subscribed signal as json file in my local directory but now I unable to, and the message is:

Screenshot 2024-02-06 175353
lukasmittag commented 4 months ago

Hey, we kindly ask you to put future issues regarding the kuksa-client in the new location of it https://github.com/eclipse-kuksa/kuksa-python-sdk Your problem seems to be that you try to connect to wss://127.0.0.1:8090. This is trying to use websockets (legacy kuksa.val). To get it up and running you either need to specify grpc:://127.0.0.1:55555 --insecure for example.

kulta4 commented 4 months ago

Hi, Thank you. I tried this specification also, but it didn't work, raise an error "kuksa-client: error: unrecognized arguments: grpc://127.0.0.1:55555"

erikbosch commented 4 months ago

The kuksa-client parameters where changed quite recently, so depening on which version of kuksa-client you are using you may need different arguments.

I will show examples for different kuksa-client versions

If we start databroker from official docker container from latest master:

erik@debian4:~/vehicle_signal_specification$ docker run -it --rm --net=host ghcr.io/eclipse/kuksa.val/databroker:master --insecure
2024-02-07T07:53:15.406679Z  INFO databroker: Init logging from RUST_LOG (environment variable not found)
2024-02-07T07:53:15.406709Z  INFO databroker: Starting Kuksa Databroker 459750fefbc585037227cc50903bdaf5a3b9b3d7
2024-02-07T07:53:15.407745Z  INFO databroker: Populating metadata from file 'vss_release_4.0.json'
2024-02-07T07:53:15.524210Z  WARN databroker: Authorization is not enabled.
2024-02-07T07:53:15.524267Z  INFO databroker::broker: Starting housekeeping task
2024-02-07T07:53:15.524327Z  INFO databroker::grpc::server: Listening on 0.0.0.0:55555
2024-02-07T07:53:15.524335Z  INFO databroker::grpc::server: TLS is not enabled
2024-02-07T07:53:15.524338Z  INFO databroker::grpc::server: Authorization is not enabled.

Then if you use kuksa-client 0.4.0 this should work. Example showing installation by pip

pip install kuksa-client==0.4.0
kuksa-client --protocol grpc --ip 127.0.0.1 --port 55555 --insecure

If you instead use 0.4.1 or newer you must connect like this

pip install kuksa-client==0.4.1
kuksa-client grpc://127.0.0.1:55555

(The same if you use 0.4.2)

For 0.4.1 onwards we have changed default to use grpc://127.0.0.1:55555 so this should also work:

pip install kuksa-client==0.4.1
kuksa-client 

As your screenshot mention 0.4.0 I assume you use the official 0.4.0 version and then you must use the syntax mentioned for 0.4.0 above. Doing a kuksa-client --help shall show available options.

kulta4 commented 4 months ago

Hi, Thank you it's working. Additionally, I want to know with this kuksa-client are we able to send signals to mqtt. second one is: while subscribe the signal I able to get the data in json format for every single signal can get the signals for a vehicle in that case. Thank you

lukasmittag commented 4 months ago

With the kuksa-client itslef you can't send anything to mqtt. You could use the python sdk to write your own client that does this. See https://github.com/eclipse-kuksa/kuksa-python-sdk/tree/main/docs/examples https://github.com/eclipse-kuksa/kuksa-python-sdk/blob/main/docs/examples/async-grpc.md Same for your second question you could subscribe like in the examples and append the datapoint to a .json file.

erikbosch commented 4 months ago

Issue seems to be solved, closing it. Please reopen if needed