Somfy Tahoma Official API


#1

Somfy has release its official API to manipulate their device: https://developer.somfy.com/apis-docs

It would be great if HomeAssistant can use it instead of using the non supported mobile API.


#2

This API can also be used for the more affordable connexoon. It would be awesome if HA can use this API


Implementation of Somfy Connexoon IO
#3

This would allow me to finaly control my somfy sunscreens with the Connexxoon via Home assistant. Would love to see the API implemented!


#4

@nelbs @darkpainy don’t forget to vote :wink:


#5

What are our chances to introduce this API in HomeAssistant? :slight_smile:


#6

After some research, the Somfy API look like the Wink API. So inspired by the python-wink library, I’ve started to develop the Somfy one: https://github.com/tetienne/somfy-open-api/
I’ve 10 years of experience in Java, Python is kind of new for me. So I will use this project to learn the basics.


#7

I’ve updated my python library to request successfully the Somfy API. An example in the README describe how list for instance all the covers.

For the moment, Somfy does not return the light like Hue, or the sensors like the Solar sensor. I’ve been able to test only with the covers.


Controlling Somfy RTS motorised blinds
#8

I’ve finished to developed the client to manipulate the covers from the Somfy API. The documentation does not provide enough information to implement other devices. I need some volunteers to discover what Somfy exposes. The list of available devices are here: https://developer.somfy.com/products-services-informations.

On my repository, I explain how to help me to enhance the client: https://github.com/tetienne/somfy-open-api. It’s really easy.

Meanwhile, I’ve contacted Somfy Support to have more details. They are also working on a fix about the GET /device/<device_id> not returning the correct state. That’s a bug I found during my tests.

Once the client mature enough, I will start to integrate it in Home Assistant. I’ve read the documentation, it seems not so obvious but will be feasible.


#9

My somfy covers are categorized as interior_blind and support the following exec commans:

  • identify
  • open
  • close
  • stop

Created issue


#10

Thank you for your issue. It should be quick to add support for this device. Monday I will have a look.
I’m curious, you cannot control the position of your blinds?


#11

Well the blinds don’t support it. So that makes sense. However, the blinds do support a predefined position called the My Position. I raised the issue with somfy to support it in the API.


#12

Tahoma component works with connexoon too.


#13

@robertpe We never said the opposite. Currently the Tahoma component use the unofficial API, scraped from the Tahoma website.
Purpose here is to use the official API which has been created to be exposed to the world. Perhaps, the set of features is limited but it should evolve in the future if Somfy play well the game.


#14

@pbavinck Indeed that makes sense. You are right, for the covers, I haven’t too the My position command. I’ve solved your issue on the repository. There is one question waiting for you :wink:
By the way, if you can only open and close your blinds, what’s the purpose of the stop command?


#15

You can stop them mid-way. E.g.
Open: not covering the window
Closed: curtains/covers are all the way down
Stop: While the curtain/covers is going up or down, you can tell it to stop, only covering top part of the window.


#16

@pbavinck So that’s weird Somfy does not return the position command like the roller shutter. That’s make no sense. By the way, can you have look on your issue please?

I’ve uploaded my library to pypi. It means now an home assistant component can use it.


#17

@tetienne I do not seems to manage to install your pymfy module using PyPI…

I set up a python3 virtual environment using python3 -m venv . . Then I started python application with your example code. It gives me:

(test) Bert-MBP:test bertouttier$ python3 main.py
Traceback (most recent call last):
File "main.py", line 8, in &lt;module&gt;
from pymfy.api.somfy_api import SomfyApi
ModuleNotFoundError: No module named 'pymfy'

What am I doing wrong? Could you indicate how to install your module from source?


#18

Can you show me your main.py file please ? Maybe I’ve badly upload my package.


#19

it is just a copy/paste of your example code:

import json
import re

client_id = r'test'
redir_url = 'https://hassio.com'
secret = r'7test'

from pymfy.api.somfy_api import SomfyApi

api = SomfyApi(client_id, redir_url)
authorization_url, state = api.get_authorization_url()
print('Please go to {} and authorize access.'.format(authorization_url))
authorization_response = input('Enter the full callback URL')
api.request_token(authorization_response, secret)
api.automatic_refresh()

devices = api.get_devices()
# Remove personal information
dumps = json.dumps(devices, sort_keys=True, indent=4, separators=(',', ': '))
dumps = re.sub('".*id.*": ".*",\n', '', dumps)

print(dumps)

#20

When I try to install pymfy

[email protected]:~ $ pip install pymfy
Collecting pymfy
  Could not find a version that satisfies the requirement pymfy (from versions: )
No matching distribution found for pymfy