OpenWonderLabs / homebridge-switchbot

The Homebridge SwitchBot plugin allows you to access your SwitchBot Device(s) from HomeKit. Homebridge.
https://www.switch-bot.com/
ISC License
229 stars 47 forks source link

Bug: Request to turn off bot is being sent as turn on request. #979

Closed Gus-smarthome closed 2 weeks ago

Gus-smarthome commented 1 month ago

Describe the Bug

Requests to turn off the lights with the bot sent via the Home app/Siri or from Homebridge are being translated to turn on (as you can see in the logs)

To Reproduce

Send a turn-off request to any bot.

Expected Behavior

Bot to turn off the lights instead of turning on.

Relevant Log Output

[29/05/2024, 14:14:48] [SwitchBot] Bot: Living Room Lights Set ProgrammableSwitchOutputState: false
[29/05/2024, 14:14:50] [SwitchBot] Bot: Living Room Lights request to SwitchBot API, body: {"command":"turnOn","parameter":"default","commandType":"command"} sent successfully
[29/05/2024, 14:26:05] [SwitchBot] Bot: Living Room Lights Set ProgrammableSwitchOutputState: false
[29/05/2024, 14:26:07] [SwitchBot] Bot: Living Room Lights request to SwitchBot API, body: {"command":"turnOn","parameter":"default","commandType":"command"} sent successfully
[29/05/2024, 14:35:39] [SwitchBot] Bot: Living Room Lights Set ProgrammableSwitchOutputState: false
[29/05/2024, 14:35:39] [SwitchBot] Bot: Living Room Lights Set ProgrammableSwitchOutputState: false
[29/05/2024, 14:35:39] [SwitchBot] Bot: Living Room Lights Set ProgrammableSwitchOutputState: false
[29/05/2024, 14:35:39] [SwitchBot] Bot: Living Room Lights Set ProgrammableSwitchOutputState: false
[29/05/2024, 14:35:39] [SwitchBot] Bot: Living Room Lights Set ProgrammableSwitchOutputState: false
[29/05/2024, 14:35:39] [SwitchBot] Bot: Living Room Lights Set ProgrammableSwitchOutputState: false
[29/05/2024, 14:35:40] [SwitchBot] Bot: Living Room Lights request to SwitchBot API, body: {"command":"turnOn","parameter":"default","commandType":"command"} sent successfully

Config for homebridge-switchbot

{
    "name": "SwitchBot",
    "credentials": {
        "token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "secret": " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
        "notice": "Keep your Token & Secret a secret!"
    },
    "options": {
        "devices": [
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Bedroom Lights",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "bot": {
                    "mode": "switch",
                    "deviceType": "switch",
                    "allowPush": true
                }
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Entrance Light",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "bot": {
                    "mode": "switch",
                    "deviceType": "switch",
                    "allowPush": true
                }
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Hall lights",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "bot": {
                    "mode": "switch",
                    "deviceType": "switch",
                    "allowPush": true
                }
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Kitchen Lights",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "bot": {
                    "mode": "switch",
                    "deviceType": "switch",
                    "allowPush": true
                }
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Lavatory Lights",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "bot": {
                    "mode": "switch",
                    "deviceType": "switch",
                    "allowPush": true
                }
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Living Room Lights",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "bot": {
                    "mode": "switch",
                    "deviceType": "switch",
                    "allowPush": true
                }
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Toilet Lights",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "bot": {
                    "mode": "switch",
                    "deviceType": "switch",
                    "allowPush": true
                }
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Left Curtain",
                "configDeviceType": "Curtain3",
                "connectionType": "OpenAPI",
                "curtain": {
                    "set_minStep": 1,
                    "set_min": 0,
                    "set_max": 100
                }
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Right Curtain",
                "configDeviceType": "Curtain3",
                "connectionType": "OpenAPI"
            },
            {
                "deviceId": "XXXXXXX",
                "configDeviceName": "Light Curtain",
                "configDeviceType": "Curtain3",
                "connectionType": "OpenAPI"
            }
        ]
    },
    "platform": "SwitchBot"
}

Screenshots

No response

Device and Model

SwitchBot S1

Node.js Version

v20.13.1

NPM Version

10.5.2

Homebridge Version

v1.8.2

Homebridge Switchbot Plugin Version

v3.5.0

Homebridge Config UI X Plugin Version

v4.56.2

Operating System

Raspbian GNU/Linux Bullseye (11)

donavanbecker commented 1 month ago

Similar to #977

github-actions[bot] commented 2 weeks ago

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[bot] commented 2 weeks ago

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