# iobroker/iobroker.text2command architecture

> Architecture diagram of the GitHub repository iobroker/iobroker.text2command, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iobroker/iobroker.text2command
- Repository: https://github.com/iobroker/iobroker.text2command

## Overview

text2command is an ioBroker adapter that turns incoming natural-language commands into configured rule actions, smart-device control, or informational answers. Its principal flow starts with text submitted through an ioBroker state or message, matches rules, dispatches a command handler, and returns a response. The repository also includes an admin interface for configuring rules and settings. Relationships are limited to calls and references shown in excerpts or explicitly documented in the README; unsampled command-handler details are represented as a subsystem rather than inferred pipelines.

Main entry points: [`src/main.ts`](https://github.com/iobroker/iobroker.text2command/blob/master/src/main.ts) (Adapter entry), [`src/lib/simpleAnswers.ts`](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/simpleAnswers.ts) (Answer generation), [`src/lib/devicesControl.ts`](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/devicesControl.ts) (Device control), [`src-admin/src/components/Layout.jsx`](https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/Layout.jsx) (Rule management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Text interaction"]
end

subgraph group_runtime["Adapter runtime"]
  node_main["Adapter entry<br/>[main.ts]"]
  node_types["Rule types<br/>[types.ts]"]
end

subgraph group_domain["Command domain"]
  node_matcher["Rule matching<br/>[langModel.ts]"]
  node_handlers["Command handlers<br/>[main.ts]"]
  node_device["Device control<br/>[devicesControl.ts]"]
  node_simple["Simple commands<br/>[simpleControl.ts]"]
  node_answers["Answer generation<br/>[simpleAnswers.ts]"]
  node_format["Value formatting<br/>[formatProvider.ts]"]
  node_functions["Function names<br/>[functions.ts]"]
  node_rooms["Room names<br/>[rooms.ts]"]
end

subgraph group_admin["Admin configuration"]
  node_app["Admin application<br/>[App.tsx]"]
  node_layout["Rule management<br/>[Layout.jsx]"]
  node_drawer["Rule navigation<br/>[Drawer.jsx]"]
  node_rule["Rule display<br/>[Rule.jsx]"]
  node_editor["Rule editor<br/>[RuleEditor.jsx]"]
  node_create["Rule creation"]
  node_settings["Settings dialog<br/>[SettingsDialog.jsx]"]
end

node_user(("Text client"))
node_broker[("ioBroker")]

node_user -->|"submits text"| node_main
node_main -->|"reads enums"| node_broker
node_main -->|"matches rules"| node_matcher
node_main -->|"dispatches commands"| node_handlers
node_handlers -->|"controls devices"| node_device
node_handlers -->|"runs commands"| node_simple
node_main -->|"reports errors"| node_answers
node_device -->|"uses room terms"| node_rooms
node_device -->|"uses function terms"| node_functions
node_device -->|"generates replies"| node_answers
node_simple -->|"generates replies"| node_answers
node_simple -->|"formats values"| node_format
node_answers -->|"uses function names"| node_functions
node_answers -->|"uses room names"| node_rooms
node_app -->|"renders layout"| node_layout
node_layout -->|"renders drawer"| node_drawer
node_layout -->|"uses editor"| node_editor
node_layout -->|"uses creation dialog"| node_create
node_drawer -->|"renders rules"| node_rule
node_drawer -->|"opens settings"| node_settings

click node_main "https://github.com/iobroker/iobroker.text2command/blob/master/src/main.ts"
click node_matcher "https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/langModel.ts"
click node_handlers "https://github.com/iobroker/iobroker.text2command/blob/master/src/main.ts"
click node_device "https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/devicesControl.ts"
click node_simple "https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/simpleControl.ts"
click node_answers "https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/simpleAnswers.ts"
click node_format "https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/formatProvider.ts"
click node_functions "https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/functions.ts"
click node_rooms "https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/rooms.ts"
click node_types "https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/types.ts"
click node_app "https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/App.tsx"
click node_layout "https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/Layout.jsx"
click node_drawer "https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/Drawer.jsx"
click node_rule "https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/Rule.jsx"
click node_editor "https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/RuleEditor.jsx"
click node_create "https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/CreateRuleDialog.jsx"
click node_settings "https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/SettingsDialog.jsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_types,node_broker toneAmber
class node_matcher,node_handlers,node_device,node_simple,node_answers,node_format,node_functions,node_rooms toneMint
class node_app,node_layout,node_drawer,node_rule,node_editor,node_create,node_settings toneRose
class node_user toneBlue
```

## Components

### Adapter runtime

- [Adapter entry](https://github.com/iobroker/iobroker.text2command/blob/master/src/main.ts): `src/main.ts`
- [Rule types](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/types.ts): `src/lib/types.ts`

### Command domain

- [Rule matching](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/langModel.ts): `src/lib/langModel.ts`
- [Command handlers](https://github.com/iobroker/iobroker.text2command/blob/master/src/main.ts): `src/main.ts`
- [Device control](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/devicesControl.ts): `src/lib/devicesControl.ts`
- [Simple commands](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/simpleControl.ts): `src/lib/simpleControl.ts`
- [Answer generation](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/simpleAnswers.ts): `src/lib/simpleAnswers.ts`
- [Value formatting](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/formatProvider.ts): `src/lib/formatProvider.ts`
- [Function names](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/functions.ts): `src/lib/functions.ts`
- [Room names](https://github.com/iobroker/iobroker.text2command/blob/master/src/lib/rooms.ts): `src/lib/rooms.ts`

### Admin configuration

- [Admin application](https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/App.tsx): `src-admin/src/App.tsx`
- [Rule management](https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/Layout.jsx): `src-admin/src/components/Layout.jsx`
- [Rule navigation](https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/Drawer.jsx): `src-admin/src/components/Drawer.jsx`
- [Rule display](https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/Rule.jsx): `src-admin/src/components/Rule.jsx`
- [Rule editor](https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/RuleEditor.jsx): `src-admin/src/components/RuleEditor.jsx`
- [Rule creation](https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/CreateRuleDialog.jsx): `src-admin/src/components/CreateRuleDialog.jsx`
- [Settings dialog](https://github.com/iobroker/iobroker.text2command/blob/master/src-admin/src/components/SettingsDialog.jsx): `src-admin/src/components/SettingsDialog.jsx`

### Other components

- **Text client**
- **ioBroker**

## Connections

- Text client → Adapter entry: submits text (evidence: `README.md`)
- Adapter entry → ioBroker: reads enums (evidence: `src/main.ts`)
- Adapter entry → Rule matching: matches rules (evidence: `src/main.ts`)
- Adapter entry → Command handlers: dispatches commands (evidence: `src/main.ts`)
- Command handlers → Device control: controls devices (evidence: `src/main.ts`)
- Command handlers → Simple commands: runs commands (evidence: `src/main.ts`)
- Adapter entry → Answer generation: reports errors (evidence: `src/main.ts`)
- Device control → Room names: uses room terms (evidence: `src/lib/devicesControl.ts`)
- Device control → Function names: uses function terms (evidence: `src/lib/devicesControl.ts`)
- Device control → Answer generation: generates replies (evidence: `src/lib/devicesControl.ts`)
- Simple commands → Answer generation: generates replies (evidence: `src/lib/simpleControl.ts`)
- Simple commands → Value formatting: formats values (evidence: `src/lib/simpleControl.ts`)
- Answer generation → Function names: uses function names (evidence: `src/lib/simpleAnswers.ts`)
- Answer generation → Room names: uses room names (evidence: `src/lib/simpleAnswers.ts`)
- Admin application → Rule management: renders layout (evidence: `src-admin/src/App.tsx`)
- Rule management → Rule navigation: renders drawer (evidence: `src-admin/src/components/Layout.jsx`)
- Rule management → Rule editor: uses editor (evidence: `src-admin/src/components/Layout.jsx`)
- Rule management → Rule creation: uses creation dialog (evidence: `src-admin/src/components/Layout.jsx`)
- Rule navigation → Rule display: renders rules (evidence: `src-admin/src/components/Drawer.jsx`)
- Rule navigation → Settings dialog: opens settings (evidence: `src-admin/src/components/Drawer.jsx`)
