GusMuche / homebridge-zipabox-platform

Homebridge plugin to Link HomeKit and the Zipabox through API request. Implementation in dynamic platform.
MIT License
5 stars 2 forks source link

V3 Compatibility #30

Closed GusMuche closed 3 years ago

GusMuche commented 4 years ago

I’ve received a request to have the plugin compatible with the V3 API of Zipato.

Today I don’t have the possibility to test it, cause my Zipabox is an old v1 and cannot be updated to v3 without a additional Zipatile or Zipabox v2.

I’ll have a look on a demo possibility of the API to check the code and maybe add the possibility to request on V3 API.

GusMuche commented 4 years ago

After some search :

To test it :

Conclusion :

Please feel free to react and give your impression

pointman87 commented 4 years ago

I will test your code if you want, I have a running homebridge docker and a working Zipato V3 environment with one zipatile as master and two zipabox 1 as slaves

GusMuche commented 4 years ago

I just publish a new version in dev with the address of v3 as connection.

To test this :

  1. delete the package homebridge-zipabox-platform from config (copy-save it for backup)
  2. delete it also in the plugin list
  3. install the package homebridge-zipabox-platform-dev (if you have the two homebridge will not know which to use)
  4. restart homebridge
  5. config a platform with only 1 accessory like a switch or light; use "remoteV3" as IP url
  6. config all in debug
  7. restart homebridge
  8. give me the result of the debug
pointman87 commented 4 years ago

Hi, the starting line: [7/5/2020, 11:07:27 AM] [ZipaboxPlatform] [BOXAPI] [initUser] URL pour init : https://my3.zipato.com:443/zipato-web/v2user/init

should be: https://my3.zipato.com:443/zipato-web/v2/user/init pay attention the the / between v2 and user.

i think that typo is the reason for this:

[BOXAPI] [initUser] Error occurred : FetchError: invalid json response body at https://my3.zipato.com/zipato-web/Index;jsessionid=4D236598B2A1546568D42106ECE10665 reason: Unexpected token < in JSON at position 121 at /homebridge/node_modules/homebridge-zipabox-platform-dev/node_modules/node-fetch/lib/index.js:272:32 at processTicksAndRejections (internal/process/task_queues.js:97:5) { type: 'invalid-json' } [7/5/2020, 11:07:28 AM] [ZipaboxPlatform] [PTFM] [connectTheBox] Unexpexted error before security : FetchError: invalid json response body at https://my3.zipato.com/zipato-web/Index;jsessionid=4D236598B2A1546568D42106ECE10665 reason: Unexpected token < in JSON at position 121 at /homebridge/node_modules/homebridge-zipabox-platform-dev/node_modules/node-fetch/lib/index.js:272:32 at processTicksAndRejections (internal/process/task_queues.js:97:5) { type: 'invalid-json' } [7/5/2020, 11:07:28 AM] [ZipaboxPlatform] [PTFM] [connectTheBox] Error on connectTheBox after security : Error: FetchError: invalid json response body at https://my3.zipato.com/zipato-web/Index;jsessionid=4D236598B2A1546568D42106ECE10665 reason: Unexpected token < in JSON at position 121 at ZipaPlatform.manageError (/homebridge/node_modules/homebridge-zipabox-platform-dev/lib/platform.js:118:13) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:786) UnhandledPromiseRejectionWarning: Error: Error: FetchError: invalid json response body at https://my3.zipato.com/zipato-web/Index;jsessionid=4D236598B2A1546568D42106ECE10665 reason: Unexpected token < in JSON at position 121 at ZipaPlatform.manageError (/homebridge/node_modules/homebridge-zipabox-platform-dev/lib/platform.js:143:13) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:786) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:786) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

GusMuche commented 4 years ago

Correct, stupid typo error. I've written the code too quick.

Just publish the 1.7.2 with correction of the typo

pointman87 commented 4 years ago

