Giter VIP home page Giter VIP logo

pyvlx's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyvlx's Issues

Window opening % reported as 1 instead of 0 when closed (new vasistas)

Hello, I'm a proud owner of two of the newly released motorized windows with vasistas opening.
Successfully paired and operated with HA through KLF 200, but when these are completely closed the status attribute reports 1% opening instead of 0%. Thus in HA it is not reported as "closed" and the close button is not deactivated.
Note that another window with "traditional" opening is correctly reporting 0% when closed, so it must be something related to the implementation of this new model.

Available to debug and/or provide logs.

PyVLXException description="position::raw_exceed_limit" raw="b'\xd4\x00'"/

The following exception was thrown:
PyVLXException description="position::raw_exceed_limit" raw="b'\xd4\x00'"/

In the logfile I only can find this:

2019-05-29 08:55:40 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
2019-05-29 08:55:40 DEBUG (MainThread) [pyvlx] REC: <FrameGetStateConfirmation gateway_state="GatewayState.GATEWAY_MODE_WITH_ACTUATORS" gateway_sub_state="GatewaySubState.IDLE"/>
2019-05-29 08:55:45 DEBUG (MainThread) [pyvlx] REC: <FrameNodeStatePositionChangedNotification node_id=6 state=2 current_position='0xC800' target='0x0000' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0xF7FF' current_position_fp4='0xF7FF' remaining_time=0 time='1993-12-03 09:59:44'/>
2019-05-29 08:55:45 DEBUG (MainThread) [pyvlx] REC: <FrameNodeStatePositionChangedNotification node_id=6 state=77 current_position='0xC800' target='0x0000' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0xF7FF' current_position_fp4='0xF7FF' remaining_time=0 time='1993-12-03 09:59:44'/>
2019-05-29 08:55:45 DEBUG (MainThread) [pyvlx] REC: <FrameNodeStatePositionChangedNotification node_id=6 state=5 current_position='0xC800' target='0xC800' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0xF7FF' current_position_fp4='0xF7FF' remaining_time=0 time='1993-12-03 09:59:44'/>
2019-05-29 08:55:50 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal error on SSL protocol
Traceback (most recent call last):
  File "uvloop/sslproto.pyx", line 653, in uvloop.loop.SSLProtocol._do_read
  File "uvloop/sslproto.pyx", line 728, in uvloop.loop.SSLProtocol._do_read__copied
  File "/config/deps/lib/python3.7/site-packages/pyvlx/connection.py", line 52, in data_received
    frame = frame_from_raw(raw)
  File "/config/deps/lib/python3.7/site-packages/pyvlx/frame_creation.py", line 40, in frame_from_raw
    frame.from_payload(payload)
  File "/config/deps/lib/python3.7/site-packages/pyvlx/frames/frame_node_state_position_changed_notification.py", line 49, in from_payload
    self.target = Parameter(payload[4:6])
  File "/config/deps/lib/python3.7/site-packages/pyvlx/parameter.py", line 19, in __init__
    self.raw = self.from_raw(raw)
  File "/config/deps/lib/python3.7/site-packages/pyvlx/parameter.py", line 57, in from_raw
    raise PyVLXException("position::raw_exceed_limit", raw=raw)
pyvlx.exception.PyVLXException: <PyVLXException description="position::raw_exceed_limit" raw="b'\xd4\x00'"/>

I don't see a suspicious package received, but maybe the exception has prevented the received data to be logged. I believe, right before the exception I wanted to set the position of node_id=6, which is a WINDOW_OPENER_WITH_RAIN_SENSOR. It was raining at that time. Maybe this is somehow connected.

Thanks for looking into this.

device_class=window always ?

Hi.

It seems like the device_class in hass.io for the "cover type" is always window for any velux product.

the cover type has several device classes to choose from. Yes I know I can override these in hass.io with the correct types.

Is it not possible to differentiate this based on what the velux api returns and then have pyvlx set this up properly ?

docs:
https://www.home-assistant.io/components/cover


snippet:

The way these sensors are displayed in the frontend can be modified in the customize section. The following device classes are supported for covers:

None: Generic cover. This is the default and doesn’t need to be set.

awning: Control of an awning, such as an exterior retractable window, door, or patio cover.

blind: Control of blinds, which are linked slats that expand or collapse to cover an opening or may be
tilted to partially covering an opening, such as window blinds.

curtain: Control of curtains or drapes, which is often fabric hung above a window or door that can be drawn open.

damper: Control of a mechanical damper that reduces airflow, sound, or light.

door: Control of a door or gate that provides access to an area.

garage: Control of a garage door that provides access to a garage.

shade: Control of shades, which are a continuous plane of material or connected cells that expanded or
collapsed over an opening, such as window shades.

shutter: Control of shutters, which are linked slats that swing out/in to covering an opening or may be tilted to partially cover an opening, such as indoor or exterior window shutters.

window: Control of a physical window that opens and closes or may tilt.

PYPI release 0.2.17 is not really 0.2.17

It seems that when I'm doing a pip3 install pyvlx I'm not getting the 0.2.17 release of pyvlx even though it tells me it is 0.2.17
I noticed e.g. that in the connection.py of pyvlx still has this line (which is causing me trouble):

ssl_handshake_timeout=5,

even though it is not there in the release commit for 0.2.17: https://github.com/Julius2342/pyvlx/blob/9397bbe741623769f4137714d08538ebd29d3ff0/pyvlx/connection.py

I guess this might be related to #53 and maybe also #52.
Home Assistant is affected as well by this.

Pyvlx broken when garage door is in KLF200

Hello,

I have a velux cover that works fine (KLF200 -> pyvlx -> HA).

I also have a garage door that produce an error in pyvlx when present in KLF200.

Here are the logs :

2020-07-18 00:13:35 WARNING (MainThread) [pyvlx] Connected to: KLF 200: Software version: 0.2.0.0.71.0, hardware version: 6, protocol version: 3.14
ValueError: 378 is not a valid NodeTypeWithSubtype

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 545, in data_received
    self._app_protocol.data_received(chunk)
  File "/usr/local/lib/python3.7/site-packages/pyvlx/connection.py", line 52, in data_received
    frame = frame_from_raw(raw)
  File "/usr/local/lib/python3.7/site-packages/pyvlx/frame_creation.py", line 40, in frame_from_raw
    frame.from_payload(payload)
  File "/usr/local/lib/python3.7/site-packages/pyvlx/frames/frame_get_all_nodes_information.py", line 127, in from_payload
    self.node_type = NodeTypeWithSubtype(payload[69] * 256 + payload[70])
  File "/usr/local/lib/python3.7/enum.py", line 310, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.7/enum.py", line 564, in __new__
    raise exc
  File "/usr/local/lib/python3.7/enum.py", line 548, in __new__
    result = cls._missing_(value)
  File "/usr/local/lib/python3.7/enum.py", line 577, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))

ValueError: 378 is not a valid NodeTypeWithSubtype

2020-07-18 00:13:47 ERROR (MainThread) [homeassistant.components.velux] Can't connect to velux interface: <PyVLXException description="Unable to retrieve node information" />
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 31, in async_setup
    await hass.data[DATA_VELUX].async_start()
  File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 70, in async_start
    await self.pyvlx.load_nodes()
  File "/usr/local/lib/python3.7/site-packages/pyvlx/pyvlx.py", line 83, in load_nodes
    await self.nodes.load(node_id)
  File "/usr/local/lib/python3.7/site-packages/pyvlx/nodes.py", line 70, in load
    await self._load_all_nodes()
  File "/usr/local/lib/python3.7/site-packages/pyvlx/nodes.py", line 88, in _load_all_nodes
    raise PyVLXException("Unable to retrieve node information")
pyvlx.exception.PyVLXException: <PyVLXException description="Unable to retrieve node information" />
2020-07-18 00:13:47 ERROR (MainThread) [homeassistant.setup] Setup failed for velux: Integration failed to initialize.

378 is x17A in hex. The API doc for that type says the following:

0x017A Linear or angular position of the garage door

Can you add the 0x017A to the “enum” items in NodeTypewithSubtype() ?

Here is the discussion in HA community :
https://community.home-assistant.io/t/velux-component-for-klf-200-doesnt-support-the-new-api-with-firmware-2-0-0-71/75641/119

Many thanks !

Get position while moving a cover

Dear all,

I'm currently testing the KLF200 (Firmware 2.0.0.71) to control my 4 solar covers via Home Assisstant. I see in the Home Assistant Log (activated for Velux via configuration.yaml), that the current position is only sent when the cover stops.

I would like to implement a kind of protection, so that when the window is open and someone want to close it via the normal remote control (KLI 313 WW), the cover shall stop. Unfortunately I can't detect weather the cover is moving without an updated position during movement. Also it would make the visual representation of the cover closing in Home Assistant more "smooth".

As for the stop command the current position can be requested I would assume this should be possible to implement or maybe it is already implemented and I missed it.

Is there a way to get the position while the cover is moving (also in the "current_position" attribute for Home Assistant)?

Br

Garage Door not handled

Hello @Julius2342,

I got the following message from PyVLX:

NodeTypeWithSubtype.GARAGE_DOOR_OPENER not implemented

Could you please add this to enable users to use PyVLX in conjunction with garage doors?

Serial Number and KLF 200

Hi there, it would seem the KLF 200 is not returning any serial number, resulting in cover entities in HA having no unique ID, making the whole experience very subpar as we can't (easily) customize these entities and assign them to areas.

Is that a limitation of the KLF 200? Could there be a way to work around that, or just use something else to generate a unique ID?

Dual Roller Shutter / Expose single curtain positions to HA

The "Dual Roller Shutter" has two curtains which can be controlled separately by sending FP1 or FP2 instead of MP in GW_COMMAND_SEND_REQ.

MP: Position of the two curtains
FP1: Position of the upper curtain
FP2: Position of the lower curtain

Could this somehow be exposed to homeassistant?

Options I see:

  1. create two covers for each "Dual Roller Shutter"
  2. add an additional parameter (e.g. curtain=both(default)/upper/lower) to cover.set_cover_position
  3. ...?

By looking at the code, I believe it should not be too complex - but unfortunately I'm a complete newbie to python and currently lacking time to learn so I'm unable to do it myself.

Thank you!

Unable to establish a successful connection

Hi, thanks for pyvlx. I'm trying to use it with Home Assistant and my KLF 200.

This is using pyvlx 0.2.8 and Python 3.7.

Unfortunately, I'm not having much luck. I double and triple checked the hostname and password, but all I'm getting is
pyvlx.exception.PyVLXException:

