Home Assistant Community

Somfy Tahoma Official API

#126

Can that work with Connexoon ?

0 Likes

#127

Yes, it should work.

0 Likes

#128

@tetienne So i made a group on the remote including all covers then used that in HASS then it works fine and both up and down are available.

What about support for My ? I mean my position ? And also support for going up or down in steps as you can from the remote ?

0 Likes

#129

For the my position, if the API does not expose it, I cannot do anything. We have to prey Somfy to add it.

0 Likes

#130

Will this Tahoma official API replace Tahoma component ha in the future?

0 Likes

#131

If the official API can do all the work done by the unofficial one, I think we can say yes. But today, it’s still not the case. It will really depend on the Somfy motivation.

0 Likes

#132

I have totally rework the component to use the config entry. It means you will see it within the integration menu like for instance Hue or Chromecast. Code is now also asynchronous.

1 Like

#133

Hi All, so happy to find this being added to HA, my somfy is using myLink, will this also work the same way as what is described here? Also, I am a little confused on the install documentation, is there a step by step install somewhere? Thanks again for doing this!!

0 Likes

#134

Hi, this component is not yet official. So to use it you will have to create a custom component. In a previous post, I explain what to do. However, the component is not just 2 files now. You will have to copy this folder and this file.
Several guys here I’ve already tested it, it should work with your case too. Even if I’m pretty sure, the code is almost done, keep in mind is a beta version.

0 Likes

#135

Hi,

First of all let me thanks for the great work. This add-on is really good. I have just managed to attach it to my home assistant (0.86.4) that runs in a docker. Everything works as I expect only one question came into my mind.

I see several warnings in the logs that are related to somfy API. Is it normal? Does anybody see the same as well?

“Cannot update devices
Traceback (most recent call last):
File “/config/custom_components/somfy/init.py”, line 157, in update_all_devices
data[DEVICES] = data[API].get_devices()
File “/config/deps/lib/python3.6/site-packages/pymfy/api/somfy_api.py”, line 76, in get_devices
site_ids = [s.id for s in self.get_sites()] if site_id is None else [
File “/config/deps/lib/python3.6/site-packages/pymfy/api/somfy_api.py”, line 57, in get_sites
r.raise_for_status()
File “/usr/local/lib/python3.6/site-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.somfy.com/api/v1/site

"Log Details (WARNING)
Tue Feb 05 2019 20:39:59 GMT+0100 (Central European Standard Time)

Cannot update devices
Traceback (most recent call last):
File “/config/custom_components/somfy/init.py”, line 157, in update_all_devices
data[DEVICES] = data[API].get_devices()
File “/config/deps/lib/python3.6/site-packages/pymfy/api/somfy_api.py”, line 81, in get_devices
r.raise_for_status()
File “/usr/local/lib/python3.6/site-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.somfy.com/api/v1/site/[my_site_id]/device"

0 Likes

#136

Glad to see it works for you too. I’m curious, did you use the version of component where Somfy is available in the integration menu?

About your warning, you are not the only one to see this error. Can you see this warning every hour (=token expired) or it’s random (=Somfy server is crazy).

0 Likes

#137

Totally random :slight_smile: but then I guess it is up to Somfy to make more robustness. Do you know, do they aware of this non-deterministic behave?

Regarding the version I do not see it under the integration menu. I used your github repository (https://github.com/tetienne/home-assistant/tree/somfy-open-api) to get the latest and greatest version of somfy component.

0 Likes

#138

hi that don’t work for me :
INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
Failed config
General Errors:
- Component not found: somfy
Successful config (partial)

however when I test config that’s ok !?!
i’ve copied all the files!

thanks for your help

0 Likes

#139

Hi, can you please explain what you did exactly?

0 Likes

#140

Can anybody try to explain, in simple way, how to instal Somfy custom components, please?

0 Likes

#141

@tetienne, that is my question in fact… a simple way to install

0 Likes

#142

@robertpe and @5chacha5
first, you need to create an App and get credentials on the Somfy site
Get developer credentials

  • Vist https://developer.somfy.com
  • Create an account
  • Open the My Apps menu
  • Add a new App (for testing, redirect url should be your local subnet HA url like http://xxx.xxx.xxx.xxx:yyyy/auth/somfy/callback and don’t forget port number )
  • Keep info for next.

Then, you need to go to you HA “/config” directory and create a folder named “custom_components” and then a “somfy” subfolder.
You should now have “/config/custom_components/somfy”
In this path, download every file from https://github.com/tetienne/home-assistant/tree/somfy-open-api/homeassistant/components/somfy (verify that you download the “Raw” version of each files)
Now you need to edit 2 files :
in
__init__.py :
change
from homeassistant.components.somfy import config_flow
to
from custom_components.somfy import config_flow
and in
cover.py :
change
from homeassistant.components.somfy import DOMAIN, SomfyEntity, DEVICES, API
to
from custom_components.somfy import DOMAIN, SomfyEntity, DEVICES, API

Then, in your configuration.yaml you need to add

somfy:
client_id: your_somfy_Consumer_Key
client_secret: your_somfy_Consumer_Secret

Restart your HA

On the first start, you’ll have a “Somfy Card” with a “Link” where you’ll be redirected to somfy, to make the OAuth2 process (you’ll need to login to make the link approved from HA to Somfy API)

Now you should have every known components in your UI.

Hope that everything is understandable, and that will work for you.

Important notice, you need to have a recent HA, i’ve just tested this procedure on my fresh new 0.87.1

0 Likes

#143

Hi, Thanks very good instruction.
All is OK till the last auth when I receive:
{“error”:“redirect_uri_mismatch”,“error_description”:“The redirect URI provided does not match registered URI(s).”}

0 Likes

#144

Many thanks @koomik for this explanation. It’s almost perfect, except for the redirect part. I guess i’s why @robertpe got his error.

@robertpe, Somfy returns this message when the redirect uri you set does not match your home assistant uri. The redirect uri must be <your hass uri>/auth/somfy/callback.
Keep in mind this component is not yet perfect, I got several remarks on my pull request.

0 Likes

#145

But what <your hass url? - local? with http://xxx.xxx.xxx.xxx/auth/somfy/callback -?

0 Likes