Now the login is successful, it throws this after successful login:

[7/5/2020, 11:26:45 AM] [ZipaboxPlatform] [BOXAPI] [fstatus] Error on fstatus. Bad Request [7/5/2020, 11:26:45 AM] [ZipaboxPlatform] [PTFM] [connectTheBox] Unexpexted error before security : Error: Bad Request at ZipaboxApi. (/homebridge/node_modules/homebridge-zipabox-platform-dev/lib/zipaboxApi.js:701:16) at new Promise () at ZipaboxApi.fstatus (/homebridge/node_modules/homebridge-zipabox-platform-dev/lib/zipaboxApi.js:695:12) at processTicksAndRejections (internal/process/task_queues.js:97:5) [7/5/2020, 11:26:45 AM] [ZipaboxPlatform] [PTFM] [connectTheBox] Error on connectTheBox after security : Error: Error: Bad Request at ZipaPlatform.manageError (/homebridge/node_modules/homebridge-zipabox-platform-dev/lib/platform.js:118:13) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:1974) UnhandledPromiseRejectionWarning: Error: Error: Error: Bad Request at ZipaPlatform.manageError (/homebridge/node_modules/homebridge-zipabox-platform-dev/lib/platform.js:143:13) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:1974) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:1974) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. [7/5/2020, 11:26:46 AM] [ZipaboxPlatform] [BOXAPI] > Method getDeviceUUID() [7/5/2020, 11:26:47 AM] [ZipaboxPlatform] [BOXAPI] [fstatus] Error on fstatus. Internal Server Error (node:1974) UnhandledPromiseRejectionWarning: Error: Internal Server Error at ZipaboxApi. (/homebridge/node_modules/homebridge-zipabox-platform-dev/lib/zipaboxApi.js:701:16) at new Promise () at ZipaboxApi.fstatus (/homebridge/node_modules/homebridge-zipabox-platform-dev/lib/zipaboxApi.js:695:12) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:1974) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

GusMuche commented 4 years ago

Can you please make a new test with an additional parameter to the platform level ?

debugApi = “FULL”,

So the boxAPI will give more debug information. I just see here a bad request but not all the line.

Maybe can you also give me the result of the same test with the parameter “noStatus = true” in the config ? It’ll be a better starting point.

pointman87 commented 4 years ago

If you want I can make a user account for you on my system :-) PM me with desired username and password.

Med vänlig hälsning, Daniel Wennström Skickat från min iPhone

6 juli 2020 kl. 14:42 skrev Gus Muche notifications@github.com:

 Can you please make a new test with an additional parameter to the platform level ?

debugApi = “FULL”,

So the boxAPI will give more debug information. I just see here a bad request but not all the line.

Maybe can you also give me the result of the same test with the parameter “noStatus = true” in the config ? It’ll be a better starting point.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

GusMuche commented 4 years ago

Didn’t find how to contact you private. Can you please send me your mail at GusMuche@gmail ?

You can also fix directly a password for me with this email address.

GusMuche commented 3 years ago

Some news about the V3 API :

Thanks to a V3 user, I was able to test the new API of Zipato. There's some difference between the V2 and V3, but I success after some weeks to successfully connect to the controller.

For example, the new API need to select the controller that you want to discuss with.

Also the API didn't return any result for devices status if the attributes is on virtual... but it's ok, the plugin manage this.

At now you can test the test version of the plugin. It work for switches only.

Next step is to validate all sensors and the security partition (alarm).

GusMuche commented 3 years ago

I received my Zipabox 2 some weeks ago.

I spend time to transfer all the rules and accessories to it.

And now I'm testing the dev version of the plugin with my full installation.

Do not hesitate to test it also. Just choose the dev plugin version.

GusMuche commented 3 years ago

All going good since few days...

I will update the base version next weeks if all keep good.

GusMuche commented 3 years ago

Publish V3 compatibility in v1.8.0