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

Support Request: Bot type ignored #825

Closed
bxlouis opened this issue Sep 16, 2023 · 19 comments
Closed

Support Request: Bot type ignored #825

bxlouis opened this issue Sep 16, 2023 · 19 comments
Assignees
Labels
question Further information is requested stale

Comments

@bxlouis
Copy link

bxlouis commented Sep 16, 2023

Describe Your Problem

I configured the plugin to display my bot as a lock but it keeps showing as a switch

Relevant log output

[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail statusCode: 200
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail headers: {"date":"Sat, 16 Sep 2023 07:57:35 GMT","content-type":"application/json","content-length":"189","connection":"keep-alive","x-amzn-requestid":"0840cbfb-bc0b-4d89-a9d0-81f6028e5602","x-amz-apigw-id":"LVvtcGNvIAMEUwA=","x-amzn-trace-id":"Root=1-65055fef-0a3606f1091e40f9791e5ee7;Sampled=0;lineage=c8c2b0f2:0|bf95bacf:0"}
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail deviceStatus: {"statusCode":100,"body":{"deviceId":"REDACTED","deviceType":"Bot","hubDeviceId":"REDACTED","version":"V6.6","power":"on","battery":19,"deviceMode":"pressMode"},"message":"success"}
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail deviceStatus body: {"deviceId":"REDACTED","deviceType":"Bot","hubDeviceId":"REDACTED","version":"V6.6","power":"on","battery":19,"deviceMode":"pressMode"}
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail deviceStatus statusCode: 100
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail statusCode: 200 & deviceStatus StatusCode: 100
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail openAPIparseStatus
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail On: false
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail BatteryLevel: 19, StatusLowBattery: 0
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail updateCharacteristic On: false
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail updateCharacteristic BatteryLevel: 19
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail updateCharacteristic StatusLowBattery: 0
[9/16/2023, 9:57:35 AM] [SwitchBot] [DEBUG] Bot: Portail updateCharacteristic FirmwareRevision: "V6.6"
[9/16/2023, 9:57:39 AM] [SwitchBot] [DEBUG] Bot: Portail openAPIRefreshStatus
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail body: {"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":{"data":{"type":"Buffer","data":[123,34,115,116,97,116,117,115,67,111,100,101,34,58,49,48,48,44,34,98,111,100,121,34,58,123,34,100,101,118,105,99,101,73,100,34,58,34,68,52,51,53,51,51,51,53,49,51,50,48,34,44,34,100,101,118,105,99,101,84,121,112,101,34,58,34,66,111,116,34,44,34,104,117,98,68,101,118,105,99,101,73,100,34,58,34,69,65,57,66,54,49,70,69,70,69,66,52,34,44,34,118,101,114,115,105,111,110,34,58,34,86,54,46,54,34,44,34,112,111,119,101,114,34,58,34,111,110,34,44,34,98,97,116,116,101,114,121,34,58,49,57,44,34,100,101,118,105,99,101,77,111,100,101,34,58,34,112,114,101,115,115,77,111,100,101,34,125,44,34,109,101,115,115,97,103,101,34,58,34,115,117,99,99,101,115,115,34,125]},"next":null},"tail":{"data":{"type":"Buffer","data":[123,34,115,116,97,116,117,115,67,111,100,101,34,58,49,48,48,44,34,98,111,100,121,34,58,123,34,100,101,118,105,99,101,73,100,34,58,34,68,52,51,53,51,51,51,53,49,51,50,48,34,44,34,100,101,118,105,99,101,84,121,112,101,34,58,34,66,111,116,34,44,34,104,117,98,68,101,118,105,99,101,73,100,34,58,34,69,65,57,66,54,49,70,69,70,69,66,52,34,44,34,118,101,114,115,105,111,110,34,58,34,86,54,46,54,34,44,34,112,111,119,101,114,34,58,34,111,110,34,44,34,98,97,116,116,101,114,121,34,58,49,57,44,34,100,101,118,105,99,101,77,111,100,101,34,58,34,112,114,101,115,115,77,111,100,101,34,125,44,34,109,101,115,115,97,103,101,34,58,34,115,117,99,99,101,115,115,34,125]},"next":null},"length":1},"length":189,"pipes":[],"flowing":null,"ended":true,"endEmitted":false,"reading":false,"constructed":true,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":true,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":0}
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail statusCode: 200
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail headers: {"date":"Sat, 16 Sep 2023 07:57:40 GMT","content-type":"application/json","content-length":"189","connection":"keep-alive","x-amzn-requestid":"afe263d6-f668-4233-95b3-7c854bcc6031","x-amz-apigw-id":"LVvuLEgooAMEgWQ=","x-amzn-trace-id":"Root=1-65055ff4-425bb4a8622b6f834b930b49;Sampled=0;lineage=bf95bacf:0"}
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail deviceStatus: {"statusCode":100,"body":{"deviceId":"REDACTED","deviceType":"Bot","hubDeviceId":"REDACTED","version":"V6.6","power":"on","battery":19,"deviceMode":"pressMode"},"message":"success"}
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail deviceStatus body: {"deviceId":"REDACTED","deviceType":"Bot","hubDeviceId":"REDACTED","version":"V6.6","power":"on","battery":19,"deviceMode":"pressMode"}
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail deviceStatus statusCode: 100
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail statusCode: 200 & deviceStatus StatusCode: 100
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail openAPIparseStatus
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail On: false
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail BatteryLevel: 19, StatusLowBattery: 0
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail updateCharacteristic On: false
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail updateCharacteristic BatteryLevel: 19
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail updateCharacteristic StatusLowBattery: 0
[9/16/2023, 9:57:40 AM] [SwitchBot] [DEBUG] Bot: Portail updateCharacteristic FirmwareRevision: "V6.6"
[9/16/2023, 9:57:44 AM] [SwitchBot] [DEBUG] Bot: Portail openAPIRefreshStatus

