Giter VIP home page Giter VIP logo

Comments (5)

werner-j avatar werner-j commented on September 3, 2024 2

@ahorseman - I am as well rarely using Python and never digged deeper into it, so I stumbled upon similar questions. Some time ago, I set up PyVLX and have now made my efforts public and hope this helps you as well: https://github.com/werner-j/vlxcontrol

from pyvlx.

Julius2342 avatar Julius2342 commented on September 3, 2024 1

@werner-j : in your example, i find the name main pretty confusing. You should rename it to init_pyvlx or similar.

I would also position the if __name__ == '__main__': at the very end of the file and put the run command within this block.

But the most importand: Why didn't you use an async webserver framework? You should have a look at https://aiohttp.readthedocs.io/en/stable/ ("Server example")

from pyvlx.

werner-j avatar werner-j commented on September 3, 2024 1

Thank you for your hints @Julius2342. I've done some updates to it.

from pyvlx.

Julius2342 avatar Julius2342 commented on September 3, 2024

I experienced the same issue on my environment at home and I did not trace down the reason why.

pyvlx "should" keep the connection open with a heart beat mechanism. Within Home-assistant i enabled the logging for pyvlx by adding:

logger:
  default: warning
  logs:
    pyvlx: debug

I then see in my logs the following requests:

2019-06-25 12:17:21 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
2019-06-25 12:17:21 DEBUG (MainThread) [pyvlx] REC: <FrameGetStateConfirmation gateway_state="GatewayState.GATEWAY_MODE_WITH_ACTUATORS" gateway_sub_state="GatewaySubState.IDLE"/>
2019-06-25 12:18:21 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
2019-06-25 12:18:21 DEBUG (MainThread) [pyvlx] REC: <FrameGetStateConfirmation gateway_state="GatewayState.GATEWAY_MODE_WITH_ACTUATORS" gateway_sub_state="GatewaySubState.IDLE"/>

These requests should keep the connections open and reconnect if a connection died.

WRT to the fire and forget mechanism. there is such when sending a request to the API by adding node.close(wait_for_completion=False) to the call. But this won't skip the connection time it only does not wait until the device has reached its final position.

HTH

Julius

from pyvlx.

ahorseman avatar ahorseman commented on September 3, 2024

Thank you. That might be of help. Though I ask myself, whether that is really clean. Perhaps @Julius2342 can use that as additional example for PyVLX and help clean it? Closing the issue. Thank you.

from pyvlx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.