Skip to content

mtojek/buzzard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

buzzard

buzzard is a small Rust tool for discovering devices on a local network and talking to selected home/lab devices through a few protocol-specific drivers.

Right now the repo covers three main jobs:

  • scan a LAN and keep a local device state file,
  • address known devices by name and query/control them through driver backends.
  • expose the same device controls through a small built-in web UI.

What It Does

buzzard can:

  • scan a subnet with ICMP and MAC lookup,
  • map scanned MAC addresses to friendly names from inventory.yaml,
  • persist discovered devices in _state.yaml,
  • talk to supported devices by logical name instead of hard-coded IPs,
  • serve an HTMX-based web UI for status and control.

Currently implemented device families:

  • tuya / me82 for thermostats,
  • tuya / atorch for the ATORCH power meter,
  • midea / ac for Midea AC units,
  • openbeken / smart_plug for OpenBeken-based plugs/switches,
  • dahua / camera for Dahua snapshots.

Repository Layout

  • src/cli CLI command handling for scan, devices, and web.
  • src/network ICMP scanning, MAC lookup, vendor lookup.
  • src/inventory YAML inventory loading.
  • src/state.rs _state.yaml loading/saving.
  • src/devices Driver-specific device integrations.
  • src/web Built-in HTMX web UI.

Files

Two local YAML files are important:

  • inventory.yaml Your private inventory/config file. It is gitignored.
  • _state.yaml Last known scan results. It is gitignored.

The scan flow is:

  1. probe the subnet,
  2. discover IP and MAC,
  3. match MAC against inventory.yaml,
  4. update _state.yaml.

_state.yaml is meant to preserve last-known devices, even if a device disappears from a later scan.

Inventory Format

Minimal unmanaged device:

devices:
  - name: device-1
    mac: "aa:bb:cc:dd:ee:ff"

Tuya thermostat:

devices:
  - name: thermostat-1
    mac: "aa:bb:cc:dd:ee:01"
    driver: tuya
    device_type: me82
    tuya:
      id: "..."
      local_key: "..."
      version: "3.4"

Midea AC:

devices:
  - name: ac-1
    mac: "aa:bb:cc:dd:ee:02"
    driver: midea
    device_type: ac
    midea:
      id: "..."
      token: "..."
      key: "..."
      port: 6444

OpenBeken smart plug:

devices:
  - name: plug-1
    mac: "aa:bb:cc:dd:ee:03"
    driver: openbeken
    device_type: smart_plug

Dahua camera:

devices:
  - name: camera-1
    mac: "aa:bb:cc:dd:ee:04"
    driver: dahua
    device_type: camera
    dahua:
      nvh_host: "https://nvr-host.local"
      channel: 5
      username: "admin"
      password: "..."

Usage

Build:

cargo build

Run a scan:

target/debug/buzzard scan

Run a scan with verbose diagnostics:

target/debug/buzzard scan --debug

Control/query devices by name:

target/debug/buzzard devices thermostat-1 status
target/debug/buzzard devices thermostat-1 on
target/debug/buzzard devices thermostat-1 off
target/debug/buzzard devices thermostat-1 set temp 21

target/debug/buzzard devices ac-1 status
target/debug/buzzard devices ac-1 on
target/debug/buzzard devices ac-1 off
target/debug/buzzard devices ac-1 set temp 21
target/debug/buzzard devices ac-1 set fan silent
target/debug/buzzard devices ac-1 set swing horizontal

target/debug/buzzard devices meter-1 status
target/debug/buzzard devices meter-1 on
target/debug/buzzard devices meter-1 off

target/debug/buzzard devices plug-1 status
target/debug/buzzard devices plug-1 on
target/debug/buzzard devices plug-1 off

target/debug/buzzard devices camera-1 status
target/debug/buzzard devices camera-1 snapshot

Wildcard device selection is supported:

target/debug/buzzard devices "thermostat-*" status
target/debug/buzzard devices "thermostat-*" set temp 20

Run the web UI:

target/debug/buzzard web

Default bind:

0.0.0.0:8666

Command Notes

devices status output depends on device type:

  • thermostats are shown in a thermostat-oriented table,
  • AC units are shown in an AC-oriented table,
  • ATORCH is shown as a power/energy meter table,
  • OpenBeken smart plugs are shown as a plug/power telemetry table,
  • cameras are shown as snapshot URLs in CLI and images in the web UI.

Not every driver supports every command. For example:

  • me82 supports status, on, off, set temp, debug,
  • midea/ac supports status, on, off, set temp, set fan, set swing,
  • atorch supports status, on, off, debug,
  • openbeken/smart_plug supports status, on, off,
  • dahua/camera supports status and snapshot.

Requirements

  • Rust toolchain,
  • local network access,
  • permissions to use raw ICMP for scanning.

In practice scan usually needs elevated privileges:

sudo target/debug/buzzard scan

On Linux, you can usually avoid sudo by giving the built binary CAP_NET_RAW:

sudo setcap cap_net_raw+ep target/debug/buzzard
getcap target/debug/buzzard

There is a short note about this in scripts/README.md, together with the musl cross-build helper.

Device control commands usually do not need raw-socket privileges, but they do need the target device to be reachable on the LAN.

Status

This is a personal/home-lab style tool, not a polished general-purpose product.

The repo is optimized for:

  • local inventory-driven naming,
  • practical device control,
  • fast iteration over protocols used in one network.

About

Self-hosted network inventory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors