# Home

![Smartnest](https://www.smartnest.cz/img/Logo-vector-login.png)

## Welcome to Smartnest documentation!

We hope you will find all the information you are looking for, here are some of the most frequently asked questions:

### What is Smartnest?

Smartnest is a Web service that allows Home automation enthusiasts with knowledge in electronics to connect their own devices with voice assistants like Google Assistant, Amazon Alexa, Siri, IFTTT and more, it works with many Arduino and ESP boards but also other devices like STM32 microcontrollers, the service uses MQTT to send and receive information from your device, so you only need MQTT library and you will have access to all the services.

### Why use Smartnest?

Let's say you just built a nice system that opens and closes your curtains, it would be nice to control it using your voice, or from your phone, or from a web browser, or just using any of your devices in the way that is more convenient for you, but this would require you to program your device to connect to each service, probably set up your own server, configure it in a safe way, manage web requests, and so on... or you can just sign up and use Smartnest, you can have it running in less than 10 minutes.

### Why is it called Smartnest?

A nest is a combination of twigs and leaves, is the place where birds sleep and feel protected but most importantly it is made completely by them, they go every day looking for the best twigs and anything that can improve it. Everyone is talking today about Smart Homes and Smart Houses, but we like to think about them as Smart nests since it is you, the user who takes the time to go out there get component by component build something from your own and configure it.

### What is the price of Smartnest?

Everyone can create an account and start for free with a Basic plan if you have bigger requirements there are different plans for you to choose, you can visit the pricing page here: [Pricing](https://www.smartnest.cz/pricing)

### What Integrations are available?

Smartnest is now in Beta Phase and we are working very hard to have it running with all services as soon as posible.

Here is a list of the methods available to control your devices:

* From your Computer: Using the web Application [Visit web App](https://www.smartnest.cz/login)
* From your Phone: Using the[ iOS](https://apps.apple.com/cz/app/smartnest/id1509508554) or [Android App](https://play.google.com/store/apps/details?id=cz.smartnest.smartnestcz), or if you prefer you can [add the web app](/using-web-app) icon to your home screen for iOS Android and Windows phone [Visit web App](https://www.smartnest.cz/login)
* From your tablet: Using the[ iOS](https://apps.apple.com/cz/app/smartnest/id1509508554) or [Android App](https://play.google.com/store/apps/details?id=cz.smartnest.smartnestcz) or using the web application that will adapt to any screen size [Visit web App](https://www.smartnest.cz/login)
* Alexa Skill: Skill is available in the skills store. [Visit Skill](https://skills-store.amazon.com/deeplink/dp/B07VH46TDC?deviceType=app\&share\&refSuffix=ss_copy)&#x20;
* Siri: [Download the Siri shortcut.](https://www.docu.smartnest.cz/7.-siri-integration)
* Google Home: Activate the Google Home action. Follow the [Google Integration guide](https://www.docu.smartnest.cz/google-home-integration)
* IFTTT: Using the Smartnest service on IFTTT [Follow the configuration guide](https://www.docu.smartnest.cz/9.-ifttt-integration)
* API: complete access to the API will be released for App developers (Business plan required)

Future developments:

* Controller for blinds
* Controller for RGB Lights

the connection is made using MQTT, there are plenty of MQTT libraries on the web so feel free to choose the one that suits your project and your Board. You can also download one of our examples, we use the library Pubsubclient from Knolleary which supports the following devices:

* Arduino Ethernet
* Arduino Ethernet Shield
* Arduino YUN&#x20;
* Arduino WiFi Shield
* Sparkfun WiFly Shield
* TI CC3000 WiFi
* Intel Galileo/Edison
* ESP8266
* ESP32

Download and install from <https://github.com/knolleary/pubsubclient>


# 1. Getting started

## Getting Started

Welcome to the future of home automation, here are the steps so you can get started quickly:

Before you start, you will need:

* Any programmable device with Internet Access (Arduino, RaspBerry, ESP8266, ect)
* Some MQTT library that you can use with the device.

### Steps:

1. Create your account at [Smartnest website](https://www.smartnest.cz/login).

2. Click on Add device and give it a name.

3. Click on the three dots button and copy the Device ID.

4. Configure your MQTT client with the following options:

   * Broker address: 3.122.209.170
   * Broker port: 1883.
   * Client ID: (Device ID copied in step 3)
   * Username: (Username selected during registration)
   * Password: (Password selected during registration)

5. Click on the device widget and check the message on your device.

6. Add Integrations: Follow the next guides about linking your Smartnest account with Alexa, Google Home, Siri and more.

if you have an ESP8266 device you can download the [Blink Tutorial](https://github.com/aososam/Smartnest/tree/master/Tutorials/Blink) to complete this tutorial.


# 2. Examples

Here you can see some examples of projects and tutorials using Smartnest

1. [Blink Tutorial](https://github.com/aososam/Smartnest/tree/master/Tutorials/Blink): Learn how to connect your device to smartnest
2. [Doorbell Tutorial](https://github.com/aososam/Smartnest/tree/master/Tutorials/Doorbell): Connect your doorbell to Alexa&#x20;
3. [Smart Watering Tutorial](https://github.com/aososam/Smartnest/tree/master/Tutorials/Plant-Watering): Build your own smart watering system
4. [Multiple Relay module](https://github.com/aososam/Smartnest/tree/master/Tutorials/Relay-Module): control many devices with one mcu
5. [Smart Button Tutorial](https://github.com/aososam/Smartnest/tree/master/Tutorials/Smart-Button): Trigger any routine with a smart button
6. [Raspberry Blink Tutorial](https://github.com/aososam/Smartnest/tree/master/Tutorials/Raspberry-Blink): Connect your Raspberry to Smartnest


# 3. Using the App


# How to use the web App

## Web application guide

Smartnest web application is the main member of the system, here is where you will register, manage your account, create and manage groups and devices and more. Here is the information you will need to know about how to use it.

### Registration

![signup](https://www.smartnest.cz/img/Documentation/signup.png)

the first step is to complete your registration by filling the form with all the required information, you will receive an e-mail asking you to confirm your e-mail address, this a very important step and your account will be fully functional only after it is completed. access the registration page [here](https://www.smartnest.cz/login)

### Managing devices

new devices can be added by clicking the add device button and then provide a name and a type for the device. you will find more information about all supported device types and their properties in the [Supported devices](https://github.com/aososam/Smartnest/wiki/8.-Supported-Device-Types) guide.

![signup](https://www.smartnest.cz/img/Documentation/addDevice.png)

there will be an "add device" button in each of your groups and depending on which one you click on the device will be added to the respective group. If there are no groups the device will be added to the "No group" section.

In order to add devices to a group from the "No group" section just click on "add device" in the group you want and at the bottom select the option "import", Select the device you want to import and click on Import.

To remove a device from a group click on the view button and then click on the button with the trash can, a submenu will appear with three options, the trash can with the grid means to remove the device from the group, the trash can alone means to remove the device completely (This cannot be undone) and the third button is to cancel and go back to the main menu.

All devices have an action button, which will turn them on or off by sending the respective command through MQTT see more in [MQTT giude](https://www.docu.smartnest.cz/5.-mqtt-guide).

by clicking the view button on the devices you can access to details like device Id, type and other options depending on the device type, you can also edit the name and type by clicking the pencil button.

It is possible to see the online status of the devices on the web application, the online devices will show a green color and the offline will show a grey color, some will show a red color which means there are some issues with the device, you can click on it to find out more.

![device Online](https://www.smartnest.cz/img/Documentation/deviceOnline.png) ![device Offline](https://www.smartnest.cz/img/Documentation/deviceOffline.png)

### Managing groups

it is possible to organize your devices in groups, these can be either rooms, or types, or home members, or anything you would like to use to organize them, to do that click on the Add group label at the end of the main view, Add a name and press Enter. Your new group will be ready to receive new devices.

### Managing your account

You can check the information we have from you in the tab called "My account", there you can also change your account type, change your password or connect more services.


# Download the mobile app

#### If you want to control your devices from your phone or to receive notifications you can download the mobile app on your phone or tablet.

![](/files/-MMjku93FEZBV0fh_uns)

[iOS APP](https://apps.apple.com/cz/app/smartnest/id1509508554#?platform=iphone)

[Android app](https://play.google.com/store/apps/details?id=cz.smartnest.smartnestcz)


# Setting up the web App on your mobile device

## Using the web App on your mobile device

the web application is developed to be completely responsive, which means that it will adapt to any screen size, so you can access your devices and control them from any device with a web browser.

it is possible to add the web app to the home screen of iOs, Android and Windows devices as follows:

### iOS:

* Open the [web app](https://www.smartnest.cz/login) on Safari web browser
* Tap the Share button at the bottom of the page.
* On the bottom row of icons, scroll over until you see Add to Home Screen.

![iOS](https://www.smartnest.cz/img/Documentation/Ios.PNG)

### Android

* Open the web [web app](https://www.smartnest.cz/login) on Chrome web browser
* Tap on the Menu button. The looks of the Menu button will depend on your device; usually, it's an app button that looks like three horizontal lines stacked on each other, or it could be accessed through a hardware button on your phone.
* Tap "Add to Home Screen.

![Android](https://www.smartnest.cz/img/Documentation/Android.PNG)

### Windows phone

* Navigate to the [web app](https://www.smartnest.cz/login) using Internet explorer&#x20;
* Pull up the app bar — for example, by right-clicking or swiping up from the bottom of your screen — and tap the star icon.&#x20;
* Tap the pin icon, enter a name for the shortcut, and click Pin to Start.

![Windows Phone](https://www.smartnest.cz/img/Documentation/Windows.PNG)


# 4. MQTT Guide

Here you will find the basic concepts of MQTT and the specification of how the messages are send to and from your device.

## What is MQTT?

MQTT is a lightweight simple messaging protocol, designed for constrained devices with low-bandwidth. This means that it is the perfect solution for the Internet of Things and Home automation applications and it's usually more flexible stable and reliable than other protocols like WebSockets. MQTT allows you to send commands to control outputs, read and publish data from your devices and more.

## Basics of MQTT

In MQTT there are 3 basic concepts:

### **Topics:** these are like addresses for a message, here is how a topic would look like:

**Topic:** `Home/Livingroom/Lamp/Turn`&#x20;

**Message:** `ON`

here the topic is Home/Livingroom/Lamp/Turn and the message is ON, and this is the basic structure of all messages that are sent through MQTT

### **Publish/Subscribe system:**

&#x20;Every device can subscribe to topics, and it will receive all the messages sent with the topics they are subscribed to, they can subscribe to multiple topics and also subtopics.&#x20;

Also when publishing a message the devices must provide the topic so the message can be successfully delivered.

{% hint style="info" %}
A device who is subscribed to Home/# will receive messages sent to Home/Livingroom and also those sent to Home/Bedroom just by using the # sign.
{% endhint %}

### **Broker:**&#x20;

Is the central device who allows and restricts connections and also, receives, filters, redirects and publishes messages to all devices connected. In this case, the broker is Smartnest Server.

## Is MQTT only a tool to talk to the server?

No, you can also interconnect your devices using this protocol, for example, if you have a motion sensor and a lighting system, and they are too far away from each other, you don't need to install cables across the room to let them communicate, you can just make the light to subscribe to the topic Bedroom/Light and you can have the sensor publish to that topic, at the same time they will be connected to Smartnest and all the integrations.

## Smartnest and MQTT

At Smartnest every device has a unique ID, this ID must be used as the first part of a topic.&#x20;

If you are sending a message to the broker this must be the Id of the device which is sending the message.&#x20;

If you are sending the message to another of your devices this should be the Id of the device you are sending the message to.&#x20;

The following parts of the topic can be customized by the user, for example, this would be a valid topic from the device to Smartnest Broker:

{% hint style="success" %}
`jasds3421FDC1CDSCDSfdsas/Bedroom/Temperature`        `Message:25`
{% endhint %}

while this would be an invalid topic:

{% hint style="danger" %}
`Bedroom/Temperature`        `Message:25`
{% endhint %}

## Smartnest MQTT commands

There are some subtopics reserved for special purposes and here is the list of all the reserved topics:

#### Directives:&#x20;

Directives are sent From the server to the device every time there is a new command from any of the integrations.

| Topic                              | Message      | Description                | Supported types |
| ---------------------------------- | ------------ | -------------------------- | --------------- |
| **DeviceID/directive/powerState**  | ON - OFF     | Power state of the device  | All             |
| **DeviceID/directive/percentage**  | 0-100        | New percentage             | Light           |
| **DeviceID/directive/setpoint**    | -100 - 200   | Temperature Setpoint       | Thermostat      |
| **DeviceID/directive/lockedState** | true - false | true means lock the device | Lock            |

#### Reports

Reports are sent from the device to the server to inform about a state change. This reports must be every time after receiving a directive and also when there is a change due to a physical interaction like pressing a button.

| Topic                              | Message      | Description              | Supported types          |
| ---------------------------------- | ------------ | ------------------------ | ------------------------ |
| **DeviceID/report/powerState**     | ON - OFF     | Power state has changed  | All                      |
| **DeviceID/report/percentage**     | 0-100        | Percentage has changed   | Light                    |
| **DeviceID/report/setpoint**       | -100 - 200   | Setpoint has changed     | Thermostat               |
| **DeviceID/report/temperature**    | -100 - 200   | New temperature sensed   | Thermostat, Temp Sensor  |
| **DeviceID/report/humidity**       | 0 - 100      | New humidity             | Thermostat, Temp Sensor  |
| **DeviceID/report/pressure**       | >0           | New pressure             | Temp Sensor              |
| **DeviceID/report/scale**          | C - F        | Select temperature scale | Thermostat, Temp Sensor  |
| **DeviceID/report/lockedState**    | true - false | Locked state has changed | Lock                     |
| **DeviceID/report/online**         | true - false | the device is connected  | All                      |
| **DeviceID/report/info**           | (Any)        | To show in the Web App   | All                      |
| **DeviceID/report/detectionState** | true - false | Sensor logic value       | Presence, Contact sensor |
| **DeviceID/report/notification**   | (Any)        | Send a push notification | All                      |

#### Requests and responses

Requests are sent from the device to the server in order to ask for special information like time, the server will respond with a response topic.

| Topic                      | Message              | Description                                                                                                   |
| -------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------- |
| **DeviceID/request/time**  | <p></p><p>GMT+XX</p> | get the real time the message can include the timezone GMT+XX, if timezone is not present GMT+00 will be sent |
| **DeviceID/response/time** | HH:MM:SS             | Answer the time request                                                                                       |

## Smartnest MQTT Rules

At Smartnest we are a community of Home Automation and we are all using the same resources so here are the rules that everyone must follow when using MQTT:

1. The connection will be only allowed when providing valid username and password
2. The connection will be allowed when the device ID used belongs to the username used
3. The first member of any published topic must be a valid Id from one of the devices from the username used
4. You must avoid sending the reserved topics too often every 500 ms is fine, but in general, avoid to put them in infinite for loops without delays.

{% hint style="warning" %}
The devices that don't follow these rules are automatically disconnected and blocked by the system, the first block is for 1 minute, the second is for 5 minutes, the third is for 10 minutes and so on.
{% endhint %}

{% hint style="warning" %}
If a device is reset it will take about 20 seconds for the server to note the change and allow the reconnection.
{% endhint %}


# 5. Alexa Integration

## Alexa integration

In order to configure the integration with Alexa, you have to go to your Alexa App and open the menu by tapping on the icon at the top left corner, then select the option Skills & Games and then tap the search button at the top right corner, type Smartnest, and then tap search. Or get the skill [from this link](https://skills-store.amazon.com/deeplink/dp/B07VH46TDC?deviceType=app\&share\&refSuffix=ss_copy)

![alexa skill 1](https://www.smartnest.cz/img/Documentation/alexaskill1.png) ![alexa skill 1](https://www.smartnest.cz/img/Documentation/alexaskill2.png)

You will see the Smartnest skill ready to be linked to your account, tap Enable to use button and you will be redirected to a login screen. After providing your username and password you will see the confirmation page saying that the skill has been successfully linked

![alexa skill 1](https://www.smartnest.cz/img/Documentation/alexaskill3.png) ![alexa skill 1](https://www.smartnest.cz/img/Documentation/alexaskill4.png)

After the first link, Alexa will start discovering devices and she will get all the devices you have created in your account. Alexa will show you a confirmation of how many devices she found and then you can configure them, add them to your rooms or routines.

![alexa skill 1](https://www.smartnest.cz/img/Documentation/alexaskill5.png) ![alexa skill 1](https://www.smartnest.cz/img/Documentation/alexaskill6.png)

The Alexa skill has proactive management of endpoints which means that every time you create or delete an endpoint on Smartnest Alexa app will do the same and will also show you a notification of the new devices


# 6. Siri Integration

## Siri integration

It is possible to control your devices with Siri in two ways:

A. Using the Siri shortcuts app

B. [Using the Homebridge Integration ](/homebridge-integration)

### Using the Siri shortcuts app

First, make sure you have both the [Smartnest App](https://apps.apple.com/cz/app/smartnest/id1509508554#?platform=iphone) and the [Siri shortcuts app](https://apps.apple.com/us/app/shortcuts/id915249334)

![](/files/-MfiZxIBj0UdQpm0-ANw)

Then log into your account on the Smartnest App. Then Open the Siri shortcuts App and create a new shortcut.

![](/files/-MfidS9Hz0HobFQJoeUx)

Then add a new action and look for the Smartnest App

![](/files/-MfigGlBwX_r0axpqNpN)

![](/files/-MfigJad-NknTX6F65x6)

You can either control the power state of any of your devices or lock or unlock your doors.

![](/files/-MfigSDwV8RC6cf1qjsm)

Then select the device you want to control and select the new state you want to set. (If you cannot see your devices try to kill the Smartnest app and launch it again)

![](/files/-MfigUkFSnzoDcO_BT3n)

![](/files/-MfigX79N0VJ0x7wmwy8)

Give the shortcut a name and save it. You can even add your shortcut as a widget to be able to use it from your home screen.

![](/files/-MfigZo5WqaR7XXzh_Mn)


# 7. Google Home Integration

## Google Home integration

Controlling your devices using Google Assistant can be set up in just minutes, go to your Google Home App and tap on the Add button, then select Set up device and select the option "Have something already set up".

Then search for the Smart nest Action ( with space ) and follow the linking process.

You can check the action on the [Assistant directory](https://assistant.google.com/services/a/uid/000000ccb8d54cfd)

<img src="https://www.smartnest.cz/img/Documentation/googleGuide/B1.jpg" alt="Step 1" data-size="original"> ![Step 2](https://www.smartnest.cz/img/Documentation/googleGuide/B2.jpg) ![Step 3](https://www.smartnest.cz/img/Documentation/googleGuide/B3.jpg) ![Step 3](/files/-LyQEx61u40Fkux4yusd)

## If you don't have a google home device

You don't have a Google Home device but you want to control your devices using Google Assistant you can configure the [IFTTT integration](https://www.docu.smartnest.cz/9.-ifttt-integration) and activate Google Assistant service as a trigger and Smartnest service as an action:

![](/files/-M5rTa8MicAfSBvMLfDz)

![](/files/-M5rTc6AnzWsVpzEWSY7)

![](/files/-M5rTUxn1FFySSmuy9fu)

![](/files/-M5rTjKQCfELploPOQ8Y)

![](/files/-M5rTl6rQa-5zH1Ne-tk)

![](/files/-M5rTnpld38hR1_80qJx)


# 8. Smartthings Integration

Now you can use your Samsung device and the Voice assistant Bixby to control your devices.

#### Open the Smartthings App on your mobile device and tap on the search icon.

![](/files/nghZD8I0s1BGrNvqeL3Z) ![](/files/gVWk0txOv5H2TQCGdupF)

#### Search for Smartnest in the service list and link your Smartnest account

![](/files/MBShcrZCdhMWXJfZbcke) ![](/files/mWOIcxTczUteEBM9iQNI)

#### Organise your devices in rooms and control them through the app or using Bixby.

![](/files/QagoWS1IjMfSdoJfndYU) ![](/files/CTkOQHeV2TnSYiGZCdWV)


# #. IFTTT Integration

## IFTTT Integration

You can expand the power of Smartnest even further by using the IFTTT Service to build your own Applets and connect your devices to more than 600 other services.

To start using this integration you need to link your IFTTT account with Smartnest. Then you will be able to create connections with any of the other services available on IFTTT.

To use IFTTT Integration you need a Pro account.

## Linking your account:

![](/files/-M5rSO_k-L0XGiwtJVaZ)

![](/files/-M5rSRcAiLqT-1TdebfQ)

![](/files/-M5rRxRudR2Ug5z2TInq)

![](/files/-M5rS3b0wDRYc0XEdYMT)

## Creating a connection:

![](/files/-M5rSrFj9q65Kv6IoFlQ)

![](/files/-M5rSvGoNGStYpfVQCww)

![](/files/-M5rT5Wihh_Th73SAMx-)

![](/files/-M5rSyjM4-4MqNSfda5h)

![](/files/-M5rTAX0322C02-RQEpt)


# 9. Tasmota Integration

You can also use Smartnest to control your devices using Tasmota Firmware, in order to do that you need to apply the following configuration in the MQTT Seccion of Tasmota configuration.

{% hint style="info" %}
You can use your API key instead of your password. You can find this key in the section "My Account" in the web App.
{% endhint %}

![](/files/-M3w-vHd9ka8k8yetp0m)


# 10. Espurna Integration

You can also use Smartnest to control your devices using Espurna Firmware, in order to do that you need to apply the following configuration in the MQTT Seccion of Espurna configuration.

{% hint style="info" %}
You can use your API key instead of your password. You can find this key in the section "My Account" in the web App.
{% endhint %}

![](/files/-M8_LLZhYYzSldsicLmh)


# 11. Homebridge Integration

To control your devices using siri and the HomeKit API you will  need:

1. Install [Homebridge](https://github.com/homebridge/homebridge) in your Windows, Linux, Mac, or Raspberry&#x20;
2. Install the Plugin [Homebridge Mqttthing](https://github.com/arachnetech/homebridge-mqttthing#readme)
3. Add a new device with the  configuration shown below depending on the device type.
4. Open your Home app in your iOS device and link it scanning the QR code from the administration portal of Homebridge.
5. Rename your devices in the Home App.
6. Done!

### Device Configurations:

1. **Switch or Light (No Tasmota)**

```javascript
{
    "type": "switch",
    "name": "31141235efb12D367",      //YOUR DEVICE ID
    "url": "smartnest.cz",
    "username": "USERNAME",
    "password": "PASSWORD or API KEY",
    "topics": {
        "getOnline": "31141235efb12D367/report/connected",    //CHANGE HERE TOO
        "getOn": "31141235efb12D367/report/powerState",
        "setOn": "31141235efb12D367/directive/powerState"
    },
    "onlineValue": "Online",
    "offlineValue": "Offline",
    "onValue": "ON",
    "offValue": "OFF",
    "accessory": "mqttthing"
}
```

2\. **Switch or Light (Tasmota)**

```javascript
 {
    "type": "switch",
    "name": "31141235efb12D367",     //YOUR DEVICE ID
    "url": "smartnest.cz",
    "username": "USERNAME",
    "password": "PASSWORD or API KEY",
    "topics": {
        "getOnline": "31141235efb12D367/tele/LWT", //CHANGE HERE TOO
        "getOn": "31141235efb12D367/stat/POWER",
        "setOn": "31141235efb12D367/cmnd/POWER"
    },
    "onlineValue": "Online",
    "offlineValue": "Offline",
    "onValue": "ON",
    "offValue": "OFF",
    "accessory": "mqttthing"
}
```

3\. **Door or Lock**

```javascript
{
    "type": "lockMechanism",
    "name": "31141235efb12D367",     //YOUR DEVICE ID
    "url": "smartnest.cz",
    "username": "USERNAME",
    "password": "PASSWORD or API KEY",
    "topics": {
        "getOnline": "31141235efb12D367/report/online",
        "getLockCurrentState": "31141235efb12D367/report/lockedState",
        "getLockTargetState": "31141235efb12D367/report/lockedState",
        "setLockTargetState": "31141235efb12D367/directive/lockedState"
    },
    "lockValues": [
        "false",
        "true",
        "Jammed",
        "Unknown"
    ],
    "accessory": "mqttthing"
}
```

4\. **Thermostat**

```javascript
{
    "accessory": "mqttthing",
    "type": "thermostat",
    "name": "31141235efb12D367",     //YOUR DEVICE ID
    "url": "smartnest.cz",
    "username": "USERNAME",
    "password": "PASSWORD or API KEY",
    "topics": {
        "getCurrentHeatingCoolingState": "31141235efb12D367/report/mode",
        "setTargetHeatingCoolingState": "31141235efb12D367/directive/mode",
        "getTargetHeatingCoolingState": "31141235efb12D367/report/mode",
        "getCurrentTemperature": "31141235efb12D367/report/temperature",
        "setTargetTemperature": "31141235efb12D367/directive/setpoint",
        "getTargetTemperature": "31141235efb12D367/report/setpoint",
        "setTemperatureDisplayUnits": "31141235efb12D367/directive/scale",
        "getTemperatureDisplayUnits": "31141235efb12D367/directive/scale"
    },
    "heatingCoolingStateValues": [
        "Heat",
        "Cool",
        "Auto"
    ],
    "temperatureDisplayUnitsValues": [
        "C",
        "F"
    ],
    "minTemperature": 10,        //Change if you use Fahrenheit
    "maxTemperature": 30,        //Change if you use Fahrenheit
    "restrictHeatingCoolingState": [
        0,
        1
    ]
}
```

5\. **Temperature Sensor**

```javascript
{
    "accessory": "mqttthing",
    "type": "temperatureSensor",    
    "name": "31141235efb12D367",     //YOUR DEVICE ID
    "url": "smartnest.cz",
    "username": "USERNAME",
    "password": "PASSWORD or API KEY",
    "caption": "Temperature",
    "topics": {
        "getCurrentTemperature": "31141235efb12D367/report/temperature"
    },
    "history": true,
    "minTemperature": 10,        //Change if you use Fahrenheit
    "maxTemperature": 30        //Change if you use Fahrenheit
}
```

**6. Fan**

```javascript
 {
    "accessory": "mqttthing",
    "type": "fan",
    "name": "31141235efb12D367",     //YOUR DEVICE ID
    "url": "smartnest.cz",
    "username": "USERNAME",
    "password": "PASSWORD or API KEY",
    "caption": "Fan",
    "topics": {
        "getOn": "31141235efb12D367/report/powerState",
        "setOn": "31141235efb12D367/directive/powerState",
        "getRotationSpeed": "31141235efb12D367/report/percentage",
        "setRotationSpeed": "31141235efb12D367/directive/percentage"
    },
    "integerValue": false,
    "onValue": "ON",
    "offValue": "OFF",
    "turnOffAfterms": 3600000
}
```

## If you want to add another type of device you can check the [Supported accessories page from homebridge-mqttthing](https://github.com/arachnetech/homebridge-mqttthing#supported-accessories)


# 12. Home Assistant Integration

If you would like to control your devices in Home assistant with Alexa, Google Home, Siri or IFTTT, you only need to follow these steps.

1. Install [Home assistant ](https://www.home-assistant.io/)in your Windows, Linux, Mac, or Raspberry&#x20;
2. Install the Plugin MQTT

![](/files/-M6q-mLgdPMyGd5cQKma)

4\. Replace your username and password (Or API key) and add the configuration below to the file configuration.yaml file.&#x20;

```yaml
mqtt:
  broker: smartnest.cz
  port: 1883
  client_id: "homeassistant-USERNAME"
  username: "USERNAME"
  password: "API-KEY"
  discovery: true
  discovery_prefix: "homeassistant-USERNAME"
```

5\. After this restart your Home Assistant and it will discover all the devices you have created in Smartnest. This will allow you to use the Home assistant's rich interface and still be able to control your devices from any voice assistant.

6\. Done!


# 13. Supported Devices

Here you can find all the supported devices and the example code for connecting them to Smartnest.

## Supported devices:

[Air conditioner](https://github.com/aososam/Smartnest/tree/master/Devices/airConditioner)

[Analog Sensor](https://github.com/aososam/Smartnest/tree/master/Devices/analogSensor)

[Blinds](https://github.com/aososam/Smartnest/tree/master/Devices/blinds)

[Camera](https://github.com/aososam/Smartnest/tree/master/Devices/camera)

[Contact Sensor](https://github.com/aososam/Smartnest/tree/master/Devices/contactSensor)

[Door](https://github.com/aososam/Smartnest/tree/master/Devices/door)

[Doorbell](https://github.com/aososam/Smartnest/tree/master/Devices/doorbell)

[Fan](https://github.com/aososam/Smartnest/tree/master/Devices/fan)

[Light ](https://github.com/aososam/Smartnest/tree/master/Devices/light)

[Light RGB](https://github.com/aososam/Smartnest/tree/master/Devices/lightRgb)

[Lock](https://github.com/aososam/Smartnest/tree/master/Devices/lock)

[Motion Sensor](https://github.com/aososam/Smartnest/tree/master/Devices/motionSensor)

[Sprinkler](https://github.com/aososam/Smartnest/tree/master/Devices/sprinkler)

[Switch](https://github.com/aososam/Smartnest/tree/master/Devices/switch)

[Temperature Sensor](https://github.com/aososam/Smartnest/tree/master/Devices/temperatureSensor)

[Thermostat](https://github.com/aososam/Smartnest/tree/master/Devices/thermostat)

[TV](https://github.com/aososam/Smartnest/tree/master/Devices/tv)

## Smartnest supports the following device controller types:

### Power Controller: On OFF

The variable used for this controller is called powerState and it can only be either ON or OFF, this is the basic controller type and it can be used for switches, relays, lights and in general any device that can be turned on, turned off, activated or deactivated.

Supported on All devices

### Percentage Controller: 0-100%

The variable used for this controller is called percentage and it can only be between 0 and 100, this can be use for lights or dimmable devices.

Supported on Light, Light RGB, Fan, Blinds

### Thermostat Controller:&#x20;

There are three variables that are used to storage the current state of the thermostat:

1. temperature : current ambient temperature.
2. setpoint: desired temperature.
3. scale: sets the temperature units to use, "C" for Celcius, "F" for Fahrenheit.

The *temperature* variable is supported by these device types:

* Thermostat
* Temperature Sensor
* Air conditioner

The setpoint variable is supported by these device types:

* Thermostat
* Air conditioner

The *scale* variable is supported by these device types

* Thermostat
* Temperature Sensor
* Air conditioner

### Sensor detection Controller:

The variable for digital sensors is called detectionState and it can be true or false, it is supported by the following device types:

* Contact Sensor
* Motion Sensor
* Doorbell

### Lock controller:

The variable that stores the state for locks and doors is called lockedState, it can be true or false, it is supported by these device types:

Supported on Lock and Door


# 14. Routines

![Smartnest routines](/files/-MMjb8MV4BSgqIIyIQst)

You can create custom routines for your devices by clicking on the routines tab on the web application.

### Routines contain conditions and actions.

{% hint style="success" %}
the first condition is considered the trigger of the routine
{% endhint %}

![](/files/-MMjcEfnbH5_QY77dADs)

You can add up to 5 conditions for a single routine, when the routine is triggered by the first condition it will check all the others and if they are true then the routine will run the actions specified.

### There are two types of conditions, **Device and Time.**

**Device:** Triggers when a specific feature of a device is changed, for example when it is turned on or off, when there is motion detected or when a door opens or closes.

**Time:** Triggers at a specific time, it can be set to repeat every day or on specific days of the week

![](/files/-MMje1zdCba2yf8w3JY1)

### There are two types of actions: Device and Notification

**Device**: Sends a directive to the selected device to control one of its features, for example to turn it on or off.

**Notification:** Sends a notification to your account, this will be displayed in the notification section or if you have the Android or iOS App it will be delivered as a [push notification](/notifications).

![](/files/-MMjeubHiM_LrJ1qQXVr)


# 15. Notifications

You can send push notifications from your devices in different ways. first, make sure to install the last version of Smartnest App for iOS or Android and allow push notifications.

We respect your digital well being, we don't send any marketing notifications.

### You will receive notifications in the following cases:

1. Critical information about your account.
2. Your devices send an MQTT message to the topic: `<DeviceId>/report/notification` . Learn more about MQTT topics [here](/mqtt-guide#smartnest-and-mqtt).
3. You create a routine and one of the actions is to send a notification. Learn more about routines [here](/routines)

You will receive a notification on your mobile device and also in the web application.

{% hint style="warning" %}
If a device sends notifications in for loops without delays it will be automatically blocked by the system for some minutes
{% endhint %}

## Telegram Notifications

You can also receive your notifications via telegram Bot.

Search for the Smartnest Bot in the Telegram App @SmartnestCZBot

{% embed url="<https://t.me/SmartnestCZBot>" %}
&#x20;Smartnest Bot
{% endembed %}

Text start and follow the instructions to configure.


# 16. Business API

Interact with Smartnest cloud using your Business API key.

## Add a new device

<mark style="color:green;">`POST`</mark> `https://smartnest.cz/api/v6/devices`

Add a new device to your Business account.

#### Headers

| Name                                      | Type      | Description                                   |
| ----------------------------------------- | --------- | --------------------------------------------- |
| api-key<mark style="color:red;">\*</mark> | XXXXXXXXX | business API key. to get one contact support. |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| name<mark style="color:red;">\*</mark> | device | Device name |
| type<mark style="color:red;">\*</mark> | switch | Device type |

{% tabs %}
{% tab title="401: Unauthorized When API key is not present or wrong" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="200: OK Request was processed" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

###


# Donations, Thank you!

### Would you like to support us?

Smartnest would not be possible without the donations from different sources. If you would like to support this project and help us to provide a better service and develop new tools, you can donate us through the link below. Thank you!

[Donation Page](https://www.smartnest.cz/donate)

Thanks a Lot!!

* Alberto Ca.
* Daniel Mo.
* Mick R.
* Marcela L.
* Becky T.
* Fabio O.
* Maria G.
* Freddy S.
* Pavlina H.
* Jose M.
* Karen V.
* Dominik Ha.


# DOCUMENTACIÓN EN ESPAÑOL

## Si prefieres ver la documentación en español la puedes encontrar [aquí](http://www.documentacion.smartnest.cz)

![](/files/-M6qN-aYWUuv-_V26zce)