Config for homebridge-switchbot

{
            "name": "SwitchBot",
            "credentials": {
                "token": "REDACTED",
                "secret": "REDACTED",
                "notice": "Keep your Token & Secret a secret!"
            },
            "options": {
                "devices": [
                    {
                        "deviceId": "REDACTED",
                        "configDeviceName": "Portail",
                        "configDeviceType": "Smart Lock",
                        "connectionType": "OpenAPI",
                        "lock": {
                            "hide_contactsensor": true
                        },
                        "refreshRate": 5,
                        "logging": "debug"
                    }
                ]
            },
            "platform": "SwitchBot"
        }

Screenshots

No response

Device & Model

Hub Mini v3.9-2.6 + SwitchBot v6.6

Node.js Version

16.18.0

NPM Version

8.19.2

Homebridge Version

1.6.1

Homebridge SwitchBot Plugin Version

2.8.2

Homebridge Config UI X Plugin Version

No response

Operating System

Docker

@bxlouis bxlouis added the question Further information is requested label Sep 16, 2023
@donavanbecker
Copy link
Collaborator

Your config is wrong. So this is a Bot you want to display as a garage door?

@bxlouis
Copy link
Author

bxlouis commented Sep 16, 2023

This is indeed the bot I’d like to display as garage door!

@donavanbecker
Copy link
Collaborator

If so your config should look like this:


{
  "name": "SwitchBot",
  "credentials": {
    "token": "REDACTED",
    "secret": "REDACTED",
    "notice": "Keep your Token & Secret a secret!"
  },
  "options": {
    "devices": [
      {
        "deviceId": "REDACTED",
        "configDeviceName": "Portail",
        "configDeviceType": "Bot",
        "connectionType": "OpenAPI",
        "bot": {
          "deviceType": "garagedoor"
        },
        "refreshRate": 5,
        "logging": "debug"
      }
    ]
  },
  "platform": "SwitchBot"
}

