How alexxit/sonofflan works
SonoffLAN is a Home Assistant integration for controlling eWeLink/Sonoff devices through LAN, cloud, or both. The principal workflow configures an account and connection mode, obtains the device catalogue, maps device models and parameters to Home Assistant entities, then exchanges commands and state updates with devices. The README also documents multi-account/home support, diagnostics, custom entity classes, RF Bridge, and camera control. Some platform setup and service wiring are not shown in the sampled source; those links are limited to README claims or explicit calls.
Main entry points: ewelink/__init__.py eWeLink registry · devices.py Device specifications · sonoff/__init__.py Integration lifecycle · cloud.py Cloud transport
Components 21
Setup and mapping
- Config flow
custom_components/sonoff/config_flow.py - Integration lifecycle
custom_components/sonoff/__init__.py - Device specifications
custom_components/sonoff/core/devices.py - Entity base
custom_components/sonoff/core/entity.py
Device runtime
- eWeLink registry
custom_components/sonoff/core/ewelink/__init__.py - Cloud transport
custom_components/sonoff/core/ewelink/cloud.py - LAN transport
custom_components/sonoff/core/ewelink/local.py
Home Assistant entities
- Switch and button
custom_components/sonoff/switch.py - Light entities
custom_components/sonoff/light.py - Sensor entities
custom_components/sonoff/sensor.py - Climate entities
custom_components/sonoff/climate.py - Cover entities
custom_components/sonoff/cover.py - Other entity platforms
custom_components/sonoff
Special capabilities
- Camera protocol
custom_components/sonoff/core/ewelink/camera.py - Diagnostics
custom_components/sonoff/diagnostics.py - System health
custom_components/sonoff/system_health.py - RF Bridge support
custom_components/sonoff/remote.py
Other components
- Home Assistant user
- Home Assistant
- eWeLink service
- Sonoff devices
Connections 41
- Home Assistant user → Config flow: configures
- Config flow → Integration lifecycle: creates entry
- Home Assistant → Integration lifecycle: starts integration
- Integration lifecycle → eWeLink registry: starts registry
- eWeLink registry → Cloud transport: uses cloud
- eWeLink registry → LAN transport: uses LAN
- Cloud transport → eWeLink service: authenticates and fetches
- Cloud transport → eWeLink service: sends commands
- LAN transport → Sonoff devices: discovers and commands
- Sonoff devices → LAN transport: reports state
- eWeLink service → Cloud transport: reports state
- Cloud transport → eWeLink registry: dispatches updates
- LAN transport → eWeLink registry: dispatches updates
- eWeLink registry → Device specifications: selects classes
- eWeLink registry → Entity base: creates entities
- Device specifications → Switch and button: maps devices
- Device specifications → Light entities: maps devices
- Device specifications → Sensor entities: maps devices
- Device specifications → Climate entities: maps devices
- Device specifications → Cover entities: maps devices
- Device specifications → Other entity platforms: maps devices
- Home Assistant → Switch and button: exposes controls
- Home Assistant → Light entities: exposes controls
- Home Assistant → Sensor entities: exposes readings
- Home Assistant → Climate entities: exposes controls
- Home Assistant → Cover entities: exposes controls
- Home Assistant → Other entity platforms: exposes entities
- Switch and button → eWeLink registry: sends commands
- Light entities → eWeLink registry: sends commands
- Climate entities → eWeLink registry: sends commands
- Cover entities → eWeLink registry: sends commands
- eWeLink registry → Switch and button: dispatches state
- eWeLink registry → Light entities: dispatches state
- eWeLink registry → Sensor entities: dispatches state
- eWeLink registry → Climate entities: dispatches state
- eWeLink registry → Cover entities: dispatches state
- Integration lifecycle → Camera protocol: initializes on demand
- Integration lifecycle → RF Bridge support: registers command service
- Home Assistant user → Diagnostics: requests report
- Home Assistant → Diagnostics: provides device data
- Home Assistant → System health: requests status