Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0 - Beta Testers Needed #476

Closed
4 tasks done
donavanbecker opened this issue Sep 19, 2022 · 47 comments
Closed
4 tasks done

v2.0.0 - Beta Testers Needed #476

donavanbecker opened this issue Sep 19, 2022 · 47 comments
Assignees
Labels
OpenAPI Issue dealing with OpenAPI (SwitchBotAPI)

Comments

@donavanbecker
Copy link
Collaborator

donavanbecker commented Sep 19, 2022

With the move from v1.0 to v1.1 SwitchBot API, there will be a lot of changes.

Please install the latest beta:

npm version

Click here to find out how to install Beta

Report Beta Issues here. I may request you to open separate issues if it is not related to something changed in the beta.

API Changes

  • Authentication with v1.1 of API
  • Device Refresh Status
  • Device Push Changes
  • Device IR Push Changes

Note

  • A new secret key config is required to be set.
  • openToken config has been changed to token a process is in place to move your openToken config to the new token config but requires you to restart homebridge/child bridge or you can just paste the your token into the new token config and an additional restart will not be required.
  • Added connectionType config, this replaces the BLE config.
    • You can now select Both Connections, Only OpenAPI, Only BLE, or Disable.
      • Both will use BLE as the default connection and will use OpenAPI as a backup connection.
      • OpenAPI will only allow connections through the OpenAPI.
      • BLE will only allow connections through Bluetooth (BLE), .
      • Disable will disable all connections. This will also allow you to disable commands and refreshes for a specific device but leave it in HomeKit.

Pull Request For Changes

#474

@donavanbecker donavanbecker added the bug Something isn't working label Sep 19, 2022
@donavanbecker donavanbecker changed the title Bug: v2.0.0 - Beta Testers Needed Sep 19, 2022
@OpenWonderLabs OpenWonderLabs locked as resolved and limited conversation to collaborators Sep 19, 2022
@OpenWonderLabs OpenWonderLabs unlocked this conversation Sep 19, 2022
@donavanbecker donavanbecker added OpenAPI Issue dealing with OpenAPI (SwitchBotAPI) and removed bug Something isn't working labels Sep 20, 2022
@donavanbecker
Copy link
Collaborator Author

Made progress on push changes. Should be able to get a good working beta out soon.

@chinedu40
Copy link

chinedu40 commented Sep 20, 2022

I'm having a problem with the switchbot lock. Error message below:

