Skip to content

Configuration

Donavan Becker edited this page Oct 13, 2022 · 14 revisions

Configuration

Breakdown of each Config option:

Name: defaults SwitchBot, what will show up in the log to identify the plugin, and is not an option in the Plugin Config UI

credentials: object that holds token & secret

  • token: input your token you get from the SwitchBot App, under developer options.
  • secret: input your secret you get from the SwitchBot App, under developer options.

options: object that holds all optional settings

  • logging: this is the logging used for the whole plugin, this will be used for every device unless a specific device override is made.

  • devices: array that holds config for each different device setting that is set.

    • Breakdown of each device config option:
      • deviceId: this can be found either on the Devices Tab of the Plugin Config UI for each Device, or in the SwitchBot app under each device info.
        • this is used for matching up the device config with the device found through the OpenAPI
        • if doing Bluetooth Low Enegery (BLE) only, then this will be used to scan for the device over BLE Connection
      • configDeviceName: this is only used and required when doing Bluetooth Low Enegery (BLE) connection only
        • this is the name of the device
      • hide_device: this is used to hide devices from the Home App (HomeKit)
        • this is the name of the device
      • configDeviceType: this is used only for Plugin Config UI
      • offline: allows you to display unit is off when offline.
      • refreshRate: this is the refreshRate used for this specific device based of deviceId
      • logging: this is the logging used for this specific device based of deviceId
      • ble: this is used for BLE Connection
        • if doing Bluetooth Low Enegery (BLE) only, then this will be used and required to enable BLE Connection
      • scanDuration: BLE Scan Duration (Default is 1 Second).
      • bot: Object that holds Bot device config options
        • mode: either press or switch this sets the Mode to Send to OpenAPI/BLE that Bot is using
        • deviceType: either outlet or switch this always you to change how you want the device to be displayed in the Home App (HomeKit)
        • allowPush: If set to true, this will allow commands to be sent even if device state is already in state that is being pushed
        • doublePress: allows you to simulate multiple presses
        • maxRetry: number of retries for BLE
      • curtain: Object that holds Curtain device config options
        • disable_group: will disable the automatic grouping of curtains
        • hide_lightsensor: allows you to hide the light sensor service from displaying in the Home App (HomeKit)
        • set_minlux: sets the min lux value which would match up with dim/level 1
        • set_maxlux: sets the min lux value which would match up with bright/level 10
        • updateRate: sets the number of seconds before refreshing Curtain status while updating slide progress
        • set_minStep: allows you to set the minSteps that you can set. So if set to 20, the curtain can be set to 0, 20, 40, 60, 80, or 100.
        • set_min: sets the level of what the plugin will look at to set the curtain to closed.
        • set_max: sets the level of what the plugin will look at to set the curtain to open.
      • meter: Object that holds Meter device config options
        • hide_temperature: allows you to hide the temperature sensor service from displaying in the Home App (HomeKit)
        • hide_humidity: allows you to hide the humidity sensor service from displaying in the Home App (HomeKit)
      • contact: Object that holds Contact device config options
        • hide_lightsensor: allows you to hide the light sensor service from displaying in the Home App (HomeKit)
        • set_minlux: sets the min lux value which would match up with dim/level 1
        • set_maxlux: sets the min lux value which would match up with bright/level 10
        • hide_motionsensor: allows you to hide the motion sensor service from displaying in the Home App (HomeKit)
      • motion: Object that holds Motion device config options
        • hide_lightsensor: allows you to hide the light sensor service from displaying in the Home App (HomeKit)
        • set_minlux: sets the min lux value which would match up with dim/level 1
        • set_maxlux: sets the min lux value which would match up with bright/level 10
      • lock: Object that holds Lock device config options
        • hide_contactsensor: allows you to hide the Contact sensor service from displaying in the Home App (HomeKit)
      • colorbulb: Object that holds ColorBulb device config options
        • set_minStep: allows you to set the minSteps that you can set. So if set to 20, the ColorBulb's brightness levels can be set to 0, 20, 40, 60, 80, or 100.
        • adaptiveLightingShift: The mired for each Adaptive Lighting update will be increased by this value, making the light appear warmer. Set to -1 to remove Adaptive Lighting feature. Must be -1 or more.
      • humidifier: Object that holds Humidifier device config options
        • hide_temperature: allows you to hide the temperature sensor service from displaying in the Home App (HomeKit)
        • set_minStep: allows you to set the minSteps that you can set. So if set to 20, the humidifier's humidity levels can be set to 0, 20, 40, 60, 80, or 100.
  • irdevices: array that holds config for each different device setting that is set.

    • Breakdown of each device config option:
      • deviceId: this can be found either on the Devices Tab of the Plugin Config UI for each Device, or in the SwitchBot app under each device info.
        • this is used for matching up the device config with the device found through the OpenAPI
      • hide_device: this is used to hide devices from the Home App (HomeKit)
        • this is the name of the device
      • configRemoteType: this is used only for Plugin Config UI
      • logging: this is the logging used for this specific device based of deviceId
      • irair: Object that holds Bot device config options
        • hide_automode: allows you to hide the Auto Mode on Air Conditioner (IR) from displaying in the Home App (HomeKit)
        • pushOn: allows you to push On Changes
      • irfan: Object that holds Bot device config options
        • rotation_speed: enables Rotation Speed on the Air Fan (IR)
        • swing_mode: enables Swing Mode on the Air Fan (IR)
        • set_minStep: allows you to set the minSteps that you can set. So if set to 20, the rotation speed levels can be set to 0, 20, 40, 60, 80, or 100.
        • set_min: sets the min value for rotation speed.
        • set_max: sets the max value for rotation speed.
      • irtv: Object that holds TV (IR) device config options
        • disable_power: allows you to disable sending the the 'On' or 'Off' command to the TV
      • other: Object that holds Others (IR) device config options
        • deviceType: allows you to set which deviceType the device will display in the Home App (Required for Other)
        • commandOn: the command that is sent for powering 'On' (Required for Other)
        • commandOff: the command that is sent for powering 'Off' (Required for Other)

