Overkiz integration - Local API [Development / Testers topic]

Somfy announced the Somfy TaHoma Developer Mode, which offers a local API on eligble TaHoma boxes (TaHoma V2, TaHoma switch, TaHoma DIN-Rail v1 & v2).

We are (still :wink:) working on adding this to core and this topic can be used for discussion about the features and testing the functionality.

Core issue: Implement Somfy local API in Overkiz integration 路 Issue #69558 路 home-assistant/core 路 GitHub
Core PR: Add local API support to Overkiz integration (Somfy TaHoma Developer Mode) by iMicknl 路 Pull Request #71644 路 home-assistant/core 路 GitHub

How to test?
If you have developer experience, you can try to check out and run Add local API support to Overkiz integration (Somfy TaHoma Developer Mode) by iMicknl 路 Pull Request #71644 路 home-assistant/core 路 GitHub.

Otherwise, you can follow the next steps:

  1. Follow the installation steps for this custom component:
    alandtse/pr_custom_component: Create a custom component from a Home Assistant Integration Pull Request. Use this when you want to test a pull request that changes a built in integration. (github.com)

  2. When you are done, provide the following URL https://github.com/home-assistant/core/pull/71644 and follow the steps of the documentation above.

Now you should have our alpha version to test. Please don鈥檛 test it on your production instance, since there can be still bugs / breaking changes.

Alternative method to test: Overkiz API and Somfy API - #1829 by Mariusthvdb.

It helps a lot if you turn on debug logging and add your diagnostics file for any bugs that you want to report.

1 Like

Hi Mick,
Thank you for your work!
I tried to update to your last version from 1 hour ago and still get two errors :

  • Can鈥檛 manually add : configure manual entries click does nothing.
  • Token error using gateway-xxxx-xxxx-xxxx.local:8443 or local ip
Logger: homeassistant.config_entries
Source: custom_components/overkiz/__init__.py:66
Integration: Custom Overkiz PR#71644
First occurred: 20:22:50 (1 occurrences)
Last logged: 20:22:50

Error setting up entry gateway-XXXX-XXXX-XXXX.local:8443 for overkiz
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 365, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/overkiz/__init__.py", line 66, in async_setup_entry
    token = entry.data[CONF_TOKEN]
KeyError: 'token

All right!

Two things:

  1. Following step one from above, the PR Custom Component will only work if you go and change line 330 in apy.py to: 鈥渁sync with async_timeout.timeout(TIMEOUT):鈥 Otherwise it gives a loop error message when trying to pull the link from step two.

  2. After finishing with the steps, there鈥檚 a new discovery with the modified overkiz. When configuring you only get to enter the credentials, there is no choice of hub or local api. Once the credentials are entered all the devices connected to the TaHoma are found. However it seems to be using the cloud and not local api.

For now; I have not worked on the discovery yet. Best is to just create a new entry via the 鈥楢dd integration 鈫 Overkiz鈥 menu.

This is out of my control unfortunately, but perhaps you can do a PR on the PR custom component repository?

I am not sure what goes wrong here鈥 How do you add the integration?

Regarding the PR CC, realize this isn鈥檛 on your part, but figured for the instructions you might wanna add it to the original post so there won鈥檛 be lots of same questions here in the thread :slight_smile:

I backtracked now and added the link 71644 pull again.
I now pressed add integration and choose 鈥渃ustom overkiz PR#71644鈥. In the next step I can choose to add one of the discovered devices (for some reasons it shows up three times). If i choose 鈥淐onfigure one more instance鈥︹ instead of one of the discovered devices, nothing happens.

If I choose one of the discovered devices I get a new menu where it asks for my credentials. There is no choice of Hub (if I do the original Overkiz I get to choose Somfy Europe for example). When I today tried entering my credentials I get an unexpected error message. and the logs reads:

Logger: custom_components.overkiz
Source: custom_components/overkiz/config_flow.py:132
Integration: Custom Overkiz PR#71644
First occurred: 21:07:56 (2 occurrences)
Last logged: 21:08:10

local variable 'gateway' referenced before assignment
Traceback (most recent call last):
  File "/config/custom_components/overkiz/config_flow.py", line 178, in async_step_cloud
    await self.async_validate_input(user_input)
  File "/config/custom_components/overkiz/config_flow.py", line 132, in async_validate_input
    if re.match(r"\d{4}-\d{4}-\d{4}", gateway.id):
UnboundLocalError: local variable 'gateway' referenced before assignment
1 Like

That was indeed a small bug I made during development, but it is solved now. Apparently I did not push the latest version鈥

The discovery is not functional yet, but adding it through 鈥楢dd new integration鈥 should work. Just make sure you fully scroll down and select TaHoma Developer Mode.

Question: is is possible to have both integrations (the official cloud one and the developer local one) running at the same time? I know that would yield double devices, but I鈥檇 rather not uninstall the unoffical one until this works.

Where and when exactly is the choice for 鈥淭ahoma Developer Mode鈥 supposed to show up?

Because I never get any such options. Now i backtracked again so I got your newly push and the credentials work again. However when entering them there is no choice for developer mode. And once the credentials are entered, the devices are immediately discovered and I just get to choose which rooms each one is in and then finish.

