Code Monkey home page Code Monkey logo

homebridge-switchbot-for-mac's Introduction

homebridge-switchbot-for-mac's People

Contributors

dependabot[bot] avatar dylanvee avatar zizi4n5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

homebridge-switchbot-for-mac's Issues

Support for Switchbot Curtain

Hey!

Switchbot have just updated their plugin to support the curtain but to be honest this plugin is more useful because of the IP address feature. Similarly their plugin doesn't seem to work on Macs?

I just wondered if there are any plans to support their curtain in the future or whether it would be hard to implement.

homebridge-switchbot-ble

Thanks,

Sam

Ping results in switch state stuck "on"

The ping method updates the internal state to !error each time the device pings, resulting in the state being constantly set to "on". Thus, when HomeKit gets the device state, it always sees "on", even if the device is switched off. Due to internal checks on only setting device state if the new state is different, only attempting to turn off the device will work at that point, even if the device is already off.

this.updateState(!error);

Configuration of more than 1 switch fails / on-off mode

Hello.

I configured two switchbots by defining two accessories in config file having different names. Both accessories appear as switches in Homekit. But in Homekit the second one shows randomly on and off without any reason. When I configure only 1 switch it shows constantly on. What makes the switch showing on/off?

Further I don't understand why the switch needs to be on if it should be a stateless button. I would expect the opposite.

Regards
padman

Ping IP

Hey! This is more of a feature request.

Is it possible to build in a power status based on pinging IP? Some of the Television plugins have them in case someone powers on/off manually.

The use case I was thinking of was a wireless printer. When powered off wouldn't be pingable therefore should display as off and vice versa.

Failing to turn on

After about two days of HomeBridge running, the plugin fails to turn on any of my SwitchBot’s. The official app is able to turn them on.

Does the plugin only ‘discover’ devices at startup, or does it do it periodically to check that they are still available while running?

Feature Request: Single device on/off with timer

Thanks for your work on this project so far! All the others I have come across use gatttool, so are Linux only.

Would it be possible to have single device on and off as shown in the screenshot, with a normal mode, and an add on mode. This would be useful for light switches.

A timer for how long it should stay on for would also be useful, a 'press' mode. I am seeing a use case for an intercom that opens a door, similar to this using the Lock accessory type: https://github.com/github9984/homebridge-switchbot-lock.
Thank you in advance if you find this worthy of your time.

Screenshot 2020-06-27 at 01 47 21

lock mode

Thank you for the plug-in that makes my switchbot work well.

Can you support the lock mode in homkit?

Thanks again

Plugin Does Not Work Following Reboot

