Comments (5)
@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.
@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.
Thank you for your hints @Julius2342. I've done some updates to it.
from pyvlx.
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.
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)
- Different venetian blinds are 'open' at different orientation values HOT 2
- Get position while moving a cover HOT 4
- Current position doesn't work HOT 15
- Add outdoor heater functionality?
- Python 3.10: DeprecationWarning: There is no current event loop
- Velux shutter in Home Assistant does not report state "opening" and "closing"
- Serial Number and KLF 200 HOT 2
- "Unable to send command" debug HOT 10
- Which Python versions are supported? HOT 4
- Enable velocity parameter
- Stop cover command throws an error
- Garage door is not reporting its position
- Upload to Pypi HOT 3
- Node Type 0x0401 not handled HOT 3
- DEXXO SMART io not working HOT 5
- [Feature request] Support silent mode HOT 4
- Build failure with Python 3.10 HOT 2
- Rain Sensor HOT 55
- pyvlx ssl handshake error 2021.6.0 & 2021.6.1 HOT 10
- Inverted status for awnings HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyvlx.