SwitchBot 1.0.2

dotnet add package SwitchBot --version 1.0.2                
NuGet\Install-Package SwitchBot -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SwitchBot" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SwitchBot --version 1.0.2                
#r "nuget: SwitchBot, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SwitchBot as a Cake Addin
#addin nuget:?package=SwitchBot&version=1.0.2

// Install SwitchBot as a Cake Tool
#tool nuget:?package=SwitchBot&version=1.0.2                

Nuget

SwitchBot

This project uses the SwitchBotAPI to communicate with the SwitchBot environment.

Getting Started

using SwitchBot.RestClient;

// Create SwitchBotRestClient
var switchBotRestClient = new SwitchBotRestClient(options =>
{
    options.Token = "<YOUR TOKEN>";
    options.Secret = "<YOUR SECRET>";
});

// Get DevicesResponse
var devicesResponse = await switchBotRestClient.Devices.GetDevicesResponse();

// Get Devices
var devices = await switchBotRestClient.Devices.GetDevices();

// Get DeviceStatusResponse
foreach (var device in devices.Where(x => x.Type == DeviceType.MeterPlus))
{
    var deviceStatusResponse = await switchBotRestClient.Devices.GetDeviceStatusResponse<MeterPlus>(device.Id);
}

// Get DeviceStatusResponse by SensorType
foreach (var device in devices.Where(x => x.SensorTypes.Contains(SensorType.TemperatureSensor)))
{
    var deviceStatus = await switchBotRestClient.Devices.GetDeviceStatusResponse<TemperatureSensor>(device.Id);
}

// Get DeviceStatus
foreach (var device in devices.Where(x => x.Type == DeviceType.MeterPlus))
{
    var deviceStatus = await switchBotRestClient.Devices.GetDeviceStatus<MeterPlus>(device.Id);
}

// Get DeviceStatus by SensorType
foreach (var device in devices.Where(x => x.SensorTypes.Contains(SensorType.TemperatureSensor) && x.SensorTypes.Contains(SensorType.HumiditySensor)))
{
    var deviceStatus = await switchBotRestClient.Devices.GetDeviceStatus<TemperatureAndHumiditySensor>(device.Id);
}

Supported devices

✅ Hub
✅ Hub Plus
✅ Hub Mini
❌ Hub 2 (can only be used as hub, no sensor data supported yet)
✅ Meter
✅ Meter Plus
✅ Outdoor Meter 
❌ Bot 
❌ Curtain 
❌ Plug
❌ Motion Sensor 
❌ Contact Sensor 
❌ Color Bulb
❌ Humidifier
❌ Smart Fan
❌ Strip Light
❌ Plug Mini 
❌ Lock
❌ Robot Vacuum Cleaner S1
❌ Robot Vacuum Cleaner S1 Plus
❌ Keypad 
❌ Keypad Touch 
❌ Ceiling Light
❌ Ceiling Light Pro
❌ Blind Tilt 

Supported api endpoints

Devices

✅ GET https://api.switch-bot.com/v1.1/devices
✅ GET https://api.switch-bot.com/v1.1/devices/{deviceId}/status
❌ POST https://api.switch-bot.com/v1.1/devices/{deviceId}/commands

Scenes

❌ GET https://api.switch-bot.com/v1.1/scenes
❌ POST https://api.switch-bot.com/v1.1/scenes/{sceneId}/execute

Webook

❌ POST https://api.switch-bot.com/v1.1/webhook/setupWebhook
❌ POST https://api.switch-bot.com/v1.1/webhook/queryWebhook
❌ POST https://api.switch-bot.com/v1.1/webhook/updateWebhook
❌ POST https://api.switch-bot.com/v1.1/webhook/deleteWebhook
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 166 8/19/2023
1.0.1 145 8/19/2023
1.0.0 141 8/19/2023