I have my Mac reboot automatically every night. However, it seems that this plugin breaks when my Mac powers on until I restart Homebridge again after. This is the excerpt from the log. Hope someone can help with this!
�[37m[5/31/2020, 6:10:49 AM] �[39mHomebridge is running on port 51745. (node:467) UnhandledPromiseRejectionWarning: Error: send ENETUNREACH 255.255.255.255:987 at doSend (dgram.js:697:16) at defaultTriggerAsyncIdScope (internal/async_hooks.js:296:12) at afterDns (dgram.js:643:5) at processTicksAndRejections (internal/process/task_queues.js:85:21) (node:467) 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: 1) (node:467) [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. (node:467) UnhandledPromiseRejectionWarning: Error: Failed to initialize the Noble object: unknown at Noble.<anonymous> (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot.js:172:23) at Object.onceWrapper (events.js:417:26) at Noble.emit (events.js:322:22) at Noble.onStateChange (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:87:8) at NobleMac.emit (events.js:310:20) (node:467) 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:467) UnhandledPromiseRejectionWarning: Error: Failed to initialize the Noble object: unknown at Noble.<anonymous> (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot.js:172:23) at Object.onceWrapper (events.js:417:26) at Noble.emit (events.js:322:22) at Noble.onStateChange (/usr/local/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:87:8) at NobleMac.emit (events.js:310:20) (node:467) 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: 3) �[0;37m[5/31/2020, 6:10:49 AM] �[0m�[0;36m[Config]�[0m �[0;33mHomebridge Config UI X v4.21.0 is listening on :: port 8581�[0m (node:467) UnhandledPromiseRejectionWarning: Error: send ENETUNREACH 255.255.255.255:987 at doSend (dgram.js:697:16) at defaultTriggerAsyncIdScope (internal/async_hooks.js:296:12) at afterDns (dgram.js:643:5) at processTicksAndRejections (internal/process/task_queues.js:85:21) (node:467) 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) �[37m[5/31/2020, 6:10:51 AM] �[39m�[36m[Spidey PS4] �[39mFound device [Spidey PS4] �[37m[5/31/2020, 6:10:51 AM] �[39m�[36m[Spidey PS4] �[39mFinish searching accessories �[37m[5/31/2020, 7:56:07 PM] �[39m�[36m[Blinds] �[39mTurning on... �[37m[5/31/2020, 7:56:07 PM] �[39m�[36m[Blinds] �[39mWoHand (cf:a4:99:de:b5:88) was failed turning on

More of a Question

I see in the ReadMe, that only Switchbot woHand devices are supported. I'm pretty new to this, so what exactly does woHand mean? I want to make sure this is actually going to work before I go and buy a Switchbot. Thanks in advance!

Segmentation Fault: 11

Hi,

Since installing the latest updateI'm now getting 'Segmentation Fault: 11'. Homebridge stops after a couple hours and I have to re-run it start.

I uninstalled the SwitchBot plugin and haven’t the issue since. Here is my config, and I attached the output of running in Debug Mode.

Versions:
Church-Server:~ churchserver$ node -v
v14.3.0
Church-Server:~ churchserver$ npm -v
6.14.5
Church-Server:~ churchserver$ homebridge -V
0.4.53

Mac OS 10.4

sudo homebridge -I -D.txt

{
    "bridge": {
        "name": "Homebridge Mac",
        "username": "CC:22:3D:E3:CE:38",
        "port": 51827,
        "pin": "031-45-150"
    },
    "description": "Homebridge Mac",
    "accessories": [
      {
        "accessory": "ApplescriptFile",
        "name": "Wireless Record Player",
        "on": "/Users/churchserver/Documents/Airfoil/AirFoilRecord.scpt",
        "off": "/Users/churchserver/Documents/Airfoil/DisconnectAirfoil.scpt"
    },
    {
      "accessory": "ApplescriptFile",
      "name": "All Speakers",
      "on": "/Users/churchserver/Documents/Airfoil/AllSpeakers.scpt",
      "off": "/Users/churchserver/Documents/Airfoil/AllSpeakersOff.scpt"
  },
    {
      "accessory": "ApplescriptFile",
      "name": "Wireless CD Player",
      "on": "/Users/churchserver/Documents/Airfoil/AirFoilCD.scpt",
      "off": "/Users/churchserver/Documents/Airfoil/DisconnectAirfoil.scpt"
  },
  {
            "accessory": "SwitchBot-For-Mac",
            "name": "Printer",
            "delay": 5000,
            "macAddress": "CC:70:9C:72:9C:D8",
            "ping": {
                "ipAddress": "192.168.1.78",
                "interval": 2000
            }
          }
],
    "platforms": [
      {
      "platform": "SamsungTizen",
      "devices": [
          {
              "name": "TV",
              "ip": "192.168.1.130",
              "mac": "8C:79:F5:E4:7B:DA"
          }
      ]
  },
      {
           "platform": "BelkinWeMo",
           "name": "WeMo Platform"
       },
      {
            "platform": "MiLight",
            "bridges": [
                {
                    "ip_address": "192.168.1.75",
                    "version": "v6",
                    "lights": {
                        "bridge": [
                            "iMac"
                        ],
                        "rgbw": [
                            null,
                            "Green Chair",
                            "Piano"
                        ],
                        "fullColor": [
                            "Myer"
                        ]
                    },
                    "repeat": 3,
                    "delay": 5
                }
            ],
            "name": "MiLight"
        },
  {
       "platform":"People",
       "threshold":15,
       "anyoneSensor":true,
       "nooneSensor":true,
       "webhookPort":51828,
       "cacheDirectory":"./.node-persist/storage",
       "pingInterval":10000,
       "ignoreReEnterExitSeconds":0,
       "people":[
          {
             "name":"person1",
             "target":"192.168.1.107",
             "threshold":15,
             "pingInterval":10000,
             "ignoreReEnterExitSeconds":0
          },
          {
             "name":"person2",
             "target":"192.168.1.129",
             "threshold":15,
             "pingInterval":10000,
             "ignoreReEnterExitSeconds":0
          }
       ]
    },
        {
            "platform": "cmdSwitch2",
            "switches": [
                {
                    "name": "Smarter Kettle",
                    "on_cmd": "/Users/churchserver/iBrew/ibrewlegacy heat 192.168.1.217",
                    "off_cmd": "/Users/churchserver/iBrew/ibrewlegacy stop 192.168.1.217",
                    "state_cmd": "/Users/churchserver/iBrew/ibrewlegacy status 192.168.1.217 | grep 'Heating water 100ºC selected'",
                    "polling": true,
                    "interval": 50
                },
                {
                    "name": "Singer",
                    "on_cmd": "blinkstick white",
                    "off_cmd": "blinkstick off",
                    "polling": true,
                    "interval": 50
                }
            ]
        },
        {
      "platform":"BroadlinkRM",
      "name":"Broadlink RM",
      "hideScanFrequencyButton": true,
      "hideLearnButton": false,
      "hideWelcomeMessage": true,
      "accessories":[
        {
        "name": "CD Player",
        "type": "switch",
        "data": {
        "off": "2600500000012a94121412121313111411141213121312131337123812381337121313381138123813121214133711381338111313131114123812381213121311141338113812381300054200012a4b12000d050000000000000000",
        "on": "2600500000012a94121412121313111411141213121312131337123812381337121313381138123813121214133711381338111313131114123812381213121311141338113812381300054200012a4b12000d050000000000000000"
        }
        },
    {
      "name":"Oscillation",
      "type":"switch",
      "enableAutoOff": true,
      "onDuration": 5,
      "data":{
        "on":"26004800451f1538151f151f1637161d161c161d1639161d1439161e1636171c1736161d16000cc6471e1637161e151e1836151d161e161d1538161e1935161d1637151d1637161d15000d05"
      }
    },
        {
          "name":"Dyson",
          "type":"fan",
          "hideRotationDirection": true,
          "persistState": false,
          "hideSwingMode": true,
          "data":{
            "on": "0000 006d 0022 0000 0054 001f 001c 003c 001c 001f 001c 003c 001c 001f 001c 001f 001c 001f 001c 001f 001c 0021 001c 0020 001c 0020 001c 0020 001c 0020 001c 0020 001c 003d 001c 003d 001c 0f7f 0054 001f 001c 003c 001c 001f 001c 003c 001c 001f 001c 001f 001c 001f 001c 001f 001c 0021 001c 0020 001c 0020 001c 0020 001c 0020 001c 0020 001c 003d 001c 003d 001c 001f",
            "off":"0000 006d 0022 0000 0054 001f 001c 003c 001c 001f 001c 003c 001c 001f 001c 001f 001c 001f 001c 001f 001c 0021 001c 0020 001c 0020 001c 0020 001c 0020 001c 0020 001c 001f 001c 001f 001c 0f80 0054 001f 001c 003c 001c 001f 001c 003c 001c 001f 001c 001f 001c 001f 001c 001f 001c 0021 001c 0020 001c 0020 001c 0020 001c 0020 001c 0020 001c 001f 001c 001f 001c 001f",
            "fanSpeed10": [
              {
                "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
                "sendCount": 9,
                "interval": 0.3
              }
    ],
    "fanSpeed20": [
      {
        "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
        "sendCount": 9,
        "interval": 0.3,
        "pause": 0.2
      },
      {
        "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
        "sendCount": 1
      }
],
"fanSpeed30": [
  {
    "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
    "sendCount": 9,
    "interval": 0.3,
    "pause": 0.2
  },
  {
    "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
    "sendCount": 2
  }
],
"fanSpeed40": [
  {
    "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
    "sendCount": 9,
    "interval": 0.3,
    "pause": 0.2
  },
  {
    "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
    "sendCount": 3
  }
],
"fanSpeed50": [
  {
    "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
    "sendCount": 9,
    "interval": 0.3,
    "pause": 0.2
  },
  {
    "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
    "sendCount": 4
  }
],
"fanSpeed60": [
  {
    "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
    "sendCount": 9,
    "interval": 0.3,
    "pause": 0.2
  },
  {
    "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
    "sendCount": 5
  }
],
"fanSpeed70": [
  {
    "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
    "sendCount": 9,
    "interval": 0.3,
    "pause": 0.2
  },
  {
    "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
    "sendCount": 6
  }
],
"fanSpeed80": [
  {
    "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
    "sendCount": 9,
    "interval": 0.3,
    "pause": 0.2
  },
  {
    "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
    "sendCount": 7
  }
],
"fanSpeed90": [
  {
    "data": "26004800471d1736171d171d1636171d161d161d163816371637173616361736161d163616000d01461e1637171d161e1636171c171d161d163816371637173517361636171c173616000d05",
    "sendCount": 9,
    "interval": 0.3,
    "pause": 0.2
  },
  {
    "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
    "sendCount": 8
  }
],
    "fanSpeed100": [
      {
        "data": "26004800491b1835191b181c1933191b181b181b191b1a34191a1a33191b1834171c191a19000cd7491b1a33171d171d1934191a191a171c171e1934191b19331a1a17351a19171c19000d05",
        "sendCount": 9,
        "interval": 0.3
      }
]
          }
        }
      ]
    }
]
}

Support Outside of macOS

Do you have any plans to bring support for this extension to other devices that support BLE, such as Raspberry Pi perhaps? Or is there a remote possibility that it might just work on it? Debating moving my Homebridge setup to a Raspberry Pi Zero W, but only if I can port the whole thing over.

Device not found

When I try to press the button, my log gives me:

WoHand (<my mac address>) was not found.

Config:

            "name": "door3",
            "retries": 5,
            "macAddress": "<mac address>",
            "accessory": "SwitchBot-For-Mac"
            "platform": "SwitchBotPlatform"

I had this working just fine and then all of a sudden it stopped. I did change my router, but I completely uninstalled the plugin and reinstalled it. My other plugins are working fine. I'm on a raspberry pi, but I had this working, so I don't think it's a compatibility issue?

Momentary on mode

Firstly thanks for making this plugin!

Is there any chance you could make the switch status reset back to off a few second after it has been turned on?

Thanks :)

Not working when daemonized on macOS Big Sur

Similar to abandonware/noble#143 (comment)

The plugin is unable to communicate with SwitchBot devices when run as a daemon (via hb-service).

[11/20/2020, 11:54:48 AM] [Bot] Failed to discover WoHand (C0:51:13:D6:C2:9C). Is Bluetooth enabled?
[11/20/2020, 11:54:48 AM] [Bot] Error: Failed to initialize the Noble object: resetting
    at Noble.<anonymous> (/opt/homebrew/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot.js:171:25)
    at Object.onceWrapper (node:events:436:26)
    at Noble.emit (node:events:341:22)
    at Noble.onStateChange (/opt/homebrew/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:87:8)
    at NobleMac.emit (node:events:329:20)

The plugin is able to communicate with SwitchBot devices when run directly in a terminal with sudo homebridge (at which point the user gets prompted to grant Bluetooth access to the Terminal app).

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.