Velux Component for KLF 200 doesn't support the new API with Firmware 2.0.0.71

hi Dominique,

i had a similar issue on previous firmware version and was due to the fact KLF200 seems to accept only 1 connection at the time over ethernet.
I solved power cycling it.

Not sure if it is your case but it costs nothing to try.
Hope this helps

Thank you, i will try that. However, I am wondering what process is connecting to the KLF over LAN. There is no open port on the typical range.

Well, i‘ve restarted my Velux and I still cannot connect. Any ideas?

Hi, try these ideas

  1. Power cycle, and then connect to the WIFI access port it creates. Its only up for 10 or 15 minutes after a power cycle
  2. Connect to the web interface using the address and password on the back
  3. Good opportunity to sync your device off the Velux remotes.
  4. In the settings area check that the LAN port is not disabled!
  5. Try and ping the LAN port. Interesting thing here… My AUSUS wifi router never lists the Velux Hub in its connected device list (all other devices show up). I am not sure what magic is happening here, but its never listed. I had to manually use the LAN MAC on the back of the device, use it to set the DHCP server so I knew the IP (even then, not in the device list). After that it does return a ping. I can also ping it when its connected to HA.
  6. Then add the IP and password into HA and it should come up.

If any of this doesn’t work, do a factory reset, using a paper clip on the back and try again. Pull the user manual for the description, it seems unnecessarily complex! You have to hold it for about 10 seconds and then there is an LED sequence to confirm it worked. I needed to do this, to get things going.

I’ve had a similar problem, and after lots of head scratching and debugging I was surprised to realize that using ‘velux123’ instead of the Wifi password worked. Not sure if it’s the same issue here, but worth a try…

Neither the web password (velux123) nor the Wifi password is working. I am just wondering if there is anything I can do to troubleshot the configuration.

By the way, the old API access did work before I’ve flashed my KLF with the new firmware - even with the latest HA update.

It seems that the factory reset as suggested by jasebob would be the thing to do. I did everything else… even the device shows up in my Unfi network.

Hi,

It looks like Velux component is creating an issue to me.
I am on 0.89.1 and KLF200 correctly updated.

I put cover in GUI via Lovelace interface and renamed them (again via Lovelace) and…on HA reboot it didn’t load the frontend anymore.
I deleted HA database but didn’t work: only thing solved was to disable Velux component.

Now I don’t know what cause the issue: if this has something to do with Velux component itself or core.entity_registry which I read on the forum could cause similar issue: Link

Any idea how to dig more in it?

I finally bought the klf200 after using a hacked up remote control wires soldered on (esp8266 + web api).

Anyways… I see the same issues as you do.
I already miss my hacked up remote control API hehe.
Im on 0.89.1 and the web adm page of the klf unit works also. I imported the products etc etc.

2019-03-11 19:14:16 ERROR (MainThread) [homeassistant.components.velux] Can’t connect to velux interface:
Traceback (most recent call last):
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 56, in async_start
await self.pyvlx.load_scenes()
File “/usr/local/lib/python3.7/site-packages/pyvlx/pyvlx.py”, line 87, in load_scenes
await self.scenes.load()
File “/usr/local/lib/python3.7/site-packages/pyvlx/scenes.py”, line 51, in load
await get_scene_list.do_api_call()
File “/usr/local/lib/python3.7/site-packages/pyvlx/api_event.py”, line 22, in do_api_call
await self.send_frame()
File “/usr/local/lib/python3.7/site-packages/pyvlx/api_event.py”, line 34, in send_frame
await self.pyvlx.send_frame(self.request_frame())
File “/usr/local/lib/python3.7/site-packages/pyvlx/pyvlx.py”, line 70, in send_frame
await self.connect()
File “/usr/local/lib/python3.7/site-packages/pyvlx/pyvlx.py”, line 49, in connect
raise PyVLXException(“Unable to login”)
pyvlx.exception.PyVLXException:

I swapped the web password “velux123” to the wifi password of the box… and then I am connected.

Another error thrown at me… But atleast now I see some progress.

