An open API service indexing awesome lists of open source software.

https://github.com/febinbaiju/smartthings-shutdown-automation-connector

A lightweight Node.js SmartApp integration for Samsung SmartThings. This app listens for a virtual switch event and securely triggers a Raspberry Pi system shutdown. Built for automation enthusiasts using SmartThings + Raspberry Pi.
https://github.com/febinbaiju/smartthings-shutdown-automation-connector

automation iot nodejs raspberry-pi samsung smartthings webhook

Last synced: about 2 months ago
JSON representation

A lightweight Node.js SmartApp integration for Samsung SmartThings. This app listens for a virtual switch event and securely triggers a Raspberry Pi system shutdown. Built for automation enthusiasts using SmartThings + Raspberry Pi.

Awesome Lists containing this project

README

          

# Samsung SmartThings Shutdown Connector

A Node.js-based SmartApp that integrates with Samsung SmartThings and allows you to remotely trigger a system shutdown using a virtual switch.

## πŸš€ Features

* Configure a SmartThings virtual switch to trigger system shutdown.
* Securely integrates using SmartThings SmartApp lifecycle events.
* Subscribes to `switch.on` events to trigger shutdown.
* Automatically deletes/re-creates subscriptions on update.
* Turns off the switch after triggering shutdown.

---

## πŸ“¦ Requirements

* Node.js (v16 or later recommended)
* A SmartThings developer account
* A Raspberry Pi (or any Linux system that supports `shutdown`)

---

## πŸ“ Project Structure

```
smartthings-shutdown-connector/
β”œβ”€β”€ app.js # Main application logic
β”œβ”€β”€ .env # Environment variable configuration
β”œβ”€β”€ package.json # Project dependencies and scripts
└── README.md # You're reading it!
```

---

## πŸ”§ Installation

```bash
# Clone the repo
git clone https://github.com/your-username/smartthings-shutdown-connector.git
cd smartthings-shutdown-connector

# Install dependencies
npm install

# Setup environment variables
cp .env.example .env
# Edit .env and add required values
```

### Example `.env`

```ini
PORT=5165
APP_NAME=SmartThings Shutdown
APP_DESCRIPTION=Trigger system shutdown from SmartThings
APP_ID=your-app-id
```

---

## πŸƒβ€β™‚οΈ Usage

Start the server:

```bash
npm start
```

Make sure the server is publicly accessible (you can use [ngrok](https://ngrok.com) during development).

Then, install your SmartApp on Samsung SmartThings Developer Workspace:

* Use your public endpoint (e.g., via ngrok) as the SmartApp URL.
* Grant permissions for `switch` capability.
* Choose your virtual switch during configuration.

---

## βš™οΈ Lifecycle Events Supported

* `CONFIGURATION`
* `INSTALL`
* `UPDATE`
* `EVENT`
* `UNINSTALL`

---

## ⚠️ Important Notes

* Your server needs `sudo` permission to run `shutdown`.
* It’s recommended to configure your system to allow passwordless shutdown for your service user.
* The virtual switch will be turned off automatically after triggering.

---

## πŸ‘¨β€πŸ’» Author

**Febin Baiju**