iklein99 / homebridge-smartthings

This is a plugin to Homebridge to connect your Smartthings network into Apple Home Kit.
Apache License 2.0
150 stars 52 forks source link

lot of DNS requests to api.smarthings.com #121

Closed Anuj79 closed 1 year ago

Anuj79 commented 1 year ago

Describe Your Problem: seeing lot of DNS requests to api.smarthings.com since install the plugin. almost 34k hour which seems excessive. seeing the ecobee sensors repeatedly in the logs . the entire log is too big too show here

**date|Status|Count** -- | -- | -- 11-01-2023 | allowed | 67260 12-01-2023 | allowed | 836108 13-01-2023 | allowed | 726856 14-01-2023 | allowed | 19094 **Logs:** [1/14/2023, 11:14:08 AM] [Smartthings Plug (IK)] EcobeeSensor: guest bedroom (M6S8) returned bad value for status [1/14/2023, 11:14:08 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: guest bedroom (M6S8) [1/14/2023, 11:14:08 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: guest bedroom (M6S8) [1/14/2023, 11:14:09 AM] [Smartthings Plug (IK)] EcobeeSensor: familyroom (XPZN) returned bad value for status [1/14/2023, 11:14:09 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: familyroom (XPZN) [1/14/2023, 11:14:09 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: familyroom (XPZN) [1/14/2023, 11:14:10 AM] [Smartthings Plug (IK)] EcobeeSensor: Lil'bee (J2LS) returned bad value for status [1/14/2023, 11:14:10 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: Lil'bee (J2LS) [1/14/2023, 11:14:10 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: Lil'bee (J2LS) [1/14/2023, 11:14:10 AM] [Smartthings Plug (IK)] EcobeeSensor: dining sensor (HJPN) returned bad value for status [1/14/2023, 11:14:10 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: dining sensor (HJPN) [1/14/2023, 11:14:10 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: dining sensor (HJPN) [1/14/2023, 11:14:13 AM] [Smartthings Plug (IK)] EcobeeSensor: guest bedroom (M6S8) returned bad value for status [1/14/2023, 11:14:13 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: guest bedroom (M6S8) [1/14/2023, 11:14:13 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: guest bedroom (M6S8) [1/14/2023, 11:14:14 AM] [Smartthings Plug (IK)] EcobeeSensor: familyroom (XPZN) returned bad value for status [1/14/2023, 11:14:14 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: familyroom (XPZN) [1/14/2023, 11:14:14 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: familyroom (XPZN) [1/14/2023, 11:14:15 AM] [Smartthings Plug (IK)] EcobeeSensor: Lil'bee (J2LS) returned bad value for status [1/14/2023, 11:14:15 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: Lil'bee (J2LS) [1/14/2023, 11:14:15 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: Lil'bee (J2LS) [1/14/2023, 11:14:15 AM] [Smartthings Plug (IK)] EcobeeSensor: dining sensor (HJPN) returned bad value for status [1/14/2023, 11:14:15 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: dining sensor (HJPN) [1/14/2023, 11:14:15 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: dining sensor (HJPN) [1/14/2023, 11:14:18 AM] [Smartthings Plug (IK)] EcobeeSensor: guest bedroom (M6S8) returned bad value for status [1/14/2023, 11:14:18 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: guest bedroom (M6S8) [1/14/2023, 11:14:18 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: guest bedroom (M6S8) [1/14/2023, 11:14:19 AM] [Smartthings Plug (IK)] EcobeeSensor: familyroom (XPZN) returned bad value for status [1/14/2023, 11:14:19 AM] [Smartthings Plug (IK)] Bad status from EcobeeSensor: familyroom (XPZN) [1/14/2023, 11:14:19 AM] [Smartthings Plug (IK)] Poll failure on EcobeeSensor: familyroom (XPZN) [1/14/2023, 11:14:20 AM] [Smartthings Plug (IK)] EcobeeSensor: Lil'bee (J2LS) returned bad value for **Plugin Config:** { "bridge": { "name": "Homebridge", "username": "", "port": 51826, "pin": "" }, "description": "JSON API", "accessories": [ { "name": "Bedroom Speakers", "room": "Bedroom", "groupCacheLifetime": 15, "deviceCacheLifetime": 3600, "accessory": "Sonos" }, { "accessory": "Raspberry PI Temperature", "name": "Raspberry PI Temperature" }, "platforms": [ { "name": "EcoPlug", "platform": "EcoPlug" }, { "name": "Config", "port": 8581, "platform": "config" }, { "name": "Wemo", "platform": "Wemo" }, { "name": "Smartthings Plug (IK)", "BaseURL": "https://api.smartthings.com/v1/", "AccessToken": "", "GarageDoorMaxPoll": 40, "PollLocksSeconds": 10, "PollDoorsSeconds": 10, "PollSensorsSeconds": 5, "PollSwitchesAndLightsSeconds": 10, "platform": "HomeBridgeSmartThings" } ], "disabledPlugins": [ "homebridge-wemo", "homebridge-smartthings-v2" ] } **Screenshots:** **Environment:** * **Plugin Version**: * **Homebridge Version**: 1.6.0 * **Node.js Version**: v18.12.1 * **NPM Version**: 9.2.0 * **Operating System**: Linux raspberrypi 5.15.76-v8+ #1597 aarch64 GNU/Linux
iklein99 commented 1 year ago

The plugin polls for updates. That is controlled by the settings. You can change the frequency or set them to zero to disable them.

I am working on a version that uses webhooks rather than polling, but that will require a subscription to use.

Stunt0265 commented 1 year ago

Looking forward to webhook version. I'm using Home Assistant now for motion detectors, and your plugin for the rest. Any need for testing help?

Anuj79 commented 1 year ago

Based on amount of DNS requests it seems like it’s polling multiple times each second.

I am assuming that these poll numbers are in seconds. Would these result in 30k+ requests every hour. This is default values.

What’s the outcome of making it zero and disabling jt. Does that mean data won’t be updated on apple home app ?

Just to compare in last 24 hours. For google it’s 17k request ( pinging google to check latency) Vs SmartThings of 833,406.

As more users start using the plugin and is polling the SmartThings server so many times it may become a problem for SmartThings.

On Jan 16, 2023, at 3:32 PM, iklein99 @.***> wrote:

 The plugin polls for updates. That is controlled by the settings. You can change the frequency or set them to zero to disable them.

I am working on a version that uses webhooks rather than polling, but that will require a subscription to use.

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

iklein99 commented 1 year ago

Each device request status based on the polling settings, but no more frequently than 5 seconds. You can adjust that with those values.

I am close to being able to open the webhook version of the plugin - maybe by the end of the week. Need to work in a few things and write up instructions for setting up. If you would like you could help by being a beta tester.

Anuj79 commented 1 year ago

Definitely no issues being a beta tester. Let me know when ready.

Sent from my iPhone

On Jan 17, 2023, at 5:11 PM, iklein99 @.***> wrote:

 Each device request status based on the polling settings, but no more frequently than 5 seconds. You can adjust that with those values.

I am close to being able to open the webhook version of the plugin - maybe by the end of the week. Need to work in a few things and write up instructions for setting up. If you would like you could help by being a beta tester.

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

Anuj79 commented 1 year ago

@iklein99 , the latest update seems to have crashed.

^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[31mFailed to request status from dining sensor: AxiosError: Request failed with status code 401. This is failure number 1^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on dining sensor^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on dining sensor^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on dining sensor^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mEcobeeSensor: guest bedroom (M6S8) returned bad value for status^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[31mBad status from EcobeeSensor: guest bedroom (M6S8). Removing this service.^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on EcobeeSensor: guest bedroom (M6S8)^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[31mFailed to request status from EcobeeSensor: familyroom (XPZN): AxiosError: Request failed with status code 401. This is failure number 1^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on EcobeeSensor: familyroom (XPZN)^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on EcobeeSensor: familyroom (XPZN)^[[39m ^[[37m[1/17/2023, 7:03:18 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on EcobeeSensor: familyroom (XPZN)^[[39m ^[[37m[1/17/2023, 7:03:19 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mEcobeeSensor: Lil'bee (J2LS) returned bad value for status^[[39m ^[[37m[1/17/2023, 7:03:19 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[31mBad status from EcobeeSensor: Lil'bee (J2LS). Removing this service.^[[39m ^[[37m[1/17/2023, 7:03:19 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on EcobeeSensor: Lil'bee (J2LS)^[[39m ^[[37m[1/17/2023, 7:03:19 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mEcobeeSensor: dining sensor (HJPN) returned bad value for status^[[39m ^[[37m[1/17/2023, 7:03:19 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[31mBad status from EcobeeSensor: dining sensor (HJPN). Removing this service.^[[39m ^[[37m[1/17/2023, 7:03:19 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[33mPoll failure on EcobeeSensor: dining sensor (HJPN)^[[39m ^[[37m[1/17/2023, 7:03:21 PM]^[[0m ^[[36m[HB Supervisor]^[[0m Homebridge Process Ended. Code: 143, Signal: null

AFTER RESTART ^[[37m[1/17/2023, 7:03:33 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[31mError getting devices from Smartthings: AxiosError: Request failed with status code 401^[[39m ^[[37m[1/17/2023, 7:03:33 PM] ^[[39m^Smartthings Plug (IK)]^[[39m ^[[31mCould not load devices from Smartthings: undefined. Check your configuration^[[39m

iklein99 commented 1 year ago

Wait a while and retry. You are getting a 401 back from Smartthings which means unauthorized. You may have to regenerate your access token.

Anuj79 commented 1 year ago

I reverted to the previous version and it worked fine. Didn’t need to change the access token. But the roll back to the previous version was done after few hours. Also noticed the home bridge service was restarted multiple times during this time because of plugins errors.

Sent from my iPhone

On Jan 18, 2023, at 8:05 AM, iklein99 @.***> wrote:

 Wait a while and retry. You are getting a 401 back from Smartthings which means unauthorized. You may have to regenerate your access token.

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

cirrusflyer commented 1 year ago

I'm happy to test as well.

adey commented 1 year ago

Each device request status based on the polling settings, but no more frequently than 5 seconds. You can adjust that with those values.

I am close to being able to open the webhook version of the plugin - maybe by the end of the week. Need to work in a few things and write up instructions for setting up. If you would like you could help by being a beta tester.

If you could use another beta tester happy to test the webhooks version.

iklein99 commented 1 year ago

I just announced the availability of the Webhook Service which eliminated polling and all of the traffic. Also results in near real-time updates of device state. See the announcement for more info.