- Published on
Getting started with turnsmart
- Author
- Name
- Karuppusamy
- Headline
- Developer
Introduction
It is an open-source smart-home development platform that allows you to build and deploy your smart home devices on your own. It supports a wide range of devices, including ESP8266, ESP32, Arduino, Raspberry Pi, and more.
Features
- Self Hosted
- Easy to setup
- Easy Google Home integration
- Deploy your own devices
- Customizable traits
- Works with ESP32, ESP8266, and Raspberry Pi or other microcontrollers (e.g. Arduino)
Quick Start Guide
- Clone the repo and deploy.
- Create an account and log in with the new account.
- Create a new project and add required endpoints.
- Enable smarthome in project settings and choose the device type.
- Add required traits and update target endpoints for each trait.
- Connect your smarthome device to the website using the API.
- Connect your device to Google Home by going to
Google Home > Set up device > Works with Google > [test] project-name
and following the instructions. - Now you can control your device from Google Home and Google Assistant.
- Enjoy making 🧑💻
Deploy Guide
Clone the repo and deploy it on vercel or any other cloud provider.
Create a new Firebase project.
Enable Firebase Authentication and add your domain in authorised domains.
Enable Firebase Database and set up firebase rules as in
firebase.rules
file.Enable Firebase Storage and set up respective rules.
Create a new Firebase web app by going to project settings.
Create a new Firebase Admin key by going to
Project settings > Service accounts > Generate a new private key
.Update the environment variables.
Create a new Actions project by going to actions console and selecting your existing Firebase project.
Set the category as
Smart Home
and name your project.Setup Account linking by going to
Develop > Account linking
and using the values below.Field Value Client ID environment variable: GOOGLE_CLIENT_ID Client secret environment variable: GOOGLE_CLIENT_SECRET Authorization URL https://your-domain/login Token URL https://your-domain/api/auth/token
Sample project
You can find the sample projects here.
API Reference
The API is available on your-domain/api
. It is a REST API that allows you to control your smart home devices. You can use the turnsmart API to control your smart home devices. The turnsmart API is secure and can be accessed from any device.
Get data:
GET /api
Request
You need to send the following headers with your request:
Parameter | Type | Description |
---|---|---|
uid | string | Required. Your Project id |
secret | string | Required. Your Project secret |
Response
The data on your project is returned in the response as a json object.
Parameter | Type | Description |
---|---|---|
data | json | Response data |
message | string | Error message |
Send data:
POST /api
Request
You need to send the following headers with your request:
Parameter | Type | Description |
---|---|---|
uid | string | Required. Your Project id |
secret | string | Required. Your Project secret |
data | json | Required. Data to be updated |
Response
The status of the request is returned in the response.
Parameter | Type | Description |
---|---|---|
message | string | Response message |
Dashboard Settings
Endpoints section:
Endpoints are used to identify the data you want to store on your server. You can create as many endpoints as you want. This data can be number or boolean or color.
Data section:
In the data section, you will see the data of the endpoints you have added. You can modify the data directly from the dashboard. You can use the data to control your smart home devices. The data can be assessed using the turnsmart API from your device.
Smarthome section:
In the smart home section, you can modify the Google Home integration settings. You can change device type or add/remove device traits. There are many device types available including light, fan, switch, sensor, etc.
Device types
Device types are used by Google Assistant to determine what actions are available to the user. For example, if you define a device as a Light, the user can interact with the device through Google Assistant with Hey Google, turn on my light.
Device traits
Device traits are used to define the capabilities of the device. You can add as many traits as you want. For example, if you define a device as Light, you can add the trait of brightness and color. There are many traits available including: on/off, brightness, color, etc.
For example,
- You can add a "color" trait to a light device. This will allow you to control the color of the light.
- You can also add a "brightness" trait to a light device. This will allow you to control the brightness of the light.