(I tried resetting the password to something impossible to get wrong, but that didn't help either.)

I see a connection to the 192.168.2.180:51200 being established, and data flowing back and forth. So it seems the LAN port is active correctly. Unfortunately, no details as to why the login fails.

(I've even double-checked the MAC address, that's indeed the Velux device.)

The device is running the newest 0.2.0.0.71.0 firmware (that's what it shipped with, and there's no update).

I'd really appreciate any hint on how to debug this further. Am I missing something obvious?

[Feature request] Support silent mode

Hi,

Thank you for your job on klf200 !

Would you consider supporting silent mode ?
Silent mode is a slow speed motor mode on Somfy "S&SO RS100 io" motors. "Smoove RS100 io" remote has a button to enable this feature, but I cannot tell if klf200 supports it.

Regards, Mathieu.

Keep connection open to klf

Dear Julius,

thank you so much for this library. It's really great to be able to control my io-homecontrol devices from the command line.

However, I'm struggling a bit with the usage, as it seems that parallel requests are not really supported and also every time I issue a command, there's a lag as the connection needs to be established.

As I am totally new to Python (I usually live in Java and Dart) I am struggling with some of the stuff and I'm not managing to get things the way I'd like to.

Is there a way to keep the connection to the device open, so the re-connect is not necessary every time I send a position to my io-homecontrol rollershutters? How would that be kept open and how can I use that? It would be great if you could extend the examples a bit.

Also is there a way to do "fire and forget" instead of the awaits?

Thanks a lot and keep this great work going.

Current position doesn't work

Hello. I really appreciate your work!!

But I'm asking for a little help. I want to configure the automation of my pergola (with Somfy io motors/controllers). Sadly, I realized one of them breaks the Velux integration. After adding several vertical awnings to KLF200, everything worked fine, but when I added Somfy LED dimmer and horizontal awning (pergola blades) & rebooted the gateway & HA the integration failed.

I suspect horizontal awning is causing troubles as node 1025 (0x0401) is fairly close to the 0x0400 mentioned in the API to be the horizontal awning. It is also displayed under "My products" in the Velux KLF200 web interface as the horizontal awning. I really need this one to work (and probably many others will follow). Any suggestion, solution?

Log output:

2022-02-11 00:18:04 ERROR (MainThread) [homeassistant] Error doing job: application protocol failed to receive SSL data
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/sslproto.py", line 545, in data_received
self._app_protocol.data_received(chunk)
File "/usr/local/lib/python3.9/site-packages/pyvlx/connection.py", line 53, in data_received
frame = frame_from_raw(raw)
File "/usr/local/lib/python3.9/site-packages/pyvlx/api/frame_creation.py", line 50, in frame_from_raw
frame.from_payload(payload)
File "/usr/local/lib/python3.9/site-packages/pyvlx/api/frames/frame_get_all_nodes_information.py", line 144, in from_payload
self.node_type = NodeTypeWithSubtype(payload[69] * 256 + payload[70])
File "/usr/local/lib/python3.9/enum.py", line 384, in __call__
return cls.__new__(cls, value)
File "/usr/local/lib/python3.9/enum.py", line 702, in __new__
raise ve_exc
ValueError: 1025 is not a valid NodeTypeWithSubtype
2022-02-11 00:18:05 WARNING (MainThread) [homeassistant.setup] Setup of velux is taking over 10 seconds.
2022-02-11 00:18:13 ERROR (MainThread) [homeassistant.components.velux] Can't connect to velux interface: <PyVLXException description="Unable to retrieve node information" />
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 39, in async_setup
await hass.data[DATA_VELUX].async_start()
File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 85, in async_start
await self.pyvlx.load_nodes()
File "/usr/local/lib/python3.9/site-packages/pyvlx/pyvlx.py", line 76, in load_nodes
await self.nodes.load(node_id)
File "/usr/local/lib/python3.9/site-packages/pyvlx/nodes.py", line 69, in load
await self._load_all_nodes()
File "/usr/local/lib/python3.9/site-packages/pyvlx/nodes.py", line 87, in _load_all_nodes
raise PyVLXException("Unable to retrieve node information")
pyvlx.exception.PyVLXException: <PyVLXException description="Unable to retrieve node information" />
2022-02-11 00:18:13 ERROR (MainThread) [homeassistant.setup] Setup failed for velux: Integration failed to initialize.

Velux component: asynchronous startup

Hi!

I know this is actually in the velux component in hass, but I just saw a similar issue and thought I might address it here first (also because I do not have time to dig in to hass contribution stuff):

I believe the velux component may not be connecting at the optimal stage according to hass. (this is a wild accusation I came up with when looking at the hue integration)
I tried to move things around a bit and came up with this:

dumpfheimer/core@9308fea#diff-78e93eab257b26b0e223ef534c57c4cf98768ef63ffab7da79a9d8ea2e9f915c

The advantage of this approach was:

  • The startup of hass is not delayed
  • The entities are set up after pyvlx was able to establish a connection. If it fails at first, no restart is needed.

Things I am not quite sure about yet:

  • From reading the hass code I would believe that hass retries to load the component with increasing timeouts (limited at a max of 5 minutes?!). But it happened once or twice that hass gave up loading the component. Not sure why

I would appreciate feedback and or critics of someone with more experience concerning hass and pyvlx.

Different venetian blinds are 'open' at different orientation values

There seem to be two types of venetian blinds, one goes from -90° to + 90° (called type A from now on) another goes from 0° to 90° (called type B from now on).
The problem emerges on the "open" command. At the moment, when you 'open' the orientation, the 50% orientation is sent. For type A blinds this is the correct behavior, but type B blinds will be at 45°.

The topic seems to get more and more complicated as you get into it.
After my short research I believe there is no representation in HA of a -90/+90 blind, so the interface to HA will probably be the same for both (vs having -100% (closed) to 0% (open) to +100% (closed) in HA).

This takes away the more complicated solutions anyway. Pretty much the only thing left is changing the "open" value, as proposed by @pawlizio in Link 2.
So the "only thing left to do" is to distinguish between the two types.

There can/should be two ways to do that: automatically and manual.

  1. Automatic: would depend on a unique feature of the types, as mentioned in Link 3. My type B blind is EXTERIOR_VENETIAN_BLIND 0x0440.
  2. Manual: configure in HA configuration.yaml and pass the information to pyvlx somehow
  3. Manual: configure in HA Customizations (not sure if this is a UX benefit) and pass the information to pyvlx somehow

I, of course, would prefer the automatic solution, but am not familiar enough with the IO Homecontrol protocol / definitions to know if the distinction is possible with enough certainty to rely on it (Tahoma seems to let the user choose, which makes me less confident, see Link 4)

Any thoughts and information on this topic are/is very appreciated.

Links:

  1. Discussion on "open" vs "close" percent with a comment about 90/90 blinds:
    https://community.home-assistant.io/t/why-the-heck-cant-we-freely-configure-a-cover-to-interpret-its-percentage-value-as-percentage-open-or-percentage-closed/225453/64
  2. Comment on 90/90 blind issue:
    #44 (comment)
  3. Comment about Type identification
    #44 (comment)
  4. Comment and screenshot about the Tahoma solution (manual)
    #44 (comment)

python 2.7 support

As I understand asyncio is now need to use the new API.
Asyncio seems not compatible with Putin 2.7. So no way to have pylvx working on a 2.7 python instance?

please push latest commit as new release 0.1.6 to pyPI

Hi Julius

Thanks for your work, I was able to use it in my Home Automation project.
However I had to use the last commited version since I need a timeout of 60 seconds (thats how long it takes the shutters to open/close).
Could you please generate a new release and push it to PyPI so we get the extension with the Timeout parameter when pip installing.

Thanks

Tilt support for exterior blinds

I tried to understand what needs to be modified to support tilt functionality for exterior blinds. It seems KLF 200 provides this with Functional Parameter 3. But the API specification and your implementation are not so easy to understand.

I use home-assistant and moved from Somfy Tahoma to Velux KLF 200 in order to get rid of the somfy servers. However I recognized that my Raffstore don't support tilt functionality with the Velux integration.

Would be great if someone can support.

nodes.py - TypeError

Hi running hass.io 0.89.1 with a klf 200 unit with the latest firmware.
(I just bought the unit :=)

I have various products setup in the velux webinterface.

  • windows
  • shutters
  • blinds
  • awning blinds

It seems it wont load up properly in hass.io.

hass.io configuration.yaml

velux:
host: "192.168.1.123"
password: "wifipass"

hass.io logs:

[homeassistant.setup] Error during setup of component velux
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/setup.py”, line 151, in _async_setup_component
hass, processed_config)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/velux/init.py”, line 30, in async_setup
await hass.data[DATA_VELUX].async_start()
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/velux/init.py”, line 57, in async_start
await self.pyvlx.load_nodes()
File “/usr/local/lib/python3.7/site-packages/pyvlx/pyvlx.py”, line 83, in load_nodes
await self.nodes.load(node_id)
File “/usr/local/lib/python3.7/site-packages/pyvlx/nodes.py”, line 70, in load
await self._load_all_nodes()
File “/usr/local/lib/python3.7/site-packages/pyvlx/nodes.py”, line 91, in _load_all_nodes
self.add(node)
File “/usr/local/lib/python3.7/site-packages/pyvlx/nodes.py”, line 54, in add
raise TypeError()
TypeError

