Git Product home page Git Product logo

Comments (13)

moritzmhmk avatar moritzmhmk commented on June 22, 2024 1

Now that I had a working solution at hand, I investigated why my fixing of the node-switchbot package failed.

I found that there were three different problems:

  • BLE support failed because the status in the init function of node-switchbot was not "poweredOn" and no waiting for stateChange was implemented
  • after the problem was fixed, the device still did not work because the identifier in iosensor.ts was wrong
  • with the correct identifier it still failed as node-switchbot does not support the sensor

I hope the related PRs are helpful to fix this issue.

from homebridge-switchbot.

donavanbecker avatar donavanbecker commented on June 22, 2024

Bluetooth issues have nothing to do with the plugin, checkout the Bluetooth Plugins Wiki.

from homebridge-switchbot.

teh-hippo avatar teh-hippo commented on June 22, 2024

Understood & respect that @donavanbecker.

Question though; this feels kind of dumb on my part, but I'd never actually checked whether the BLE worked. I assumed it didn't when I saw those errors.

I just tried, with the curtains switched to BLE only, and it does indeed work.

The thing to note here, is that when I then used 'BLE/OpenAPI', it says 'OpenAPI' will then be used.

Can you help point me in the right direction here? It sounds like this might be a Switchbot side thing, with when BLE is enabled, but it could be within the library and not properly indicating the BLE state back to Switchbot...

[8/29/2023, 1:50:22 PM] [SwitchBot] MeterPlus: Meter Plus failed BLERefreshStatus with BLE Connection, Error Message: "Adapter is not ready: unknown"
[8/29/2023, 1:50:22 PM] [SwitchBot] MeterPlus: Meter Plus wasn't able to establish BLE Connection, node-switchbot: [object Object]
[8/29/2023, 1:50:22 PM] [SwitchBot] Curtain: Verandah failed BLERefreshStatus with BLE/OpenAPI Connection, Error Message: "Adapter is not ready: unknown"
[8/29/2023, 1:50:22 PM] [SwitchBot] Curtain: Verandah wasn't able to establish BLE Connection, node-switchbot: [object Object]
[8/29/2023, 1:50:22 PM] [SwitchBot] Curtain: Verandah Using OpenAPI Connection to Refresh Status
[8/29/2023, 1:50:22 PM] [SwitchBot] Curtain: Backyard failed BLERefreshStatus with BLE Connection, Error Message: "Adapter is not ready: unknown"
[8/29/2023, 1:50:22 PM] [SwitchBot] Curtain: Backyard wasn't able to establish BLE Connection, node-switchbot: [object Object]

To clarify the above, I have 2 grouped curtains, Verandah & Backyard. I set Verandah to be BLE/OpenAPI, and Backyard to 'BLE'.

from homebridge-switchbot.

donavanbecker avatar donavanbecker commented on June 22, 2024

If set to BLE/OpenAPI, BLE will be tried first and if it doesn't work then it will use OpenAPI as a backup.
If set to BLE, then only BLE will be tried.

from homebridge-switchbot.

teh-hippo avatar teh-hippo commented on June 22, 2024

Understood - but in the above, BLE works for both. I am able to control the curtains via BLE if I set it to that. They both report errors, but both work.

If I change it to BLE/OpenAPI, I don't see indications that it changes back to BLE later - but I may be misreading the logs?

from homebridge-switchbot.

moritzmhmk avatar moritzmhmk commented on June 22, 2024

I found this issue when I searched for the Adapter is not ready: unknown error that I got trying to get the SwitchBot Indoor/Outdoor Thermo-Hygrometer to work. After some research I found the node-switchbot library to cause the error (even when using it in a test script independently of homebridge). I then created a small test script which did indeed work (in the same docker container). So the problem is not one of bluetooth setup but is indeed related to the node-switchbot package.

For anyone who tries to get aforementioned sensor to work might find my my plugin to be of use :)

from homebridge-switchbot.

donavanbecker avatar donavanbecker commented on June 22, 2024

@moritzmhmk Why not help update this plugin to not rely on node-SwitchBot?

from homebridge-switchbot.

moritzmhmk avatar moritzmhmk commented on June 22, 2024

Adding support for all the different SwitchBot devices with a new code base would require a lot of testing and I do only own the Indoor/Outdoor Thermo-/Hygrometer. I did try to fix node-switchbot for about 2 hours before I decided to write something from scratch - which did happen to be surprisingly simple - so simple indeed that I decided the effort of creating a new plugin was worth it ;)
In general I think that there is space for multiple different plugins. While this one is best suited for someone who operates multiple SwitchBot devices and also has a SwitchBot Hub, my plugin targets those users that just want to get a cheap (but good) BLE Hygrometer running.

from homebridge-switchbot.

donavanbecker avatar donavanbecker commented on June 22, 2024

but couldn't you just add that support directly into the the iosensor file in this plugin?

from homebridge-switchbot.

donavanbecker avatar donavanbecker commented on June 22, 2024

you don't have to change it on all of them....

from homebridge-switchbot.

moritzmhmk avatar moritzmhmk commented on June 22, 2024

Handling bluetooth differently for the different device types would be a rather unclean solution, since it would still cause the problems for anyone who wants to use a different device type. Imagine setting the plugin up and having all but the iosensor devices fail with the Adapter is not ready: unknown error.

from homebridge-switchbot.

moritzmhmk avatar moritzmhmk commented on June 22, 2024

is it really a good idea to mark my comments that hint to a solution as spam?

from homebridge-switchbot.

teh-hippo avatar teh-hippo commented on June 22, 2024

#814 appears to be the PR to help fix this. Thanks @moritzmhmk, I'm not experienced enough in Typescript to work out how to properly test it and didn't have the time. Appreciate the fix in both sides. It'll be good for my curtains :)

from homebridge-switchbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.