Integrate SwitchBot and Home Assistant // Detailed Guide

API Call (Curl)

curl.exe -H "Authorization:[API TOKEN]" https://api.switch-bot.com/v1.0/devices/[DEVICEID]/status | ConvertFrom-Json | ConvertTo-Json

Home Assistant Templates

 platform: rest
  name: "Humidifier"
  resource: !secret switchbot_humidifier_status_url
  method: GET
  scan_interval: 300
  headers:
    Authorization: !secret switchbot_api
    Content-Type: "application/json"
  value_template: "{{ value_json.body.power }}"
  json_attributes_path: "$.body"
  json_attributes:
    - humidity
    - temperature
    - nebulizationEfficiency
    - auto
    - childLock
    - sound
    - lackWater

- platform: rest
  name: "Meter Sensor"
  resource: !secret switchbot_meter_status_url
  method: GET
  scan_interval: 300
  headers:
    Authorization: !secret switchbot_api
    Content-Type: "application/json"
  value_template: "{{ value_json.body.temperature }}"
  json_attributes_path: "$.body"
  json_attributes:
    - humidity

- platform: rest
  name: "Office Overhead Light"
  resource: !secret switchbot_office_light_status_url
  method: GET
  scan_interval: 300
  headers:
    Authorization: !secret switchbot_api
    Content-Type: "application/json"
  value_template: "{{ value_json.body.power }}"

- platform: rest
  name: "Coffee Pot"
  resource: !secret switchbot_coffee_status_url
  method: GET
  scan_interval: 300
  headers:
    Authorization: !secret switchbot_api
    Content-Type: "application/json"
  value_template: "{{ value_json.body.power }}"

Links to Resources

If you want to use the SwitchBot without the hub, you can use the direct integration and BLE devices: https://www.home-assistant.io/integrations/switchbot/