I'd be glad to help you out in debugging this :)

Incorrect Current Orientation with Somfy Venetian Blind

Servus!

Yesterday I started migrating my Home Assistant -> Somfy Connexoon to HA -> Velux KFL 200 which worked kind of nicely, but the "tilt position" (=orientation) was missing. So I went ahead and added that to HA.

Setting the orientation works flawlessly, but it always shows strange "current orientation" values. I then set pyvlx to debug and it seems like it is receiving those strange values from the blind. But I was hoping you could confirm that for me.

IF it is the blind, that is sending strange/unhandled signals, would it be possible to use the sent values as current values for this particular blind/product? It did show the right position in the Somfy App.
IF it is not the blind. Do you have any idea what those values could mean? I went through the code and came to the conclusion it actually is within the "position range" which - I guess - would mean it would be a pretty inconvenient "special value"

I appreciate any help.

Vielen Dank!

I copied 2 debug logs from when I tried to set the orientation (it did set it correctly)

EXAMPLE 1

Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] SEND: <FrameCommandSendRequest node_ids=[3] parameter="10 %" functional_parameter="fp1: 0 %, fp2: 0 %, fp3: 100 %, fp4: 0 %, fp5: 0 %, fp6: 0 %, fp7: 0 %, fp8: 0 %, fp9: 0 %, fp10: 0 %, fp11: 0 %, fp12: 0 %, fp13: 0 %, fp14: 0 %, fp15: 0 %, fp16: 0 %, " session_id=56 originator=Originator.USER/>
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] REC: <FrameCommandSendConfirmation session_id=56 status=CommandSendConfirmationStatus.ACCEPTED/>
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] REC: <FrameNodeStatePositionChangedNotification node_id=3 state=2 current_position='0x13FC' target='0x1400' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0xF7FF' current_position_fp4='0xF7FF' remaining_time=0 time='2032-02-08 12:54:40'/>
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] NodeUpdater process frame: <FrameNodeStatePositionChangedNotification node_id=3 state=2 current_position='0x13FC' target='0x1400' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0xF7FF' current_position_fp4='0xF7FF' remaining_time=0 time='2032-02-08 12:54:40'/>
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] Living Room Left position changed to: 9 %
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] REC: <FrameCommandRunStatusNotification session_id=56 status_id=1 index_id=3 node_parameter=0 parameter_value=5116/>
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] REC: <FrameCommandRemainingTimeNotification session_id=56 index_id=3 node_parameter=0 seconds=1/>
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] REC: <FrameNodeStatePositionChangedNotification node_id=3 state=4 current_position='0x13FC' target='0x1400' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0x39BD' current_position_fp4='0xF7FF' remaining_time=1 time='2032-02-08 12:54:40'/>
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] NodeUpdater process frame: <FrameNodeStatePositionChangedNotification node_id=3 state=4 current_position='0x13FC' target='0x1400' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0x39BD' current_position_fp4='0xF7FF' remaining_time=1 time='2032-02-08 12:54:40'/>
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] Living Room Left position changed to: 9 %
Jul 6 21:00:34 server run.sh[3602197]: 2020-07-06 21:00:34 DEBUG (MainThread) [pyvlx] Living Room Left orientation changed to: 28 %
Jul 6 21:00:36 server run.sh[3602197]: 2020-07-06 21:00:36 DEBUG (MainThread) [pyvlx] REC: <FrameCommandRunStatusNotification session_id=56 status_id=1 index_id=3 node_parameter=0 parameter_value=5116/>
Jul 6 21:00:36 server run.sh[3602197]: 2020-07-06 21:00:36 DEBUG (MainThread) [pyvlx] REC: <FrameSessionFinishedNotification session_id=56 />
Jul 6 21:00:36 server run.sh[3602197]: 2020-07-06 21:00:36 DEBUG (MainThread) [pyvlx] REC: <FrameNodeStatePositionChangedNotification node_id=3 state=5 current_position='0x13FC' target='0x1400' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0x39BD' current_position_fp4='0xF7FF' remaining_time=0 time='2032-02-10 01:19:12'/>
Jul 6 21:00:36 server run.sh[3602197]: 2020-07-06 21:00:36 DEBUG (MainThread) [pyvlx] NodeUpdater process frame: <FrameNodeStatePositionChangedNotification node_id=3 state=5 current_position='0x13FC' target='0x1400' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0x39BD' current_position_fp4='0xF7FF' remaining_time=0 time='2032-02-10 01:19:12'/>
Jul 6 21:00:36 server run.sh[3602197]: 2020-07-06 21:00:36 DEBUG (MainThread) [pyvlx] Living Room Left position changed to: 9 %
Jul 6 21:00:36 server run.sh[3602197]: 2020-07-06 21:00:36 DEBUG (MainThread) [pyvlx] Living Room Left orientation changed to: 28 %

