bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 198 forks source link

SOMFY access to scene #1078

Closed jluc2808 closed 5 years ago

jluc2808 commented 5 years ago

hello, now we could only access single devices with SOMFY-TAHOMA connector, could you add (as with harmony activities)) a connector to access SOMFY-TAHOMA scene

bwssytems commented 5 years ago

I'll need some help on the API to call the scene.

jluc2808 commented 5 years ago

What would you like I could do to help?

bwssytems commented 5 years ago

what does the http call look like to trigger the scene and how do you get a list of all scenes?

NovaGL commented 5 years ago

Are you able to support connexoon (for APAC) also. I can give you the URL to use.

bwssytems commented 5 years ago

@NovaGL IS that a Somfy API?

NovaGL commented 5 years ago

I couldn't get the offical Somfy API to work. So I am just doing HTTP Post commands. How are you doing it?

bwssytems commented 5 years ago

They are just the http commands. Also, I did not write this plugin, so the api may have changed over time as well.

jluc2808 commented 5 years ago

i have asked somfy for the api documentation and especially the scene list and scene start/stop command

otherwise i did connected to somfy api/doc which provide some exemple of request / auth for devices https://developer.somfy.com/somfy-open-api/apis this work well and is already implemented in HA bridge but i don't find the same for scene ==> my demand to somfy contact

as soon as i get a response i will post

jluc2808 commented 5 years ago

I couldn't get the offical Somfy API to work. So I am just doing HTTP Post commands. How are you doing it?

you have to go to https://developer.somfy.com/somfy-open-api/apis then open one of the get API and open the OAurh2.0 connect to your somfy account (the one with connexoon or tahoma) and accept to establish the authentication to your account this will establish the auth2.0 passcode (which is needed to run any somfy API) to test then API i'm using RestClient and i use the header authentication which is return by the Auth2.0 popup

NovaGL commented 5 years ago

I did that but it doesn't show any devices.

jluc2808 commented 5 years ago

what is contents of the response ? and did you got any response from the connection popup to somfy ?

NovaGL commented 5 years ago

It logs me in but the response is []

jluc2808 commented 5 years ago

when you receive the login response did you got an Auth2.0 passcode ?

NovaGL commented 5 years ago

Yes. But just doing it all from the somfy site.

jluc2808 commented 5 years ago

ok get back to the beginning when you are one https://developer.somfy.com/somfy-open-api/apis/get/site-0 you hit the OAuth2.0 set ==> you receive a popup REQUEST SOMFY-OPEN-API PERMISSIONS with remember for 30 days checked, then when you say OK you have to login to your somfy account this take a while and you will receive a response with the WWW-Authenticate setted and the site number

then you use https://developer.somfy.com/somfy-open-api/apis/get/site/%7BsiteId%7D/device you need to add your siteNb in the request https://api.somfy.com/api/v1/site/{b663b017-812fccd0-07019107-xxxxxxxx}/device and you need to have the Oauth2.0 setted as authenticated

NovaGL commented 5 years ago

I did look up sites and came up with nothing. I didn't realise the site id was in the response of the first message.

I guess what I want to know is how could we intergrate this into HA-Bridge?

jluc2808 commented 5 years ago

i thought the mecanism to somfy devices (tag) is already implemented in Ha-bridge (auth, get siteId, get list of deviceId) to get the auth2.0 it's described in https://developer.somfy.com/apis-docs with the WWW-Authenticate setted in http request header, you will get the siteId, then list of deviceId

NovaGL commented 5 years ago

Ha bridge goes to the tahoma link site. I'll get the latest version from this repo to confirm

jluc2808 commented 5 years ago

warning, i don't now why, but the last update of somfy need to clear all cache, data and navigation (cookies, data, image, files, ....) the bug is : when you want to connect to somfy account nothing append and you can't login

jluc2808 commented 5 years ago

i have asked the question of the support for scenario with the API directly to somfy : the answer is "L’API ne supporte pas encore les scénarios. Notre newsletter vous notifiera le jour où nous ajoutons cette fonction." The API doesn't support yet scenario. Our Newsletter will notice you when this functionnality will be added.

bwssytems commented 5 years ago

So scenes are not yest supported by the api as I understand in your post. Also, Should the api site now be somfy.com instead of tahoma.com?

jluc2808 commented 5 years ago

yes the api is https://api.somfy.com/api/v1/site and yes scenes are not yet supported by the api

bwssytems commented 5 years ago

So, should we switch to the somfy api site or keep it with tahomalink?

jluc2808 commented 5 years ago

i will ask somfy support

jluc2808 commented 5 years ago

ok i got an answser from somfy support: Q: "Moreover, we have a development that uses so far tahomalink, should we switch to somfy API or can we stay (durability?) on tahomalink?"

R: "The terms of use of the tahomalink API will evolve before the end of the year. We will try to notify all customers of this API but because they are not currently declared, you may be aware of service interruptions. If this is the case, contact me. So I advise you to keep your development with this API in a drawer and stay ready to bring it out in a while, at the Delta of some changes."

bwssytems commented 5 years ago

So, as I read that, we should stay with tahomalink as the newer somfy API is going through development.

bwssytems commented 5 years ago

I have not seen any updates on the new Somfy API and the last ones are dated May 2018. It's been a year, I assume this is dead.