# 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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.docu.smartnest.cz/homebridge-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