EXAMPLE 2

Jul 6 21:01:09 server run.sh[3602197]: 2020-07-06 21:01:09 DEBUG (MainThread) [pyvlx] SEND: <FrameCommandSendRequest node_ids=[3] parameter="20 %" functional_parameter="fp1: 0 %, fp2: 0 %, fp3: 100 %, fp4: 0 %, fp5: 0 %, fp6: 0 %, fp7: 0 %, fp8: 0 %, fp9: 0 %, fp10: 0 %, fp11: 0 %, fp12: 0 %, fp13: 0 %, fp14: 0 %, fp15: 0 %, fp16: 0 %, " session_id=57 originator=Originator.USER/>
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] REC: <FrameCommandSendConfirmation session_id=57 status=CommandSendConfirmationStatus.ACCEPTED/>
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] REC: <FrameNodeStatePositionChangedNotification node_id=3 state=2 current_position='0x13FC' target='0x2800' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0x39BD' current_position_fp4='0xF7FF' remaining_time=0 time='2032-03-06 20:16:16'/>
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] NodeUpdater process frame: <FrameNodeStatePositionChangedNotification node_id=3 state=2 current_position='0x13FC' target='0x2800' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0x39BD' current_position_fp4='0xF7FF' remaining_time=0 time='2032-03-06 20:16:16'/>
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] Living Room Left position changed to: 9 %
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] Living Room Left orientation changed to: 28 %
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] REC: <FrameCommandRunStatusNotification session_id=57 status_id=1 index_id=3 node_parameter=0 parameter_value=5116/>
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] REC: <FrameCommandRemainingTimeNotification session_id=57 index_id=3 node_parameter=0 seconds=5/>
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] REC: <FrameNodeStatePositionChangedNotification node_id=3 state=4 current_position='0x13FC' target='0x2800' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0xBC3F' current_position_fp4='0xF7FF' remaining_time=5 time='2032-03-06 20:16:16'/>
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] NodeUpdater process frame: <FrameNodeStatePositionChangedNotification node_id=3 state=4 current_position='0x13FC' target='0x2800' current_position_fp1='0xF7FF' current_position_fp2='0xF7FF' current_position_fp3='0xBC3F' current_position_fp4='0xF7FF' remaining_time=5 time='2032-03-06 20:16:16'/>
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] Living Room Left position changed to: 9 %
Jul 6 21:01:10 server run.sh[3602197]: 2020-07-06 21:01:10 DEBUG (MainThread) [pyvlx] Living Room Left orientation changed to: 94 %

pyvlx ssl handshake error 2021.6.0 & 2021.6.1

The problem

When I perform the home-assistant upgrade to 2021.6.0 & 2021.6.1, the velux integration no longer works.
Logging shows it terminates with the famous SSL handshake message.
Rebooting the KLF, which mostly solves issues after HA upgrade/reboot/..., doesn't work. Once the KLF reboot is initiated I also reloaded HA to restart the integration loading.
Downgrading to core-2021.5.5 solves the issue, the integration loads without errors.

What is version of Home Assistant Core has the issue?

core-2021.6.0 & core-2021.6.1

What was the last working version of Home Assistant Core?

core-2021.5.5

Anything in the logs that might be useful for us?

Version supervisor-2021.05.4
Operating System Home Assistant OS 5.13
Deployment production

Logger: homeassistant.setup
Source: components/velux/init.py:76
First occurred: 8:51:57 (1 occurrences)
Last logged: 8:51:57

