Device Discovery & Control

How devices are found, configured, and controlled

Discovery Methods

SmartyHome OS uses a hybrid discovery system that finds devices through multiple channels simultaneously:

1. Cloud Devices (MQTT)

After linking your tablet to the cloud, all your SmartyHome cloud devices appear automatically. These devices connect directly to mqtt.smartyhome.in:1883 and sync in real-time.

Cloud devices are identified by their cloud_device_id — a numeric ID assigned when the device was provisioned. You can see this in Device Details.

2. UDP Discovery (Local LAN)

SmartyHome OS broadcasts a discovery packet on your local network every 30 seconds. Compatible devices respond with their identity, capabilities, and IP address.

Discovery packet: SMARTY_DISCOVER_V1
Broadcast to:      255.255.255.255:48899
Frequency:          Every 30 seconds

Supported protocols: HTTP probe, UDP broadcast, mDNS, UPnP — covering Shelly, TP-Link, IKEA, Philips Hue, Sonoff, and custom ESP devices.

3. Manual Add

Go to Discovery → Add Device:

  1. Enter device IP address or MAC
  2. Select device type from template
  3. The system probes the device and adds it

Supported Device Types

CategoryTypesControl Methods
LightsOn/Off, RGBWW, CCT, DimmableToggle, Brightness Slider, Color Wheel
FansSpeed 1-5, OscillatingSpeed Buttons, Toggle
SwitchesRelay, Plug, Wall SwitchON/OFF Toggle
CurtainsMotor, RollerOpen/Close/Stop, Position Slider
DoorbellsSH01DB, SH01DB2Ring Alert, Camera View
SensorsMotion, Door, Temp/HumidityReadings, Alerts, History
IR BlastersIR TX/RXLearn + Send IR Codes
RF 433MHzRF TX/RXLearn + Send RF Codes

ESP32 / ESP8266 Firmware

Flashing ESP32

  1. Download firmware from Downloads
  2. Install esptool: pip install esptool
  3. Connect ESP32 via USB
  4. Erase: esptool.py --chip esp32 erase_flash
  5. Flash: esptool.py --chip esp32 write_flash 0x0 firmware.bin

Provisioning

  1. After flash, ESP opens WiFi AP: SMARTY_WIFI_XXXX
  2. Connect phone to this AP
  3. Open 192.168.4.1 in browser
  4. Enter home WiFi credentials
  5. Device connects to cloud → appears on dashboard

Device Control

Via Dashboard

Via MQTT (Advanced)

# Turn device ON
mosquitto_pub -h mqtt.smartyhome.in -t "devices/25/node/1/command" -m '{"command":"on_off","value":"on"}'

Via REST API (Advanced)

curl -X POST https://api.smartyhome.in/mobile/assistant/devices/25/control \
  -H "Authorization: Bearer TOKEN" \
  -d '{"node_id":1,"command":"on_off","value":"on"}'

Hybrid Device Identity

When the same device exists both locally and in the cloud, the cloud_device_id is the primary key. The system merges: