Skip to main content

Python library for controlling Icom transceivers over LAN (UDP) — no wfview/hamlib required

Project description

icom-lan

Python 3.11+ License: MIT Tests

Python library for controlling Icom transceivers over LAN (UDP).

Direct connection to your radio — no wfview, hamlib, or RS-BA1 required.

Features

  • 📡 Direct UDP connection — no intermediate software needed
  • 🎛️ Full CI-V command set — frequency, mode, filter, power, meters, PTT, CW keying, VFO, split, ATT, PREAMP
  • 🔍 Network discovery — find radios on your LAN automatically
  • 💻 CLI toolicom-lan status, icom-lan freq 14.074m
  • Async API — built on asyncio for seamless integration
  • 🚀 Fast non-audio connect path — CLI/status calls don't block on audio-port negotiation
  • 🧠 Commander queue — wfview-style serialized command execution with pacing, retries, and dedupe
  • 🔒 Zero dependencies — pure Python, stdlib only
  • 📝 Type-annotated — full py.typed support

Supported Radios

Radio Status CI-V Address
IC-7610 ✅ Tested 0x98
IC-705 Should work 0xA4
IC-7300 Should work 0x94
IC-9700 Should work 0xA2
IC-7851 Should work 0x8E
IC-R8600 Should work 0x96

Any Icom radio with LAN/WiFi control should work — the CI-V address is configurable.

Installation

pip install icom-lan

From source:

git clone https://github.com/morozsm/icom-lan.git
cd icom-lan
pip install -e .

Quick Start

Python API

import asyncio
from icom_lan import IcomRadio

async def main():
    async with IcomRadio("192.168.1.100", username="user", password="pass") as radio:
        # Read current state
        freq = await radio.get_frequency()
        mode = await radio.get_mode()
        s = await radio.get_s_meter()
        print(f"{freq/1e6:.3f} MHz  {mode.name}  S={s}")

        # Tune to 20m FT8
        await radio.set_frequency(14_074_000)
        await radio.set_mode("USB")

        # VFO & Split
        await radio.select_vfo("MAIN")
        await radio.set_split_mode(True)

        # CW
        await radio.send_cw_text("CQ CQ DE KN4KYD K")

asyncio.run(main())

CLI

# Set credentials via environment
export ICOM_HOST=192.168.1.100
export ICOM_USER=myuser
export ICOM_PASS=mypass

# Radio status
icom-lan status

# Frequency (multiple input formats)
icom-lan freq             # Get
icom-lan freq 14.074m     # Set (MHz)
icom-lan freq 7074k       # Set (kHz)
icom-lan freq 14074000    # Set (Hz)

# Mode
icom-lan mode USB

# Meters (JSON output)
icom-lan meter --json

# CW keying
icom-lan cw "CQ CQ DE KN4KYD K"

# PTT
icom-lan ptt on
icom-lan ptt off

# Discover radios on network
icom-lan discover

API Reference

IcomRadio Methods

Method Description
get_frequency()int Current frequency in Hz
set_frequency(hz) Set frequency
get_mode()Mode Current mode
get_mode_info()(Mode, filter) Current mode + filter number (if reported)
set_mode(mode, filter_width=None) Set mode (optionally with filter 1-3)
get_filter() / set_filter(n) Read/set filter number
get_power()int RF power level (0–255)
set_power(level) Set RF power
get_s_meter()int S-meter (0–255)
get_swr()int SWR meter (0–255, TX only)
get_alc()int ALC meter (0–255, TX only)
set_ptt(on) Push-to-talk on/off
select_vfo(vfo) Select VFO (A/B/MAIN/SUB)
set_split_mode(on) Split on/off
get_attenuator() / set_attenuator(on) Read/set attenuator
get_preamp() / set_preamp(level) Read/set preamp (0/1/2)
send_cw_text(text) / stop_cw_text() Send/stop CW via built-in keyer
power_control(on) Remote power on/off
snapshot_state() / restore_state(state) Best-effort state save/restore
send_civ(cmd, sub, data) Send raw CI-V command

Configuration

Parameter Default Env Var Description
host ICOM_HOST Radio IP address
port 50001 ICOM_PORT Control port
username "" ICOM_USER Auth username
password "" ICOM_PASS Auth password
radio_addr 0x98 CI-V address
timeout 5.0 Timeout (seconds)

How It Works

The library implements the Icom proprietary LAN protocol:

  1. Control port (50001) — UDP handshake, authentication, session management
  2. CI-V port (50002) — CI-V command exchange
  3. Audio port (50003) — RX/TX audio streaming (including full-duplex orchestration)
Discovery → Login → Token → Conninfo → CI-V Open → Commands

See the protocol documentation for a deep dive.

Testing

# Unit tests (no radio required)
pytest tests/test_*.py

# Integration tests (real radio required)
export ICOM_HOST=192.168.55.40
export ICOM_USER=your_username
export ICOM_PASS=your_password
pytest -m integration tests/integration

# Guarded power-cycle test (will actually power off/on radio)
export ICOM_ALLOW_POWER_CONTROL=1
pytest -m integration tests/integration/test_radio_integration.py::TestPowerHardware::test_power_cycle_roundtrip -q -s

# Soak test (seconds)
export ICOM_SOAK_SECONDS=120
pytest -m integration tests/integration/test_radio_integration.py::TestSoak::test_soak_retries_and_logging -q -s

Documentation

📖 Full documentation: morozsm.github.io/icom-lan

Security

  • Zero external dependencies — minimal attack surface
  • Credentials passed via env vars or parameters, never stored
  • The Icom protocol uses UDP without encryption — see SECURITY.md

License

MIT — see LICENSE.

Protocol knowledge based on wfview (GPLv3) reverse engineering. This is an independent clean-room implementation, not a derivative work.

Acknowledgments

  • The wfview project for their extensive reverse engineering of the Icom LAN protocol
  • The amateur radio community for testing and feedback

Trademark Notice

Icom™ and the Icom logo are registered trademarks of Icom Incorporated. This project is not affiliated with, endorsed by, or sponsored by Icom. Product names are used solely for identification and compatibility purposes (nominative fair use).


73 de KN4KYD 🏗️

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

icom_lan-0.4.0.tar.gz (973.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

icom_lan-0.4.0-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

Details for the file icom_lan-0.4.0.tar.gz.

File metadata

  • Download URL: icom_lan-0.4.0.tar.gz
  • Upload date:
  • Size: 973.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for icom_lan-0.4.0.tar.gz
Algorithm Hash digest
SHA256 fba0fe225a26a5851f37815644136559fd28d61b582ac0ab19f86a8cde0ece8f
MD5 784e7b37a8f7f26dec73ea0734aba8ae
BLAKE2b-256 5f551023bae8e34fba636e4efe641cab6ac929e10eb9cd7d827870eece0c3123

See more details on using hashes here.

File details

Details for the file icom_lan-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: icom_lan-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 42.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for icom_lan-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d54aaeb3b49d197cefb529db76361844d68405be8cdf855a1c63f5b84d542a9f
MD5 b807a52566ec4361b14c276c2d390e28
BLAKE2b-256 8d97aa48842a7e22545beff346d3e7600d491c3eef5f56663394bd320898316d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page