Yandex Alice Integration for IoT Device Control in Mobile App

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Yandex Alice Integration for IoT Device Control in Mobile App
Complex
~1-2 weeks
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Yandex Alice IoT Control in Mobile App

Smart home control via Yandex Alice — either Smart Home API (for devices in Yandex ecosystem), or Skills API (voice skill with own backend), or direct integration via Yandex IoT Core MQTT broker. For mobile app wanting to control devices through Alice, path almost always: OAuth 2.0 → Smart Home API → device control.

Smart Home API and Account Linking

OAuth authorization via https://oauth.yandex.ru/authorize with your app client_id. Scope: iot:view iot:control. After authorization app gets access token (lives 1 year) and refresh token.

Get user's device list:

GET https://api.iot.yandex.net/v1.0/user/info
Authorization: Bearer {access_token}

Response contains devices with capabilities and properties. Smart outlet returns:

{
  "id": "device-id",
  "name": "Smart outlet kitchen",
  "type": "devices.types.socket",
  "capabilities": [
    {
      "type": "devices.capabilities.on_off",
      "state": {"instance": "on", "value": true}
    }
  ]
}

Control — via Actions API:

func turnDevice(id: String, on: Bool) async throws {
    let url = URL(string: "https://api.iot.yandex.net/v1.0/devices/actions")!
    var request = URLRequest(url: url)
    request.httpMethod = "POST"
    request.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")

    let body: [String: Any] = [
        "devices": [
            [
                "id": id,
                "actions": [
                    [
                        "type": "devices.capabilities.on_off",
                        "state": ["instance": "on", "value": on]
                    ]
                ]
            ]
        ]
    ]
    request.httpBody = try JSONSerialization.data(withJSONObject: body)
    let (_, response) = try await URLSession.shared.data(for: request)
    // Check HTTP 207 Multi-Status — each device has its own status
}

Important API detail: Actions response — HTTP 207 with status array per device. Command can partially execute: one device turns on, another returns DEVICE_UNREACHABLE error. Parse each status mandatory.

Skills API: Voice Commands with Custom Logic

If devices not in Yandex ecosystem, need dialog (skill) in Yandex.Dialogs. Alice sends POST requests to developer webhook:

{
  "request": {
    "command": "turn on light in living room",
    "nlu": {
      "intents": {
        "turn.on": {
          "slots": {
            "room": {"value": "living room"},
            "device": {"value": "light"}
          }
        }
      }
    }
  },
  "session": {
    "user": {"user_id": "yandex-user-id"}
  }
}

Webhook responds within 5 seconds (hard timeout) with TTS text for Alice response and optionally buttons or map for screened devices.

For user account binding to skill — OAuth via skill settings form. After binding each webhook request contains access_token in session.user.access_token.

Yandex IoT Core: Direct MQTT Integration

For real-time instead of REST use Yandex IoT Core — managed MQTT broker. Devices publish to topics like $devices/{device_id}/events, mobile app subscribes and receives updates.

// Android, Paho MQTT
val client = MqttAsyncClient(
    "ssl://mqtt.cloud.yandex.net:8883",
    MqttClient.generateClientId(),
    MemoryPersistence()
)

val options = MqttConnectOptions().apply {
    userName = "unused"  // For JWT authorization
    password = generateJwt(serviceAccountId, privateKey).toCharArray()
    isCleanSession = false
    socketFactory = createSslSocketFactory()
}

client.connect(options).waitForCompletion()
client.subscribe("\$devices/+/events", 1) { topic, message ->
    val deviceId = topic.split("/")[1]
    val payload = String(message.payload)
    handleDeviceEvent(deviceId, payload)
}

JWT for authorization generated with service account key via RS256 algorithm, 1-hour lifespan. Token refresh — separate coroutine with timer.

Special Notes for Russian Market

Smart Home API requires Yandex developer account with confirmed INN for skill publication and OAuth app registration with extended rights. For development testing regular account sufficient.

Integration timeline: Smart Home API into existing iOS or Android app: 1-2 weeks. Skills API with OAuth binding and webhook backend: 2-3 weeks. IoT Core MQTT integration with real devices: 3-4 weeks. Cost calculated individually.