openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.87k stars 3.58k forks source link

[freebox] authorization and token issue #4594

Closed aymeric106 closed 5 years ago

aymeric106 commented 5 years ago

Expected Behavior

Should connect and have Freebox thing online

Current Behavior

i use a freebox mini http://mafreebox.freebox.fr/api_version

box_model_name "Freebox Server Mini (r1)"
api_base_url "/api/"
https_port 8888
device_name "Freebox Server"
https_available true
box_model "fbxgw-r1/mini"
api_domain "p60sbrvxxx.fbxos.fr"
uid "df097f8ddfa308395fe4b2387**"
api_version "6.0"
device_type "FreeboxServer1,1"

Token have been authorized on the server In the freebox console, i see the app is authorized. I see also in the freebox console there are some sessions opened.

Anyway, can't get the thing to get online with https

'freebox:server:fb' changed from OFFLINE to OFFLINE (CONFIGURATION_ERROR): Check your app token in the thing configuration; opening session with p60sbrv1.fbxos.fr:8888 using HTTPS API version 6.0 failed

nor http (with http_only option)

'freebox:server:fb' changed from OFFLINE to OFFLINE (CONFIGURATION_ERROR): Check your app token in the thing configuration; opening session with 192.168.1.1:80 using HTTP API version 6.0 failed

Possible Solution

tried to add both freebox certificates to my openhabian system (sudo keytool -import -file /home/openhabian/freeboxRSA.crt -trustcacerts -alias Freebox4 -keystore /usr/lib/jvm/zulu-embedded-8-armhf/jre/lib/security/cacerts )

tried with 192.198..1.1 or mafreebox.freebox.fr

tried with http and https

Your Environment

freebox mini Openhabian on a raspberry pi Latest stable openHAB 2.4.0-1 (Release Build) binding-freebox - 2.4.0

Thank you I noticed the binding has been updated recently, don't know it's already in the stable build.

lolodomo commented 5 years ago

It is more than probable that the token in your thing configuration is simply wrong. This token is displayed in logs when first opening a session while the token in the thing is empty. You have to authorize the session on the freebix server and then the token is displayed in log. You just have to copy and paste it in your thing configuration.

So first remove your token and redo the authorization process.

You could have asked help on the forum rather than declaring an issue.

Note that the binding in 2.5 was refactored. The current version in 2.4 is not yet maintened.

aymeric106 commented 5 years ago

Hello, i tried many times, with Paper UI and .things file. I'm almost certain the token is not the problem, or if it is, there's another issue. As i mentioned, the binding is authorized and a session is up (see attached files).

I tried with a python script and it worked (with another token of course, and with HTTPS). I don't know if i can test my script with the same token ? The only issue I had with the script I made is that the freebox mini has no phone capability, and you get error if you try to fetch values concerning the phone.

I noticed it says API version 6.0. Strangely, the only doc concerning the API i found concern the 5.0 API.

I don't know if the HTTP (not HTTPS) is still working with this API 6.0. If not, maybe it's a certficate issue ? I'm not sure about the cert file path in Openhabian (/usr/lib/jvm/zulu-embedded-8-armhf/jre/lib/security/cacerts )

fb1

fb2

aymeric106 commented 5 years ago

I'll wait for the release of 2.5 and see if fixes the problem.

aymeric106 commented 5 years ago

Also maybe I should add that I was using the binding with a freebox revolution before and it was working. The freebox mini I use now, I just received it from FREE.

lolodomo commented 5 years ago

With the new version of the binding, (in 2.5 snapshots) you don't have to manage certificates anymore, the binding is doing that automatically for you.

Yes, the API is now in version 6.0 while Freebox stopped documenting after version 4.0 !!! This version 6.0 was introduced recently when Delta was announced. API 6.0 with 2.5 binding is working well with my Revolution.

I don't know what could be your problem, maybe something different with the Freebox Mini....