Error during setup of component velux
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 248, in _async_setup_component
result = await task
File "/usr/src/homeassistant/homeassistant/components/velux/init.py", line 31, in async_setup
await hass.data[DATA_VELUX].async_start()
File "/usr/src/homeassistant/homeassistant/components/velux/init.py", line 76, in async_start
await self.pyvlx.load_scenes()
File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 80, in load_scenes
await self.scenes.load()
File "/usr/local/lib/python3.8/site-packages/pyvlx/scenes.py", line 51, in load
await get_scene_list.do_api_call()
File "/usr/local/lib/python3.8/site-packages/pyvlx/api/api_event.py", line 21, in do_api_call
await self.send_frame()
File "/usr/local/lib/python3.8/site-packages/pyvlx/api/api_event.py", line 33, in send_frame
await self.pyvlx.send_frame(self.request_frame())
File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 66, in send_frame
await self.connect()
File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 43, in connect
await self.connection.connect()
File "/usr/local/lib/python3.8/site-packages/pyvlx/connection.py", line 87, in connect
self.transport, _ = await self.loop.create_connection(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1050, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1080, in _create_connection_transport
await waiter
ConnectionAbortedError: SSL handshake is taking longer than 60.0 seconds: aborting the connection

RollerShutter position w/o previous set_postion() / stop()

Hi,

I'm probably blind, but what is the proper way to get/update the current shutter position?
I tried .stop() followed by printing .position. This seems to work most of the time. But is there a better way? .stop() could potentially interrupt a movement.

Cheers,
Juergen

Keeping connection open freezes KLF

Hello,

I have my connection with KLF 200 open for an infinite time (it should react any time I issue a command). However, within usually 24 hours I lose the ability to talk to KLF (no reaction) and when trying to establish a connection I receive:

Connecting to KLF 200.
Traceback (most recent call last):
  File "/home/velux/klf200control/vlxcontrol/vlxcontrol.py", line 152, in <module>
    LOOP.run_until_complete(init_pyvlx_connection(LOOP))
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/velux/klf200control/vlxcontrol/vlxcontrol.py", line 26, in init_pyvlx_connection
    await pyvlx.load_nodes()
  File "/home/velux/.local/lib/python3.7/site-packages/pyvlx/pyvlx.py", line 83, in load_nodes
    await self.nodes.load(node_id)
  File "/home/velux/.local/lib/python3.7/site-packages/pyvlx/nodes.py", line 70, in load
    await self._load_all_nodes()
  File "/home/velux/.local/lib/python3.7/site-packages/pyvlx/nodes.py", line 86, in _load_all_nodes
    await get_all_nodes_information.do_api_call()
  File "/home/velux/.local/lib/python3.7/site-packages/pyvlx/api_event.py", line 22, in do_api_call
    await self.send_frame()
  File "/home/velux/.local/lib/python3.7/site-packages/pyvlx/api_event.py", line 34, in send_frame
    await self.pyvlx.send_frame(self.request_frame())
  File "/home/velux/.local/lib/python3.7/site-packages/pyvlx/pyvlx.py", line 70, in send_frame
    await self.connect()
  File "/home/velux/.local/lib/python3.7/site-packages/pyvlx/pyvlx.py", line 45, in connect
    await self.connection.connect()
  File "/home/velux/.local/lib/python3.7/site-packages/pyvlx/connection.py", line 89, in connect
    ssl=self.create_ssl_context())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 986, in create_connection
    ssl_handshake_timeout=ssl_handshake_timeout)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 1014, in _create_connection_transport
    await waiter
ConnectionAbortedError: SSL handshake is taking longer than 60.0 seconds: aborting the connection

The only thing that helps is to unplug the KLF200 from the power source and replug it and have it fresh started. Any idea what the reason for this could be / any way to work around this?

"Unable to send command" debug

So, I've been seeing a lot of the following in my Home Assistant logs recently

File "/usr/local/lib/python3.11/site-packages/pyvlx/opening_device.py", line 49, in set_position
    raise PyVLXException("Unable to send command")

which is starting to get a bit annoying. Any thoughts on how to debug this, or at least get more information than just "computer says no", because I'd love to sort this one out.

Rain Sensor

Hi, just a question

Is there a away to know if the rain sensor is detecting rain? regading the state of the windows? open/closed?

thnx in advance

Inverted status for awnings

Hi !

Thanks for the great work on that project !

I have an issue awnings, the status is inverted. When they are closed, the status is "open" when they are closed and vice-versa.

Kind regards,
WM

Controlling ON/Off switches

Hi,
First: Thank you for this wonderful library, it is really good with clear documented code and it works really great 👍
But as nothing is perfect, I've a problem trying to get a Somfy io-homecontrol switch to work with it. I take a look at the file without any success to understand why the switch do not work...
It works with two Velux remotes without problem, with one (KLR-200) configured from a synchro from the KLF-200.
Getting the state is_on()/is_off() gives nothing. Same with asyncio commands to set_on()/set_off() but Nodes[] list it correctly.
Here is what is inside the object's parameters:

<FrameGetAllNodesInformationNotification
	node_id=3
	order=3
	placement=0
	name='On/Off Switch'
	velocity=Velocity.SILENT
	node_type='NodeTypeWithSubtype.ON_OFF_SWITCH'
	product_group=0
	product_type=0
	node_variation=NodeVariation.NOT_SET
	power_mode=0
	build_number=0
	serial_number='None'
	state=5
	current_position='0xC800'
	target='0xC800'
	current_position_fp1='0xF7FF'
	current_position_fp2='0xF7FF'
	current_position_fp3='0xF7FF'
	current_position_fp4='0xF7FF'
	remaining_time=0
	time='2020-09-12 15:21:45'
	alias_array=''
/>

What I see is that the product have no power_mode, build_number and serial_number set. Some of your functions are using the serial_number, but I have seen nothing related the switch.
As I'm using Home-Assistant, my hope is to see power switches supported in it through the Velux module (which uses pyvlx).
Do you think you can do something about it to make it work?

Thank you very much for your help.

Enable GW_COMMAND_SEND_REQ to several nodes at once from HA

GW_COMMAND_SEND_REQ allows to send the command to more nodes at once.