@bxlouis
Copy link
Author

bxlouis commented Sep 16, 2023

Installed latest beta and modified the configuration as explained, works like a charm! Thanks a lot!

2 questions:

  • Would there be any possibility to have a setting so that the Garage Door Opener reset to the « closed » position after a while since it closes automatically after a couple of second and this system does not return any state for the gate?

  • I still see this error in the debug logs:
    Portail statusCode: 200 & deviceStatus statusCode: 100

@donavanbecker
Copy link
Collaborator

Is your Bot set to Press Mode? if so then you need to set that in the Config UI:
Screenshot 2023-09-16 at 5 47 03 AM

@donavanbecker
Copy link
Collaborator

also that error can be ignored

@bxlouis
Copy link
Author

bxlouis commented Sep 16, 2023

All good, thanks a lot for your support! Ticket can be closed!

@bxlouis bxlouis closed this as completed Sep 16, 2023
@donavanbecker
Copy link
Collaborator

v2.9.0 released

@bxlouis
Copy link
Author

bxlouis commented Sep 18, 2023

I noticed after a few hours/days that I get the following error with v2.9.0 and the plugin stops working:
Bot: Portail Device internal error due to device states not synchronized with server, Or command format is invalid, statusCode: 190

After restarting Homebridge, I now get this error:
[9/18/2023, 9:53:42 AM] [SwitchBot] Bot: Portail failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "getaddrinfo EAI_AGAIN api.switch-bot.com"
[9/18/2023, 11:22:48 AM] [SwitchBot] Bot: Portail Unknown statusCode: 500, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug

@bxlouis bxlouis reopened this Sep 18, 2023
@donavanbecker
Copy link
Collaborator

Sorry that is something with the API and nothing with the plugin. You would have to reach out to SwitchBot.

@bxlouis
Copy link
Author

bxlouis commented Sep 18, 2023

OK, and in the meantime, is there any way to use BLE with this setup?

@bxlouis
Copy link
Author

bxlouis commented Sep 18, 2023

Also, when rebooting Homebridge, I noticed the following error message:
[SwitchBot] Requests reached the daily limit, statusCode: 190

So it seems there is a daily limit on the API that may be exceeded? Isn't it something you are familiar with?

@donavanbecker
Copy link
Collaborator

Yes see request limit in SwitchBotAPI repo.

@bxlouis
Copy link
Author

bxlouis commented Oct 5, 2023

@donavanbecker after several days of use, it still does not work reliably.
It always comes down to this scenario:

  1. It works after a reboot.
  2. I eventually get this error Bot: Portail Device internal error due to device states not synchronized with server, Or command format is invalid, statusCode: 190
  3. The error repeats over and over till I reach the daily limit and get this error: Requests reached the daily limit, statusCode: 190

What makes me think something is wrong with the plugin (or maybe my configuration?) is that the app itself works flawlessly even when I get the first error. If the issue was with the API, it should not work from the app either?

Would you be able to provide me with assistance in order to try and fix this issue?

@donavanbecker
Copy link
Collaborator

This API is completely different then how the App communicates with the devices.

@bxlouis
Copy link
Author

bxlouis commented Oct 6, 2023

OK understood. Then I am the only one to experience this issue or is it a known issue that the Switchbot API is unreliable? I mean, do you get a lot of feedback with this error message from other users?
Because if the API is unreliable and users need to reach out to Switchbot to get the plugin working, what's the point?

I am just asking and willing to help to get the plugin work as reliably as possible because it's really great and I don't see any obvious solution.

@bxlouis
Copy link
Author

bxlouis commented Oct 7, 2023

This API is completely different then how the App communicates with the devices.

Also, I meant that it works using a Siri shortcut I created. I guess the shortcut also uses the API to communicate with the hub?

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 11, 2023
Copy link
Contributor

This issue has been closed as no further activity has occurred.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale
Projects
None yet
Development

No branches or pull requests

6 participants