Note that your Freebox server has more probably IP 192.168.1.254 rather than 192.168.1.1.

aymeric106 commented 5 years ago

fyi https://dev.freebox.fr/bugs/task/22871

aymeric106 commented 5 years ago

Found something with debug log on

error while opening a session org.matmaul.freeboxos.FreeboxException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "password_set"

full log

2019-01-14 23:18:01.427 [DEBUG] [al.discovery.FreeboxDiscoveryService] - Freebox discovery - discoverPhone : true 2019-01-14 23:18:01.429 [DEBUG] [al.discovery.FreeboxDiscoveryService] - Freebox discovery - discoverNetDevice : true 2019-01-14 23:18:01.432 [DEBUG] [al.discovery.FreeboxDiscoveryService] - Freebox discovery - discoverNetInterface : true 2019-01-14 23:18:01.434 [DEBUG] [al.discovery.FreeboxDiscoveryService] - Freebox discovery - discoverAirPlayReceiver : true 2019-01-14 23:18:01.448 [DEBUG] [org.openhab.binding.freebox ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=411, service.bundleid=226, service.scope=singleton} - org.openhab.binding.freebox 2019-01-14 23:18:01.457 [DEBUG] [ebox.internal.handler.FreeboxHandler] - initializing Freebox Server handler for thing freebox:server:fb 2019-01-14 23:18:01.460 [DEBUG] [al.discovery.FreeboxDiscoveryService] - Freebox discovery - discoverPhone : false 2019-01-14 23:18:01.463 [DEBUG] [al.discovery.FreeboxDiscoveryService] - Freebox discovery - discoverNetDevice : true 2019-01-14 23:18:01.465 [DEBUG] [al.discovery.FreeboxDiscoveryService] - Freebox discovery - discoverNetInterface : true 2019-01-14 23:18:01.467 [DEBUG] [al.discovery.FreeboxDiscoveryService] - Freebox discovery - discoverAirPlayReceiver : true 2019-01-14 23:18:01.471 [DEBUG] [ebox.internal.handler.FreeboxHandler] - Binding will schedule a job to establish a connection... 2019-01-14 23:18:02.473 [DEBUG] [ebox.internal.handler.FreeboxHandler] - Authorize job... 2019-01-14 23:18:02.564 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'freebox.things' 2019-01-14 23:18:02.575 [DEBUG] [ebox.internal.handler.FreeboxHandler] - Apptoken valide : [x+iCSvT11bzbIDq8RyVLiEyiXaVgBRJ3CXzLx0cwfrfffU8lxwbcv40Js2iR0Rdq] 2019-01-14 23:18:02.774 [DEBUG] [ebox.internal.handler.FreeboxHandler] - Thing freebox:server:fb: error while opening a session org.matmaul.freeboxos.FreeboxException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "password_set" (Class org.matmaul.freeboxos.login.Session), not marked as ignorable at [Source: java.util.zip.GZIPInputStream@38ffde; line: 1, column: 391] (through reference chain: org.matmaul.freeboxos.login.SessionResponse["result"]->org.matmaul.freeboxos.login.Session["password_set"]) at org.matmaul.freeboxos.internal.RestManager.execute(RestManager.java:173) ~[?:?] at org.matmaul.freeboxos.internal.RestManager.post(RestManager.java:144) ~[?:?] at org.matmaul.freeboxos.login.LoginManager.openSession(LoginManager.java:102) ~[?:?] at org.openhab.binding.freebox.internal.handler.FreeboxHandler.authorize(FreeboxHandler.java:192) ~[?:?] at org.openhab.binding.freebox.internal.handler.FreeboxHandler.lambda$1(FreeboxHandler.java:340) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?] at java.lang.Thread.run(Thread.java:748) [?:?] Caused by: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "password_set" (Class org.matmaul.freeboxos.login.Session), not marked as ignorable at [Source: java.util.zip.GZIPInputStream@38ffde; line: 1, column: 391] (through reference chain: org.matmaul.freeboxos.login.SessionResponse["result"]->org.matmaul.freeboxos.login.Session["password_set"]) at org.codehaus.jackson.map.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:53) ~[?:?] at org.codehaus.jackson.map.deser.StdDeserializationContext.unknownFieldException(StdDeserializationContext.java:267) ~[?:?] at org.codehaus.jackson.map.deser.std.StdDeserializer.reportUnknownProperty(StdDeserializer.java:673) ~[?:?] at org.codehaus.jackson.map.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:659) ~[?:?] at org.codehaus.jackson.map.deser.BeanDeserializer.handleUnknownProperty(BeanDeserializer.java:1365) ~[?:?] at org.codehaus.jackson.map.deser.BeanDeserializer._handleUnknown(BeanDeserializer.java:725) ~[?:?] at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:703) ~[?:?] at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) ~[?:?] at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299) ~[?:?] at org.codehaus.jackson.map.deser.SettableBeanProperty$FieldProperty.deserializeAndSet(SettableBeanProperty.java:579) ~[?:?] at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697) ~[?:?] at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) ~[?:?] at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2732) ~[?:?] at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1909) ~[?:?] at org.matmaul.freeboxos.internal.RestManager.readValue(RestManager.java:122) ~[?:?] at org.matmaul.freeboxos.internal.RestManager.execute(RestManager.java:165) ~[?:?] ... 11 more 2019-01-14 23:18:02.844 [DEBUG] [ebox.internal.handler.FreeboxHandler] - Thing freebox:server:fb: Check your app token in the thing configuration; opening session with 192.168.1.1:80 using HTTP API version 6.0 failed