This could be exposed to HA cover.set_cover_position by enabling more than one entity_id to be passed (however I simply don't know, whether HA allows this).

By looking at the code, I believe it should not be too complex - but unfortunately I'm a complete newbie to python and currently lacking time to learn so I'm unable to do it myself.

Thank you!

Retry mechanism ...

Looks like the token expires after an undefined time. Add a retry mechanism within api_call....

Build failure with Python 3.10

If running with Python 3.10 then the tests don't pass.

[...]
self.name)
                        )
E               AttributeError: Command: no attribute
'GW_LEAVE_LEARN_STATE_REQ'

/usr/lib64/python3.10/enum.py:146: AttributeError
=========================== short test summary info
============================
FAILED
test/frame_leave_learn_state_req_test.py::TestFrameLeaveLearnStateRequest::test_frame_from_raw
======================== 1 failed, 287 passed in 0.84s
=========================

See https://bugzilla.redhat.com/show_bug.cgi?id=1928062 for details.

Tanks

Upload to Pypi

Hi @Julius2342 ,

sorry have problems to update pypi for the 0.2.23. Can you please update pypi. I had to correct the discovery.py sligtly in order to allow testing at HA side for this PR home-assistant/core#112451

Thanks and best regards!

Roller shutter warning

WARNING: Could not parse product: Roller shutter

How can i help you with this to test?
I can only grab window 0 and 1 but i have 4 device 2 shuutter and 2 window.

Enable velocity parameter

It isn't possible to control the speed of opening or closing devices even though this functionality exists in the KLF200 API.
The facility to control velocity is important where windows and blinds are fitted in bedrooms when fast operation may be too noisy.
The functions to get available velocities and set velocity are included in the Velux API v3.16 but not included in this interface.
Available settings for velocity are shown here:
image
In practical terms it would be desirable to be able to pass a desired velocity to the API, check that the node can accept the command and then execute it, incorporating these calls into the open/close commands.

image

Velux component in Home Assistant does not set-up due to timeout.

Since I have upgraded to Home Assistant release 116 (I have skipped 115) my Velux component will simply not set-up. To me it seems like the SSL timeout was reduced from 30s to 5s and during HA start this interval is too short.

2020-10-08 23:09:21 INFO (MainThread) [homeassistant.setup] Setting up velux
2020-10-08 23:09:21 WARNING (MainThread) [pyvlx] Connecting to KLF 200.
2020-10-08 23:09:31 ERROR (MainThread) [homeassistant.setup] Error during setup of component velux
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 31, in async_setup
    await hass.data[DATA_VELUX].async_start()
  File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 69, in async_start
    await self.pyvlx.load_scenes()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 96, in load_scenes
    await self.scenes.load()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/scenes.py", line 51, in load
    await get_scene_list.do_api_call()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/api_event.py", line 21, in do_api_call
    await self.send_frame()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/api_event.py", line 33, in send_frame
    await self.pyvlx.send_frame(self.request_frame())
  File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 82, in send_frame
    await self.connect()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 46, in connect
    await self.connection.connect()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/connection.py", line 86, in connect
    self.transport, _ = await self.loop.create_connection(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1050, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1080, in _create_connection_transport
    await waiter
ConnectionAbortedError: SSL handshake is taking longer than 5 seconds: aborting the connection

Less than a minute later, the KLF200 connection is established again - this time succesfully. Subsequently KLF200 sends updates to HA which also are properly logged --> the connection is alive. However as the set-up of the component failed, the devices are invisible to HA and can't be controlled.

2020-10-08 23:10:21 WARNING (MainThread) [pyvlx] Connecting to KLF 200.
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] SEND: <FramePasswordEnterRequest password=ve****/>
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] REC: <FramePasswordEnterConfirmation status='PasswordEnterConfirmationStatus.SUCCESSFUL'/>
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] SEND: <FrameGetVersionRequest/>
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] REC: <FrameGetVersionConfirmation software_version="0.2.0.0.71.0" harware_version="5" product="KLF 200"/>
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] SEND: <FrameGetProtocolVersionRequest/>
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] REC: <FrameGetProtocolVersionConfirmation version="3.14"/>
2020-10-08 23:10:26 WARNING (MainThread) [pyvlx] Connected to: KLF 200: Software version: 0.2.0.0.71.0, hardware version: 5, protocol version: 3.14
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] SEND: <FrameSetUTCRequest time="2020-10-08 23:10:26"/>
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] REC: <FrameSetUTCConfirmation/>
2020-10-08 23:10:26 DEBUG (MainThread) [pyvlx] SEND: <FrameHouseStatusMonitorEnableRequest/>
2020-10-08 23:10:29 DEBUG (MainThread) [pyvlx] REC: <FrameHouseStatusMonitorEnableConfirmation/>
2020-10-08 23:10:29 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
2020-10-08 23:10:29 DEBUG (MainThread) [pyvlx] REC: <FrameGetStateConfirmation gateway_state="GatewayState.GATEWAY_MODE_WITH_ACTUATORS" gateway_sub_state="GatewaySubState.IDLE"/>
2020-10-08 23:11:29 DEBUG (MainThread) [pyvlx] SEND: <FrameGetStateRequest/>
2020-10-08 23:11:29 DEBUG (MainThread) [pyvlx] REC: <FrameGetStateConfirmation gateway_state="GatewayState.GATEWAY_MODE_WITH_ACTUATORS" gateway_sub_state="GatewaySubState.IDLE"/>
...

Garage door is not reporting its position

The problem

With Home assistant release 2024.1 my garage door position is not reported in Home assistant when the door is activated with the remote control. All my other opening devices are reported correctly ( ROLLER_SHUTTER, SWINGING_SHUTTERS).
Logging shows an error
node_id="7" run_status="RunStatus.EXECUTION_FAILED" status_reply="StatusReply.PRODUCT_NOT_OPERATIONAL" status_type="StatusType.REQUEST_UNKNOWN"