Sample Configuration

{
    "name": "SwitchBot",
    "credentials": {
        "openToken": "1a234b567cd89e0fg1234hijk5678l9m0123n456o7p8901p234qr567s8tu9v0w1xyz2345f6a7b89b0fc123d45e6fg78h",
        "notice": "Keep your token a secret!"
    },
    "options": {
        "devices": [
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceName": "Bot",
                "hide_device": false,
                "configDeviceType": "Bot",
                "ble": true,
                "bot": {
                    "mode": "press",
                    "deviceType": "outlet",
                    "allowPush": true,
                    "doublePress": 2,
                    "maxRetry": 5
                },
                "refreshRate": 5,
                "logging": "standard"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceName": "C",
                "hide_device": true
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceName": "Curtain",
                "configDeviceType": "Curtain",
                "ble": true,
                "curtain": {
                    "disable_group": true,
                    "hide_lightsensor": false,
                    "set_minlux": 1,
                    "set_maxlux": 6001,
                    "refreshRate": 5,
                    "set_minStep": 20,
                    "set_min": 5,
                    "set_max": 95
                },
                "refreshRate": 120,
                "logging": "none"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Plug"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Meter",
                "meter": {
                    "hide_temperature": true,
                    "hide_humidity": true
                },
                "refreshRate": 5,
                "logging": "debug"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Motion Sensor"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Contact Sensor",
                "contact": {
                    "hide_lightsensor": true,
                    "set_minlux": 1,
                    "set_maxlux": 6001,
                    "hide_motionsensor": true
                },
                "refreshRate": 5,
                "logging": "standard"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Contact Sensor",
                "motion": {
                    "hide_lightsensor": true,
                    "set_minlux": 1,
                    "set_maxlux": 6001
                },
                "refreshRate": 5,
                "logging": "none"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Contact Sensor",
                "lock": {
                    "hide_contactsensor": true
                },
                "refreshRate": 5,
                "logging": "debug"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Color Bulb",
                "colorbulb": {
                    "adaptiveLightingShift": 10,
                    "set_minStep": 20
                },
                "refreshRate": 5,
                "logging": "standard"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Humidifier",
                "humidifier": {
                    "hide_temperature": true,
                    "set_minStep": 20
                },
                "refreshRate": 5,
                "logging": "none"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configDeviceType": "Smart Fan",
                "refreshRate": 5,
                "logging": "standard"
            }
        ],
        "irdevices": [
            {
                "deviceId": "AB123C4DE56F",
                "hide_device": true
            },
            {
                "deviceId": "AB123C4DE56F",
                "configRemoteType": "Air Conditioner",
                "irair": {
                    "hide_automode": true,
                    "pushOn": true
                },
                "logging": "none"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configRemoteType": "TV",
                "irtv": {
                    "disable_power": true
                },
                "logging": "debug"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configRemoteType": "DIY Fan",
                "irfan": {
                    "swing_mode": true,
                    "rotation_speed": true,
                    "set_minStep": 10,
                    "set_min": 0,
                    "set_max": 100
                },
                "logging": "standard"
            },
            {
                "deviceId": "AB123C4DE56F",
                "configRemoteType": "Others",
                "other": {
                    "deviceType": "Fan",
                    "commandOn": "On",
                    "commandOff": "Off"
                },
                "logging": "none"
            }
        ],
        "refreshRate": 30,
        "pushRate": 2,
        "logging": "device"
    },
    "platform": "SwitchBot"
}