[9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen Set LockTargetState: 0
[9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen Sending request to SwitchBot API. command: unlock, parameter: default, commandType: command
[9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen sign: 0N95IZItNe5guBuxnVcAG/SqBMZn4rplPBix/3oPheI=
[9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen failed pushChanges
[9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen failed pushChanges, Error Message: "The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object"

In fact this happens with every accessory that i use with switchbot.

@martindinicolino
Copy link

martindinicolino commented Sep 20, 2022

I'm having a problem with the switchbot lock. Error message below:

[9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen Set LockTargetState: 0 [9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen Sending request to SwitchBot API. command: unlock, parameter: default, commandType: command [9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen sign: 0N95IZItNe5guBuxnVcAG/SqBMZn4rplPBix/3oPheI= [9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen failed pushChanges [9/20/2022, 11:16:32 AM] [SwitchBot] Lock: Kitchen failed pushChanges, Error Message: "The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object"

In fact this happens with every accessory that i use with switchbot.

I'm seeing the same error messages

additionally the lock's contact sensor always shows as being open (although the lock registers the change and shows its blue/green light every time the door is opened/closed)

@guptaramm
Copy link

Same here
using beta I am getting this error "Lock: Door lock failed pushChanges"

Lock: Door lock failed pushChanges, Error Message: "The first argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object"

@OpenWonderLabs OpenWonderLabs locked and limited conversation to collaborators Sep 20, 2022
@OpenWonderLabs OpenWonderLabs unlocked this conversation Sep 20, 2022
@donavanbecker
Copy link
Collaborator Author

donavanbecker commented Sep 20, 2022

Push Change support implemented for SwitchBot Devices, May still have issues with IR Devices. Please let me know.

@guptaramm @martindinicolino @chinedu40

@chinedu40
Copy link

Locking and unlock work well! - FYI There is a slight delay in updating the status of the lock in the home app when either action is completed, whereas the switchbot app picks it up much faster.

My curtains and lightstrip also work now.

Unfortunately i do not have an IR devices to test

@donavanbecker
Copy link
Collaborator Author

@chinedu40, the SwitchBot app is using BLE, where as this plugin is sending a command to the API (Cloud) to make the change.

I will add BLE support to the plugin, once node-switchbot supports it.

@oliveralonzo
Copy link

Thanks for all your work on this @donavanbecker! The beta is working for the most part for me, including the lock, which was really exciting after waiting since support for the lock was removed. I say for the most part because I got this error a few times "Lock: Front Door failed pushChanges," but it worked in between and after.

And just a piece of feedback, consider making those error messages a bit more descriptive if you'd like users to understand what they mean! I may have misinterpreted this, but I took the question of "did you even read the message?" to be a bit passive agressive in the API issue/thread, when I was just trying to help. But it was hard to conclude that pushing changes wasn't supported if the message simply said it failed (I remember it saying something about the OpenAPI, but that didn't suggest it wasn't implemented either). I'm happy to continue supporting the projects with my feedback, so I thought this would be helpful, too!

@donavanbecker
Copy link
Collaborator Author

Oops. I meant for the lock

Unfortunately that API isn't available yet. Once it is, I will implement.

@nyjklein
Copy link

@nyjklein can you create a separate issue and fill out all info so I have more info?

I noticed in the account config that the new "secret" was blank. Looks like it didn't get "translated" in my case. I used the SwitchBot app developer instructions and saw that it now generates the secret as well as the token. Pasted the secret into the Homebridge swicthbot account settings and I'm up and running!

Jeff

@donavanbecker
Copy link
Collaborator Author

Awesome!

Yes the openToken should have also been moved to the token parameter automatically for you also. I am guessing you saw a log that said restart homebridge/child bridge?

@nyjklein
Copy link

nyjklein commented Sep 23, 2022

Screenshot 2022-09-23 093755

Awesome!

Yes the openToken should have also been moved to the token parameter automatically for you also. I am guessing you saw a log that said restart homebridge/child bridge?

Yes. And I had read the notes above that said a second restart would "migrate" the secret key. Not sure why it didn't for me.

@donavanbecker
Copy link
Collaborator Author

Yes. And I had read the notes above that said a second restart would "migrate" the secret key. Not sure why it didn't for me.

where did you see that note?

@nyjklein
Copy link

Yes. And I had read the notes above that said a second restart would "migrate" the secret key. Not sure why it didn't for me.

where did you see that note?

Duh! Sorry. I misinterpreted the notes above thinking it would "migrate" the token to the secret.

@crouchingtiger
Copy link

Wow! 18 of them, glad that I can help. Looks like a pause command might have been added to the API, so might try to implement that.

I just switched over this morning from OpenAPI to BLE on my Pi, just to remove the latency and additional point of failure as I don't require any of the other Switchbot cloud services. Seems to run fairly smoothly, hard to tell but there's definitely a few ms of speed gained by interacting via the Pi rather than the Hub Mini.

Off-topic: Have you run any long-term battery tests of BLE from the Hub or the Homebridge device and noticed any performance differences? Is there an ideal scan duration or curtain update rate I could set that might extend the battery life?

@donavanbecker
Copy link
Collaborator Author

I have added an option to allow for making devices, external accessories. Please test this out.

You will see this option under device settings.
You will need to get the device id and set external accessory parameter to true.

@nyjklein
Copy link

nyjklein commented Oct 2, 2022

Could you clarify what making a device an "external accessory" means?

Jeff

@donavanbecker
Copy link
Collaborator Author

you have your own pairing code so won't automatically show up in the home app when its connected to homebridge/child bridge.

Like the TV does if you have an IR TV accessory.

@donavanbecker
Copy link
Collaborator Author

@martindinicolino @nyjklein, also if the single accessory is taking a long time to load it doesn't hold up the rest of the device on homebridge.

Only downfall is you loose cache which would only matter in the case of IR Devices.

@martindinicolino
Copy link

@martindinicolino @nyjklein, also if the single accessory is taking a long time to load it doesn't hold up the rest of the device on homebridge.

Only downfall is you loose cache which would only matter in the case of IR Devices.

thank you for the information

@Niklas31
Copy link

Niklas31 commented Oct 5, 2022

Hi! I opened the issue #490, but I believe now that it belong to this topic. Could you help me?

@donavanbecker
Copy link
Collaborator Author

@Niklas31, You need to add your secret in from the SwitchBot app. See the Notes section of this Issue.

@Niklas31
Copy link

Niklas31 commented Oct 5, 2022

Awesome! Worked like a charm. Now the only warning I have is WARNING Curtain: Curtain scanDuration is less then updateRate, overriding scanDuration with updateRate

I could not find scandurantion in settings to change it

@donavanbecker
Copy link
Collaborator Author

Screenshot 2022-10-05 at 10 55 07 AM

BLE Scan Duration

@Niklas31
Copy link

Niklas31 commented Oct 5, 2022

There is no Scan Duration on mine:
image

But I added it manually in.

Only one more question:

I have only two Switchbot accessories, but it is finding 2 more from CACHE. How can I clean my cache?
Here is my LOG:
BridgeSwitchBotTotal SwitchBot Devices Found: 4
Switchbot BridgeSwitchBotRestoring existing accessory from cache: Curtain DeviceID: C8F115DC060C
Switchbot BridgeSwitchBotRestoring existing accessory from cache: Fan DeviceID: CE5138BFD63E

@donavanbecker
Copy link
Collaborator Author

@Niklas31 you are using HOOBs right? Switch to homebridge.

This plugin isn't developed for HOOBs.

I would recommend moving to homebridge.

@Niklas31
Copy link

Niklas31 commented Oct 5, 2022

OK, I will check on that. Thanks for the support. Everything is working perfect now (it is not passing the 2 extra accessories to HomeKit).

@jonathan-catt
Copy link

Hey @donavanbecker I am testing out the beta but am having a hard time with setting up a new IR device. It looks like the plugin is recognizing an IR device in the logs, but it never prints the DeviceID such that it can be setup in the config.

Here is what my logs look like after a child bridge restart:
[10/8/2022, 7:58:14 PM] Registering platform '@switchbot/homebridge-switchbot.SwitchBot' [10/8/2022, 7:58:14 PM] [SwitchBot] Loaded @switchbot/homebridge-switchbot v2.0.0-beta.19 child bridge successfully [10/8/2022, 7:58:14 PM] Loaded 2 cached accessories from cachedAccessories.0E12876AA27E. [10/8/2022, 7:58:14 PM] [SwitchBot] The devices config section is missing the *Device ID* in the config. Please check your config. [10/8/2022, 7:58:14 PM] [SwitchBot] The devices config section is missing the *Device Type* in the config. Please check your config. [10/8/2022, 7:58:14 PM] Homebridge v1.5.0 (HAP v0.10.3) (SwitchBot) is running on port 58654. [10/8/2022, 7:58:14 PM] [SwitchBot] Total SwitchBot Devices Found: 4 [10/8/2022, 7:58:14 PM] [SwitchBot] Restoring existing accessory from cache: Front Door DeviceID: D3C08FFAD710 [10/8/2022, 7:58:14 PM] [SwitchBot] Restoring existing accessory from cache: Window Fan DeviceID: F01F5A5C3BD8 [10/8/2022, 7:58:14 PM] [SwitchBot] Device: Front Door Keypad with Device Type: Keypad Touch, is currently not supported. [10/8/2022, 7:58:14 PM] [SwitchBot] Submit Feature Requests Here: https://git.io/JL14Z [10/8/2022, 7:58:14 PM] [SwitchBot] Total IR Devices Found: 1 [10/8/2022, 7:58:14 PM] [SwitchBot] Cannot read properties of undefined (reading 'toUpperCase') [10/8/2022, 7:58:14 PM] [SwitchBot] Bot: Window Fan Config: {"mode":"switch","deviceType":"fan","allowPush":true,"doublePress":1,"openAPI":true} [10/8/2022, 7:58:14 PM] [SwitchBot] Bot: Window Fan Displaying as Fan

And relevant config section:
"options": { "devices": [ { "deviceId": "F01F5A5C3BD8", "configDeviceName": "Window Fan", "configDeviceType": "Bot", "openAPI": true, "bot": { "mode": "switch", "deviceType": "fan", "allowPush": true, "doublePress": 1 } } ], "irdevices": [ { "openAPI": true } ] },

@chinedu40
Copy link

Beta version 21 has removed all my switchbot and IR devices.

@donavanbecker
Copy link
Collaborator Author

@chinedu40, you need to set your connectionType. Also I will fix it so there is a default.

@chinedu40
Copy link

How do i set my connectionType?

@donavanbecker
Copy link
Collaborator Author

@chinedu40, set your device, in the device config with its device id, then assign connection type.

@donavanbecker
Copy link
Collaborator Author

Also beta.21 shouldn't have deleted the devices. Only beta.20 had that problem.

@donavanbecker donavanbecker pinned this issue Oct 12, 2022
@donavanbecker
Copy link
Collaborator Author

V2.0.0 has been released. If you have any issues please open a new issue with info needed to research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenAPI Issue dealing with OpenAPI (SwitchBotAPI)
Projects
None yet
Development

No branches or pull requests