[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

So it looks like the issue I had, which was blocking hass, was due to KLF200.
I simply rebooted it, restarted hass and now all fine.

A bit scaring this component can hang up hass

Been having some issues where rebooting the hass.io device (for whatever reasons) would cause the subsequent velux connection to fail.

It doesnt happen always.
I can often reboot the hass.io device 4-5 times before it happens.

As you know, rebooting hass.io is mandatory when changing certain things within configuration.yaml - nothing to do with the velux component.

Im just grasping straws here… but could it have anything to do with the velux component not properly disposing its connection to klf200 when hass.io is told to reboot ?

I could easily think of a scenario where the klf 200 unit could not accept any more connections from the same host as would be the case if the previous connection was not properly terminated.

The fix is rebooting the klf 200 unit, as suspected.
but this is a bit tiresome :frowning:

In my case it is doing this every single time which is super annoying
Also this prevents a remote HASS reboot as if i do to this it doesn’t start anymore.

@balloob: I open an issue on GitHub but without having too much attention on it. Don’t you think it is an important one?
Sorry to bother naming directly: my doubt is you are not aware

Ive done a local fix here. Haven’t seen the issue since.
Let me know if you want to try it out.

Yes please!

Can you please provide some instructions how to?
Is it making such that hass can load even if can’t connect to klf200 or sorting out klf200 connection issue?

seems I cant upload zip archives to this forum.

So here’s link to google drive:

copy the files to:

\hass.io\config\custom_components

reboot hass

Logs should have this line to indicate its running a custom component.

2019-03-30 16:23:56 WARNING (MainThread) [homeassistant.loader] You are using a custom component for velux which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

what the patch does is quite simple: it disconnects the klf200 connection when hass reboot is called. Atleast I hope so :slight_smile:

testing it:

  • installed and confirmed custom component is loaded as you suggested
  • at first restart i rebooted KLF200 just to start from scratch
  • everything loaded fine
  • stopped HASS and waited 30s or so
  • restarted HASS all fine and KLF is connected (please note in my case i have never been able to do so, hence looks like it is working!)

you should pull this request to mainstream if confirmed by other users

2 Likes

anyone else noticed an issue with velux cover devices reporting a value of ‘current_position’ as ‘-23’
I have lots of devices reporting this.
Maybe its the initial value upon a just rebooted hass.io ?

I just restarted hass.io and …guess what, all devices are now at ‘-23’

once I activate some of the devices the correct value is shown.

never noticed this: can you please let me know how can i check this?

yes… easy. reboot has.io device

once rebooted go to the “states” secion of the developer tools (at the bottom).
filter entity name using “cover”… it should list all cover entities.
pay attention now to the attribute “current_position”.
In my case its -23 for all devices.

if I click on one of the cover devices it opens up the usual small UI that represents the arrow up/down and stop buttons as well as the current state as a slider.

All buttons are available here since its confused about the current_position.
Normally when current_position is 0 or 100 only one of the 2 arrow buttons (open/close cover) are available.

anyone here had any luck trying to debug the pyvlx sources on a hass.io ?

I copied the pyvlx sources from github and onto:
\config\custom_components\pyvlx

I also copied
init.py
cover.py
scene.py
…from github


to:

\config\custom_components\velux

I then edited init.py
changing all pyvlx imports to custom_components.pyvlx import

so we have:
from custom_components.pyvlx import PyVLX
#from pyvlx import PyVLX

from custom_components.pyvlx import PyVLXException
#from pyvlx import PyVLXException

rebooting the hass.io I can see that it loads the custom component.
It reacts fine to whatever logging I add within the pyvlx source files.
So it nice in this regard.

Although, it seems to throw an excepion upon connecting to the KLF 200

2019-04-06 15:33:28 ERROR (MainThread) [custom_components.velux] Can’t connect to velux interface:
Traceback (most recent call last):
File “/config/custom_components/velux/init.py”, line 37, in async_setup
await hass.data[DATA_VELUX].async_start()
File “/config/custom_components/velux/init.py”, line 65, in async_start
await self.pyvlx.load_scenes()
File “/config/custom_components/pyvlx/pyvlx.py”, line 87, in load_scenes
await self.scenes.load()
File “/config/custom_components/pyvlx/scenes.py”, line 51, in load
await get_scene_list.do_api_call()
File “/config/custom_components/pyvlx/api_event.py”, line 22, in do_api_call
await self.send_frame()
File “/config/custom_components/pyvlx/api_event.py”, line 34, in send_frame
await self.pyvlx.send_frame(self.request_frame())
File “/config/custom_components/pyvlx/pyvlx.py”, line 70, in send_frame
await self.connect()
File “/config/custom_components/pyvlx/pyvlx.py”, line 49, in connect
raise PyVLXException(“Login to KLF 200 failed, check credentials”)
custom_components.pyvlx.exception.PyVLXException:

Any ideas ?