What is version of Home Assistant Core has the issue?**

core-2024.1.6

What was the last working version of Home Assistant Core?**

core-2023.12.4

Anything in the logs that might be useful for us?

This is the garage_door entry creation at startup:

2024-02-09 23:15:45.781 DEBUG (MainThread) [pyvlx] REC: <FrameGetAllNodesInformationNotification node_id="7" order="7" placement="0" name="Garage" velocity="Velocity.SILENT" node_type="NodeTypeWithSubtype.GARAGE_DOOR_OPENER" product_group="0" product_type="0" node_variation="NodeVariation.NOT_SET" power_mode="0" build_number="0" serial_number="None" state="UNKNOWN" current_position="UNKNOWN" target="UNKNOWN" current_position_fp1="UNKNOWN" current_position_fp2="UNKNOWN" current_position_fp3="UNKNOWN" current_position_fp4="UNKNOWN" remaining_time="0" time="2024-02-09 23:15:31" alias_array=""/>

and the heartbeat extract of the garage door:
2024-02-09 23:16:19.666 DEBUG (MainThread) [pyvlx] SEND: <FrameStatusRequestRequest session_id="8" node_ids="[7]" status_type="StatusType.REQUEST_CURRENT_POSITION" fpi1="254" fpi2="0"/> 2024-02-09 23:16:19.798 DEBUG (MainThread) [pyvlx] REC: <FrameStatusRequestConfirmation session_id="8" status="StatusRequestStatus.ACCEPTED"/> 2024-02-09 23:16:19.852 DEBUG (MainThread) [pyvlx] REC: <FrameStatusRequestNotification session_id="8" status_id="1" node_id="7" run_status="RunStatus.EXECUTION_FAILED" status_reply="StatusReply.PRODUCT_NOT_OPERATIONAL" status_type="StatusType.REQUEST_UNKNOWN" status_count="0" parameter_data=""/> 2024-02-09 23:16:19.853 DEBUG (MainThread) [pyvlx] NodeUpdater process frame: <FrameStatusRequestNotification session_id="8" status_id="1" node_id="7" run_status="RunStatus.EXECUTION_FAILED" status_reply="StatusReply.PRODUCT_NOT_OPERATIONAL" status_type="StatusType.REQUEST_UNKNOWN" status_count="0" parameter_data=""/> 2024-02-09 23:16:19.853 DEBUG (MainThread) [pyvlx] REC: <FrameSessionFinishedNotificationsession_id="8"/>`

Full init log of pyvlx :
pyvlx startup complete.txt

Full Heartbeat log :
Heartbeat complet.txt

Node Type 0x0401 not handled

I am using the KLF200 with several VELUX blinds and a Somfy motor. The Somfy motor is reported as a node with type 4 and subtype 1. But according to this enum (https://github.com/Julius2342/pyvlx/blob/master/pyvlx/const.py#L297) and also the KLF200 API documentation there is no subtype 1 for type 4. As a consequence the pyvlx module throws an exception when reading the nodes from the KLF200:

Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/sslproto.py", line 737, in _do_read
    self._do_read__copied()
  File "/usr/lib/python3.11/asyncio/sslproto.py", line 799, in _do_read__copied
    self._app_protocol.data_received(b''.join(data))
  File "/home/raphael/involi/velux/pyvlx/pyvlx/connection.py", line 62, in data_received
    frame = frame_from_raw(raw)
            ^^^^^^^^^^^^^^^^^^^
  File "/home/raphael/involi/velux/pyvlx/pyvlx/api/frame_creation.py", line 55, in frame_from_raw
    frame.from_payload(payload)
  File "/home/raphael/involi/velux/pyvlx/pyvlx/api/frames/frame_get_all_nodes_information.py", line 151, in from_payload
    self.node_type = NodeTypeWithSubtype(payload[69] * 256 + payload[70])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 714, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 1137, in __new__
    raise ve_exc
ValueError: 1025 is not a valid NodeTypeWithSubtype

The KLF200 is running latest firmware 0.2.0.0.71.0

I don't understand if this is a new subtype that has been added recently but is not yet documented/handled or if the device is somehow reporting a wrong subtype. Any ideas?

Which IDE for debug

Hi,
Just a question regarding which IDE you use for development and debug?
I have used VS Code for various things, but can't seem to get the the paths set correctly for debugging from the sample into the module. Any experience/idea?

got timeout when addressing klf200

Issue:
klf200 is responding after scene has completed, which means that the http request configured with 10s timeout will stop and raise an error, if scene takes more than 10s

Solution:
increase timeout or make it configurable
In my fork I already did this: dirk777@6cdede0
If you want, I can make another pull request out of it?

Stop cover command throws an error

I have problems with changes introduced with #338

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/velux/cover.py", line 285, in async_stop_cover
    await self.node.stop(wait_for_completion=False)
  File "/usr/local/lib/python3.11/site-packages/pyvlx/opening_device.py", line 404, in stop
    await self.set_position_and_orientation(
  File "/usr/local/lib/python3.11/site-packages/pyvlx/opening_device.py", line 307, in set_position_and_orientation
    self.target_position = TargetPosition.from_position(position)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyvlx/parameter.py", line 277, in from_position
    target.position_percent = from_position.position_percent
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyvlx/parameter.py", line 240, in position_percent
    self.raw = self.from_percent(percent=position_percent)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyvlx/parameter.py", line 91, in from_percent
    raise PyVLXException("Position::percent_out_of_range")
pyvlx.exception.PyVLXException: <PyVLXException description="Position::percent_out_of_range" />

Add outdoor heater functionality?

Hi - I have outdoor heaters on my KLF-200. I scanned the API and they look much like lights (essentially they take a heat demand rather than a light demand).

How easy would it be to add support for these? I'd love to get them into Home Assistant?

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.