I also tried adding the 鈥淪omfy鈥 integration instead of the Custom Overkiz PR#71644 one. If I press that one, I get a pop up asking if I am sure, 鈥渟upport for Somfy units is available via Custom Overkiz PR#71644. Do you want to continue?鈥 If I choose yes, the popup goes away but nothing more happens鈥

Note, when adding the Custom Overkiz one I get the same display as post #9 below does. I can鈥檛 add manual but am forced to pick one of the three discovered ones.

Using last version, I still can鈥檛 select the manual way :

What happens when you just click on Screen Shot 2022-11-06 at 21.49.44?

Not without modifying the code yourselves at the moment. This is such in an early stage that I would recommend to test this on a separate install.

1 Like

That鈥檚 why I鈥檝e done!!
Add 鈫 overkiz-> then the screen u see 鈫 configure a new instance 鈫 Nothing appears (it鈥檚 broken since 22.11 update!)

Can you please share your log? I am running 2022.11 as well and I don鈥檛 face any issues, the only change is that I don鈥檛 have any instances discovered.

If nothing happens when you click on an option in the Config Flow, there should be an exception in your log.

You wrote somewhere you do not own actual devices. Did you try adding RTS type devices to your Tahoma? These are RF operated devices that do not communicate back. So the Tahoma would not realise you do not have te actual device. The tahoma would just send out RF codes and be done with it.

I can have a look if I can do that, will have a look! Not sure if that will work with the TaHoma Switch as well.

Regarding the discovery, this is related to my development environment. I need to switch to a local installation in order to test this, since this is not supported in my devcontainer unfortunately.

The Tahoma Switch supports RTS. I just tried it on the Tahoma classic - if you say you operated the remote as they asked and that the device responded, it will add it without problems. Only downside is these are all stateless devices due to the lack of 2 way communication.

I have the exact same problem.

In this one I choose the top 鈥淐ustom Overkiz PR#71644鈥
I then get this pop-up:

If I press the 鈥渃onfigure one more instance of Custom Overkiz PR#71644鈥 nothing happens at all. There is no update in the log either. The pop-up still remains up. If I press configure on one of the discovered devices I get the following pop-up where there is no choice to make regarding Hub (so can鈥檛 choose Tahoma Developer Mode)

No log while clicking without response.
BTW, I added debug log to overkiz custom app :

2022-11-06 22:49:32.236 DEBUG (MainThread) [custom_components.overkiz] CONFIGURING LOCAL INTEGRATION
2022-11-06 22:49:32.236 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry for overkiz
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 365, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/overkiz/__init__.py", line 66, in async_setup_entry
    token = entry.data[CONF_TOKEN]
KeyError: 'token'

Contiuing my trouble seek.
I noticed that clicking configure on the different discovered devices gives different pop-ups:


If I use the first one (with the Host). I get a red integration and if I press control the logs, the following error is reported:

Logger: homeassistant.config_entries
Source: custom_components/overkiz/init.py:66
Integration: Overkiz
First occurred: 23:05:26 (1 occurrences)
Last logged: 23:05:26

Error setting up entry gateway-xxxxxxxxx.local:8443 for overkiz
Traceback (most recent call last):
File 鈥/usr/src/homeassistant/homeassistant/config_entries.py鈥, line 365, in async_setup
result = await component.async_setup_entry(hass, self)
File 鈥/config/custom_components/overkiz/init.py鈥, line 66, in async_setup_entry
token = entry.data[CONF_TOKEN]
KeyError: 鈥榯oken鈥

If I enter the credentials on the one without the 鈥渉ost鈥 it is successful in finding my devices, however they aren鈥檛 using the local api.

(not sure if I need to hide my box pin or not, but the excluded pin is correct and corresponds with the one listed on somfy account)

Sorry for the spam, but I think I got it to work through the help of rjlee on github (here)

Changing the config_flow.py line 47 and 75 to the following got it to work for me:

47 LOCAL = "somfy_europe"
75 if user_input[CONF_HUB] == "somfy_europe":

Note I still had to use the discovered device (the one where the host was needed in addition to somfy credentials) as adding new instance nothing happened still. But this time there was no token error, all devices are found. And they list the gateway/pin for the devices instead of Tahoma Switch so it seems to be running localy. Just comfirmed it runs localy, turned my WAN off but could still control my devices from hassio. Should mention also that I added the local IP and the gateway-xxxx-xxxx-xxxx.local to my etc/hosts file as well to make sure it got picked up, don鈥檛 know if that made any difference or not.

Hope this can help others.


I keep getting the following log error, usually with 2-5 minutes intervals.

Logger: custom_components.overkiz
Source: helpers/update_coordinator.py:151
Integration: Custom Overkiz PR#71644
First occurred: 01:18:52 (204 occurrences)
Last logged: 20:11:16

Error requesting device events data: Cannot connect to host gateway-xxxx-xxxx-xxxx.local:8443 ssl:default [Invalid argument]"

The devices become unavailable then they are back online a bit later again. Very frustrating behavior.