fjhorrillo / homebridge-airzone-cloud

Homebridge Airzone Cloud
Apache License 2.0
22 stars 4 forks source link

New version of airzone cloud breaks the plug-in #10

Closed jmartinezs77 closed 3 years ago

jmartinezs77 commented 3 years ago

Describe The Bug: airzone is not logging in correctly. A new version of the mobile app has been released and it seems the api has changed.

To Reproduce: Log in to the new app. Restart homebridge and the log in error appears in the log.

Expected behavior: A correct log in in airzone cloud

Logs:


[7/23/2021, 9:19:12 PM] [AirzoneCloud ] Unable to login to AirzoneCloud. Request: {"url":"https://www.airzonecloud.com/users/sign_in","method":"POST","mode":"cors","headers":{"Content-Type":"application/json;charset=utf-8","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15"},"body":"{\"email\":\"xxxxxxxxx@xxx.xxx\",\"password\":\"xxxxxxx\"}"} {"size":0,"timeout":0}
[7/23/2021, 9:19:12 PM] [AirzoneCloud] Unable to login to AirzoneCloud. Request: {"url":"https://www.airzonecloud.com/users/sign_in","method":"POST","mode":"cors","headers":{"Content-Type":"application/json;charset=utf-8","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15"},"body":"{\"email\":\"xxxxxxo@xxx.xx\",\"password\":\"xxxxxxx\"}"} {"size":0,"timeout":0}

Plugin Config:

Default config

Screenshots:

Environment:

fjhorrillo commented 3 years ago

Hello, I’m working on it, but they change the whole api 😓

jmartinezs77 commented 3 years ago

It is not going to be quick. Take it easy. The new url is m.airzonecloud.com, but as you say, api has changed. Changing the url in the settings of the plug-in is not enough.

fjhorrillo commented 3 years ago

Yes, now the authenticator is oauth2 and the rest of the api implement the standards and become a bit different

Pascal26120 commented 3 years ago

Hi I have the same issue.

matnoublanche commented 3 years ago

Hi there,

I don't know if that can help but do you know that you can access to the local API of the AirZone WebServer ?

Here is the doc : https://doc.airzone.es/producto/Gama_AZ6/Airzone/Comunes/Manuales/MI_AZ6_WSCLAPI_A4_FR.pdf

I think that il will be more efficient to directly talk with the local API.

Mathieu

fjhorrillo commented 3 years ago

Hi, local api is only available on wire webserver or new versions of wifi, and to have full compatibility is why I use cloud api

matnoublanche commented 3 years ago

Hi, local api is only available on wire webserver or new versions of wifi, and to have full compatibility is why I use cloud api

Understood. Will be very great that we can use local API as an option.

matnoublanche commented 3 years ago

Hi @fjhorrillo,

Do you need some help to implement new API ?

I can help if needed.

Mathieu

fjhorrillo commented 3 years ago

Hello @matnoublanche,

Base on the analysis on the new web I have gotten some information.

Login is with oauth but it is easy: POST https://m.airzonecloud.com/api/v1/auth/login { "email": "{{email}}", "password": "{{password}}" } From the response get token

Get Installations: GET https://m.airzonecloud.com/api/v1/installations HEADER authorization=Bearer {{token}} From the response get installations[0].installation_id (where 0 is the index of the installation you want, by default 0)

Get Installation detail: GET https://m.airzonecloud.com/api/v1/installations/{{installationId}} HEADER authorization=Bearer {{token}} From the response get the Device List

Turn On/Off: PATCH https://m.airzonecloud.com/api/v1/devices/{{deviceId}} HEADER authorization=Bearer {{token}} { "param": "power", "value": true, "installation_id": "{{installationId}}" }

Set temperture: PATCH https://m.airzonecloud.com/api/v1/devices/{{deviceId}} HEADER authorization=Bearer {{token}} { "param": "setpoint_air_cool", "value": {{temerture}}, "installation_id": "{{installationId}}", "opts": { "units": 0 } } Depend on the mode use: setpoint_air_cool, setpoint_air_heat, setpoint_air_vent or setpoint_air_dry

Set mode: PATCH https://m.airzonecloud.com/api/v1/devices/{{deviceId}} HEADER authorization=Bearer {{token}} { "param": "mode", "value": 0, "installation_id": "{{installationId}}" } Modes: 0 (Stop), 2 (Cool), 3 (Heat), 4 (Fan) or 5 (Dry)

Get device info (sync): GET https://{{base_url}}/api/v1/devices/{{deviceId}}/config?installation_id={{installationId}}&type=all HEADER authorization=Bearer {{token}}

Get device info (async): For this, it is necessary to use websocket wss://m.airzonecloud.com/api/v1/websockets/conn/?jwt={{token}}&EIO=4&transport=websocket After conect send the messages: 40 422["clear_listeners"] 421["listen_installation","{{installationId}}"] You will get the device status for all systems and zones

Now I'm working on adapting the plugin to implement it, but I need to understand the messages over websocket to keep it connected.

matnoublanche commented 3 years ago

Hi again,

I also follow another issue that you replied on

max13fr/AirzoneCloud#7

You find all this by reverse engineering or someone finally respond on the Airzone team ?

fjhorrillo commented 3 years ago

Hi, I’ve finally started using reverse engineering.

Pascal26120 commented 3 years ago

Same issue with new version 0.1.5

fjhorrillo commented 3 years ago

Yes, this update was only a bug fixing for users with old api, I’m working on 0.2.0 for new api.

jmellad commented 3 years ago

Same issue with new version 0.1.5 I hope you can correct it soon.

Thanks for the effort to update the plugin.

fxpa commented 3 years ago

Hello Any update on the issue ?

fjhorrillo commented 3 years ago

Hi! It’s on the oven!

fjhorrillo commented 3 years ago

Published v0.2.0

Albertopez commented 3 years ago

I'm testing the new version, but it's still unable to connect to the new API, any updates on this?

If you want I could help with the reverse engineering

fxpa commented 3 years ago

I'm testing the new version, but it's still unable to connect to the new API, any updates on this?

If you want I could help with the reverse engineering

I've reinstall and it works

Albertopez commented 3 years ago

I'm testing the new version, but it's still unable to connect to the new API, any updates on this? If you want I could help with the reverse engineering

I've reinstall and it works

that's the key. I was just upgrading to the new version, once you reinstall it, it lets you to set it to the new Airzone API.

Big thanks for the effort! 👏🏻

jmartinezs77 commented 3 years ago

It works!! Great job! it’s better to reinstall. You choose “new airzone cloud” on the plug in adjustments and goes straight forward.

just got an issue when I try to change a room’s temperature, so I will open a new issue, but it is great to have this plug in working again.