Giter VIP home page Giter VIP logo

Comments (14)

Julius2342 avatar Julius2342 commented on July 29, 2024

isnt it updated automatically? That is dependent on if the house_status_monitor has send the current position already.

(To find out, trigger a velux scene, then the house monitor sends the current positions and the nodes are updated without a position is sent).

But: to get to the center of your question, i do not know how to trigger the busmonitor to send the positions. Iirc it does it every x minutes, but I did not try this out.

My solution is to keep pyvlx running as a daemon.

from pyvlx.

3s1d avatar 3s1d commented on July 29, 2024

Hi Julius,

thanks for your quick response.
stop() calls CurrentPosition() which updates 'position'?! (If I understand thing correctly. My Python skills are somewhat limited.) Being able to call this from the super class w/o casing a stop would really be handy.

I read on several sites that the KLF200 has a tendency to crash if not operated in pulling mode (+ monitor disabled). The monitor will report at an interval of 15min to 24h (to preserve battery). Considering that the TCP connection will be closed after 15min idle, it may not be the the optimal solution for mains powered blinds ;)

My plan is to write a glue-program between your lib and mqtt. Similar to that one: https://github.com/3s1d/ow2mqtt . I'd like to have an update rate of 30sec or so...

Cheers,
Juergen

from pyvlx.

Julius2342 avatar Julius2342 commented on July 29, 2024
  • Yes, stop() sents the current postition (which is not the actual "current position" but a value reserved to the value "current position". )
  • Pyvlx keeps the connections open by sending keep alive packets
  • regarding crashes: my system here runs stable now for 4 months without any crashes...
  • you should keep your daemon running and with it the connection to klf200 open - if you transmit the position to mqtt, you can just use the acutal current position saved within the internal devices of pyvlx

from pyvlx.

3s1d avatar 3s1d commented on July 29, 2024

Sure thanks. I'll do so.

The problem is if somebody uses an original remote to change the blind's position. The manipulation will take up to 15min to be detected by my system.

from pyvlx.

Julius2342 avatar Julius2342 commented on July 29, 2024

If pyvlx is connected, you should get the position update immediately.

from pyvlx.

3s1d avatar 3s1d commented on July 29, 2024

Hi,

here's my test code:

    await pyvlx.load_nodes()
    await pyvlx.nodes['Buero EG Nord'].stop()
    while True:
        print(pyvlx.nodes['Buero EG Nord'].position)
        time.sleep(10)

I started the deamon, the position was reported correctly. Then I changed the position using a remote and waited for 20min. The position was not updated. I restarted the deamon and the correct current position was shown. .stop() seems to get the current position w/ a lag of 10-20sec (=prefect). However w/o I had no success.

Cheers,
Juergen

from pyvlx.

Julius2342 avatar Julius2342 commented on July 29, 2024

you should use the async version of sleep ...

from pyvlx.

3s1d avatar 3s1d commented on July 29, 2024

Thanks! Works a treat... Position changes arrive within 90sec, which is acceptable.

from pyvlx.

Julius2342 avatar Julius2342 commented on July 29, 2024

uh, thats still a big delay. May you enable logging to see if you see the position changes on the packet stream...?

from pyvlx.

3s1d avatar 3s1d commented on July 29, 2024

Ahm not sure how to accomplish that...
I added "logging:...." to pyvlx.yaml; but I can't see any debug output.

Please note:

pyvlx/config.py:27: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  doc = yaml.load(filehandle)  

from pyvlx.

Julius2342 avatar Julius2342 commented on July 29, 2024
"""Just a demo of the new PyVLX module."""
import asyncio

from pyvlx import Position, PyVLX

import logging
from pyvlx.log import PYVLXLOG
PYVLXLOG.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
PYVLXLOG.addHandler(ch)

async def main(loop):
    """Demonstrate functionality of PyVLX."""
    pyvlx = PyVLX('pyvlx.yaml', loop=loop)

    # Changing position of windows:
    await pyvlx.load_nodes()

    while(True):
        for node in pyvlx.nodes:
            print(node)
        await asyncio.sleep(10)

    await pyvlx.disconnect()

if __name__ == '__main__':
    # pylint: disable=invalid-name
    LOOP = asyncio.get_event_loop()
    LOOP.run_until_complete(main(LOOP))
    LOOP.close()

from pyvlx.

3s1d avatar 3s1d commented on July 29, 2024

Thanks. I can confirm that there is a 90sec delay between changing the position using the remote and being reported to pylvx (if I don't do stop() or something else actively).

Right after I receive this (90sec after the actual manipulation) the node is updated.

REC: <FrameNodeStatePositionChangedNotification node_id=0 state=5 current_position='0x0D30' target='0x0D30' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0xF7FF' current_position_fp4='0xF7FF' remaining_time=0 time='2012-02-28 16:25:36'/>

Please note that I do not have any Velux products other than the KLF200. I am using Somfy blinds. The reason for using the KLF200 rather than the Somfy original (Tahoma) is that it can only be controlled using a cloud service API, which I am no fan of (due to privacy and other reasons).

The vlx2mqtt project will be available on my GitHub account and will be based upon pyvlx.

Thanks a lot!

from pyvlx.

tikismoke avatar tikismoke commented on July 29, 2024

If you made a vlx2mqtt repo I'll send you a kiss.

I still not get time to test anything until the new API is implement.

Would it allow command as well?

Know it's not the right place to ask but couldn't wait :)

from pyvlx.

phha avatar phha commented on July 29, 2024

It seems like this was closed without resolution. I'm still seeing this issue in Home Assistant. Is it ok to re-open this ticket?

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.