Comments (25)
Awesome, welcome to the club! Fair warning, installations are SLOW on these little guys.
Also, FWIW, I'm using the official Homebridge Raspberry Pi image
https://github.com/homebridge/homebridge-raspbian-image#readme
from homebridge-switchbot-for-mac.
That is great to know. After finding out how cheap a Raspberry Pi can be, I may invest in one, and if I do, I'll definitely test this out and get back to you!
from homebridge-switchbot-for-mac.
Okay, so I got the Raspberry Pi, tested out the Switchbot Plugin, and it half works. I'm able to activate each switch once. But after that, each attempt fails. Not sure what that could indicate.
Edit: Apparently, the MAC address, is in some capacity, case-sensitive on the Homebridge Raspberry Pi image. I switched all of the letters to capital letters, and it's significantly more, if not 100% reliable now.
Edit 2: I jinxed it. Sometimes it works, sometimes it doesn't.
from homebridge-switchbot-for-mac.
It didn’t even work once this time. Weird.
[6/28/2020, 22:14:31] [Blinds] Error: Failed to discover services and characteristics: DISCONNECTED
at SwitchbotDeviceWoHand._ondisconnect_internal (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:154:16)
at Peripheral.<anonymous> (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:115:14)
at Object.onceWrapper (events.js:421:28)
at Peripheral.emit (events.js:315:20)
at Noble.onDisconnect (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:224:16)
at NobleBindings.emit (events.js:315:20)
at NobleBindings.onDisconnComplete (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:260:10)
at Hci.emit (events.js:315:20)
at Hci.onSocketData (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/hci.js:441:12)
at BluetoothHciSocket.emit (events.js:315:20)
from homebridge-switchbot-for-mac.
I do receive that log output, yes. I just tested it a few minutes ago, and I somehow managed to get three successful activations before I received this
[6/29/2020, 09:54:09] [Blinds] Error: No service was found.
at /usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:221:18
at Peripheral.<anonymous> (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/peripheral.js:81:7)
at Object.onceWrapper (events.js:422:26)
at Peripheral.emit (events.js:315:20)
at Noble.onServicesDiscover (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:309:16)
at NobleBindings.emit (events.js:315:20)
at NobleBindings.onServicesDiscovered (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:317:8)
at Gatt.emit (events.js:315:20)
at Object.callback (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:368:12)
at Gatt.onAclStreamData (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:133:26)
at AclStream.emit (events.js:327:22)
at AclStream.push (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/acl-stream.js:33:10)
at NobleBindings.onAclDataPkt (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:288:15)
at Hci.emit (events.js:315:20)
at Hci.onSocketData (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/hci.js:495:14)
at BluetoothHciSocket.emit (events.js:315:20)
from homebridge-switchbot-for-mac.
I'm using the official Homebridge Raspberry Pi image
https://github.com/homebridge/homebridge-raspbian-image#readme
Thanks for the information.
Easy to build Homebridge on Raspberry Pi Zero W according to the site above. It was done.
And I was also able to reproduce the error, so I'll investigate.
[6/28/2020, 22:14:31] [Blinds] Error: Failed to discover services and characteristics: DISCONNECTED
at SwitchbotDeviceWoHand._ondisconnect_internal (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:154:16)
at Peripheral. (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:115:14)
at Object.onceWrapper (events.js:421:28)
at Peripheral.emit (events.js:315:20)
at Noble.onDisconnect (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:224:16)
at NobleBindings.emit (events.js:315:20)
at NobleBindings.onDisconnComplete (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:260:10)
at Hci.emit (events.js:315:20)
at Hci.onSocketData (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/hci.js:441:12)
at BluetoothHciSocket.emit (events.js:315:20)
from homebridge-switchbot-for-mac.
I found the reason why it doesn't work on Raspberry Pi.
As soon as the pull requests to the library are merged, I'll release a version that works on Raspberry Pi as well.
OpenWonderLabs/node-switchbot#5
from homebridge-switchbot-for-mac.
[7/13/2020, 23:02:37] Loaded plugin: [email protected]
[7/13/2020, 23:02:37] Registering accessory 'homebridge-switchbot-for-mac.SwitchBot-For-Mac'
After a third restart, because I actually did restart it twice before, but now am confirming the plugin version from the startup log. Ran it a few times again and got this
[7/13/2020, 23:03:59] [Blinds Pi] WoHand (XX:XX:XX:XX:XX:XX) was failed turning off
[7/13/2020, 23:03:59] [Blinds Pi] Error: No service was found.
at /usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:228:18
at Peripheral.<anonymous> (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/peripheral.js:81:7)
at Object.onceWrapper (events.js:422:26)
at Peripheral.emit (events.js:315:20)
at Noble.onServicesDiscover (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:309:16)
at NobleBindings.emit (events.js:315:20)
at NobleBindings.onServicesDiscovered (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:317:8)
at Gatt.emit (events.js:315:20)
at Object.callback (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:368:12)
at Gatt.onAclStreamData (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:133:26)
at AclStream.emit (events.js:327:22)
at AclStream.push (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/acl-stream.js:33:10)
at NobleBindings.onAclDataPkt (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:288:15)
at Hci.emit (events.js:315:20)
at Hci.onSocketData (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/hci.js:495:14)
at BluetoothHciSocket.emit (events.js:315:20)
[7/13/2020, 23:04:11] [Blinds Pi] Turning off...
[7/13/2020, 23:04:11] [Blinds Pi] WoHand (XX:XX:XX:XX:XX:XX) was failed turning off
[7/13/2020, 23:04:11] [Blinds Pi] TypeError: Cannot read property 'write' of null
at /usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:409:40
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
And then it worked again. Strange
from homebridge-switchbot-for-mac.
The library used in this plugin supports Linux-based OSes, such as Raspbian, Ubuntu, and so on.
For this reason, I believe that this plugin is likely to work on Raspberry Pi as well .
However, I don't own a Raspberry Pi, so I can't test it out.
from homebridge-switchbot-for-mac.
Latest development. I tried reinstalling the Bluetooth drivers, and now I have this
(node:827) UnhandledPromiseRejectionWarning: Error: ENODEV, No such device
at Hci.init (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/hci.js:100:35)
at NobleBindings.init (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:78:13)
at Noble.get (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:72:26)
at /usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot.js:163:22
at new Promise (<anonymous>)
at Switchbot._init (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot.js:158:19)
at /usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot.js:105:12
at new Promise (<anonymous>)
at Switchbot.discover (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot.js:78:19)
at WoHand.discover (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/src/accessory.ts:67:21)
(node:827) 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:827) [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.
Tried uninstalling and reinstalling the plugin, but to no avail. Now it's just broken broken.
from homebridge-switchbot-for-mac.
I'm sorry to hear that it didn't work properly on the Raspberry Pi.
I will look into it based on the log you gave me.
However, I don't own a Raspberry Pi, so it may be difficult to solve the problem.
from homebridge-switchbot-for-mac.
I checked the description of node-switchbot.
On the Raspberry Pi, The node-switchbot needs to install the following libraries.
Can you install these and reinstall the plugin?
Before installing the @abandonware/noble, some linux libraries related Bluetooth as follows if the OS is Ubuntu/Debian/Raspbian.
$ sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
https://github.com/futomi/node-switchbot#installation
from homebridge-switchbot-for-mac.
Okay, so I ran that command before installing your plugin and its dependencies. The weird thing is that it detects the Switchbots no problem. I can activate it once. After that, communication seems to cease. Here's my log, if it might help at all
[6/28/2020, 13:32:14] [Blinds] WoHand (AA:BB:CC:DD:EE:FF) was discovered
[6/28/2020, 13:32:15] [Blinds] WoHand (11:22:33:44:55:66) was discovered
[6/28/2020, 13:32:18] [Blinds] Turning on...
[6/28/2020, 13:32:19] [Blinds] WoHand (11:22:33:44:55:66) was turned on
[6/28/2020, 13:32:29] [Blinds] Turning off...
[6/28/2020, 13:32:30] [Blinds] WoHand (AA:BB:CC:DD:EE:FF) was failed turning off
Edit: Worth noting, I don't get that above error anymore
from homebridge-switchbot-for-mac.
Edit: Worth noting, I don't get that above error anymore
Are you saying that you no longer get the following errors?
[6/28/2020, 13:32:30] [Blinds] WoHand (AA:BB:CC:DD:EE:FF) was failed turning off
from homebridge-switchbot-for-mac.
Oh no, sorry, that was terrible word placement. I don’t get the Unhandled Promise Rejection errors anymore. I still get the failed turning on/off errors
from homebridge-switchbot-for-mac.
I understand the current situation.
[6/28/2020, 13:32:14] [Blinds] WoHand (AA:BB:CC:DD:EE:FF) was discovered [6/28/2020, 13:32:15] [Blinds] WoHand (11:22:33:44:55:66) was discovered [6/28/2020, 13:32:18] [Blinds] Turning on... [6/28/2020, 13:32:19] [Blinds] WoHand (11:22:33:44:55:66) was turned on
From the log it looks like the first turn on was successful. Did it actually work correctly?
[6/28/2020, 13:32:29] [Blinds] Turning off... [6/28/2020, 13:32:30] [Blinds] WoHand (AA:BB:CC:DD:EE:FF) was failed turning off
Will the second and subsequent operations fail, whether it's turn off or turn on?
from homebridge-switchbot-for-mac.
I published 0.1.4-beta.0
. This will show a detailed log of failed operations.
Can you install it and provide a log of the some failures?
$npm install -g homebridge-switchbot-for-mac@beta
or
$sudo npm install -g homebridge-switchbot-for-mac@beta
from homebridge-switchbot-for-mac.
Did you see the following log output this time?
[6/28/2020, 13:32:14] [Blinds] WoHand (AA:BB:CC:DD:EE:FF) was discovered
[6/28/2020, 13:32:15] [Blinds] WoHand (11:22:33:44:55:66) was discovered
from homebridge-switchbot-for-mac.
Any potential progress being made here? Just curious, no rush. I'm sure you have more important things to work on
from homebridge-switchbot-for-mac.
Raspberry Pi ZERO W will arrives this week, so I will be investigating it over the weekend.
from homebridge-switchbot-for-mac.
Great, can't wait! That's great that it didn't take you long to find the issue
from homebridge-switchbot-for-mac.
I published 0.2.0-beta.0.
My Raspberry Pi Zero W has works fine with 0.2.0-beta.0.
Can you install it and confirm that it works?
$npm install -g homebridge-switchbot-for-mac@beta
or
$sudo npm install -g homebridge-switchbot-for-mac@beta
from homebridge-switchbot-for-mac.
So I did get this the first time:
[7/13/2020, 22:45:12] [Blinds Pi] Error: Now disconnecting. Wait for a few seconds then try again.
at /usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:108:16
at new Promise (<anonymous>)
at SwitchbotDeviceWoHand._connect (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:101:12)
at /usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:408:12
at new Promise (<anonymous>)
at SwitchbotDeviceWoHand._command (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device.js:400:12)
at /usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device-wohand.js:91:12
at new Promise (<anonymous>)
at SwitchbotDeviceWoHand._operateBot (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device-wohand.js:89:12)
at SwitchbotDeviceWoHand.turnOn (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot-device-wohand.js:40:17)
at WoHand.turn (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/src/accessory.ts:97:48)
at WoHand.turn (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/src/accessory.ts:107:9)
at WoHand.turn (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/src/accessory.ts:107:9)
at WoHand.turn (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/src/accessory.ts:107:9)
at SwitchBotAccessory.setOn (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/src/accessory.ts:205:7)
But maybe that's because the Bluetooth was still initializing?
After that, I did 4 on/off cycles with my two Switchbots, and didn't have an issue. So I'll add it to my morning/night scenes, and do a more standard test tomorrow where the toggles are hours apart, rather than seconds and update you if it's still cooperating or not! Sounds incredibly promising though
from homebridge-switchbot-for-mac.
I looked at the log and it looks like the plugin version is 0.1.4.
You need to restart homebridge after installing 0.2.0-beta.0.
Can you restart homebridge and try again?
from homebridge-switchbot-for-mac.
Sorry, I mistakenly thought it wouldn't work due to an error. I see that you get an error on the first operation and then it works.
In that case, it sounds like the Bluetooth initialization may be taking a long time.
Could you give it a while to see how it works?
from homebridge-switchbot-for-mac.
Related Issues (17)
- More of a Question HOT 1
- Feature Request: Single device on/off with timer HOT 15
- Failing to turn on HOT 22
- lock mode HOT 1
- Ping results in switch state stuck "on" HOT 3
- Ping IP HOT 4
- Configuration of more than 1 switch fails / on-off mode HOT 4
- Support for Switchbot Curtain HOT 1
- Can you do a windows OS support for this plugin ? HOT 1
- Not working when daemonized on macOS Big Sur HOT 4
- Support for Humidifier HOT 3
- Momentary on mode
- Has this been tested under Mojave? HOT 2
- Device not found HOT 1
- Plugin Does Not Work Following Reboot HOT 10
- Segmentation Fault: 11 HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-switchbot-for-mac.