lolodomo commented 5 years ago

You should try the new 2.5 binding (even in 2.4 server). If problem confirmed in new version, I could investigate.

aymeric106 commented 5 years ago

Nice job ! 2.5 binding is working fine ! :-) Thanks

claude-boulard commented 5 years ago

Hi, I'm having an issue with this binding (or my freebox) : no app_token is displayed.

Newbie question : where should it be displayed ? in front logs (http://openhabianpi:9001/) ?

Here I see messages showing that the freebox is seen by the binding, but no app_token displayed. And no message on freebox LCD screen.

I had the same behaviour with the previous release of this binding (2.4).

Thanks for any help/suggestion.

poulpy92 commented 5 years ago

Helllo, I have the same issue than Aymeric106 but with FReebox Revolution then now with Delta. it was working well last year with old release I thinK . I would like to try "2.5 binding" as proposed but where can I find it for my synology installation ? Thanks

claude-boulard commented 5 years ago

Hello,

As far as I remember, the version 2.5 of Freebox binding, is part of OpenHAB snapshot 2.5.

Personnally I've installed this snapshot 2.5, and then tried the Freebox binding 2.5.

Hope this can help.

Claude

[image: 3dRudder Logo] https://3dRudder.com Claude Boulard | Embedded Software Engineer

Phone : +33 (0)972 629 869 - 3dRudder.com https://www.3drudder.com Europarc de Pichaury / Batiment B4 https://goo.gl/maps/oQjXieYLFcL2 Avenue JRGG de la Lauziere / 13856 Aix-en-Provence https://goo.gl/maps/oQjXieYLFcL2

[image: image]

Le ven. 8 févr. 2019 à 22:37, poulpy92 notifications@github.com a écrit :

Helllo, I have the same issue than Aymeric106 but with FReebox Revolution then now with Delta. it was working well last year with old release I thinK . I would like to try "2.5 binding" as proposed but where can I find it for my synology installation ? Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openhab/openhab2-addons/issues/4594#issuecomment-461955263, or mute the thread https://github.com/notifications/unsubscribe-auth/AIFeVNLGgjvx3MEQH8L-3Mp8EnBdrrDrks5vLe4NgaJpZM4Z99pH .