Skip to content

andlo/ha-meshcentral

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MeshCentral integration for Home Assistant

hacs_badgeGitHub releaseLicense

Home Assistant custom integration for MeshCentral — the open-source remote management platform.

MeshCentral integration in Home Assistant showing 8 devices

What is MeshCentral?

MeshCentral is a free, open-source remote device management platform you can self-host on your own server. It lets you remotely monitor, manage and control computers and devices — Windows, Linux, and macOS — from a single web interface. Think of it as your own private TeamViewer or AnyDesk, without subscriptions or cloud dependency.

Why MeshCentral + Home Assistant?

Running MeshCentral alongside Home Assistant is a powerful combination for anyone who wants full control over their home network:

  • See all your devices in one place — PC online/offline status, OS info, last boot time, and logged-in users appear as native HA entities alongside your lights, sensors, and other smart home devices.
  • Automate around your computers — trigger automations when a PC comes online (start casting music, turn on the desk lamp), or when it goes offline (cut power to peripherals via a smart plug).
  • Power control from HA — wake, reboot, sleep, hibernate or shut down any managed device via HA buttons or automations. Wake-on-LAN works even across subnets since MeshCentral relays the magic packet through its agents.
  • Security monitoring — Windows Defender, firewall and antivirus status exposed as binary sensors. Get notified if real-time protection goes offline.
  • Hardware insight — CPU, GPU, RAM, disk usage and more available as optional sensors, updated every 5 minutes.
  • Real-time push — the integration uses MeshCentral's WebSocket API for instant online/offline updates, not slow polling.

PC devices visible in Home Assistant dashboard

Features

Per device — Status sensors

EntityDescriptionbinary_sensor.<n>_onlineAgent connectivity (online/offline) — real-timesensor.<n>_osOS descriptionsensor.<n>_ip_addressLast known IP addresssensor.<n>_last_bootLast boot time (timestamp)sensor.<n>_idle_timeUser idle time in secondssensor.<n>_active_usersCurrently logged-in userssensor.<n>_descriptionDevice description from MeshCentralsensor.<n>_agent_last_seenWhen agent last contacted serverdevice_tracker.<n>_trackerHome/not_home based on agent connectivity

Per device — Security (Windows only)

EntityDescriptionbinary_sensor.<n>_antivirus_okAntivirus statusbinary_sensor.<n>_firewall_okFirewall statusbinary_sensor.<n>_defender_real_time_protectionWindows Defender real-time protection

Per device — Power control

EntityDescriptionbutton.<n>_rebootReboot devicebutton.<n>_shutdownShut down devicebutton.<n>_sleepSleep (Windows only)button.<n>_hibernateHibernate (Windows only)button.<n>_wake_on_lanWake-on-LAN via MeshCentral agents

Wake-on-LAN works even without direct network access — MeshCentral automatically finds online agents on the same network and uses them to broadcast the magic packet.

Per device — Hardware detail sensors (disabled by default)

These sensors are fetched every 5 minutes via a separate getsysinfo call. They are disabled by default — enable them individually under Settings → Devices & Services → MeshCentral → device → Entities.

All platforms:

EntityDescriptionsensor.<n>_cpuCPU model namesensor.<n>_gpuGPU model namesensor.<n>_bios_versionBIOS version (vendor + date as attributes)sensor.<n>_motherboardMotherboard model (vendor as attribute)

Windows only:

EntityDescriptionsensor.<n>_ram_totalTotal RAM in GBsensor.<n>_disk_c_totalC: drive total size in GBsensor.<n>_disk_c_freeC: drive free space in GBsensor.<n>_disk_c_free_percentC: drive free space in %sensor.<n>_running_processesNumber of running processessensor.<n>_screen_resolutionCurrent screen resolution (e.g. 1920x1080)

Linux only:

EntityDescriptionsensor.<n>_disk_usedRoot filesystem used in MBsensor.<n>_disk_freeRoot filesystem free in MB

Service

ServiceDescriptionmeshcentral.run_commandRun a shell command on any online device

Installation

Via HACS (recommended)

  1. Open HACS → Integrations → ⋮ → Custom repositories
  2. Add https://github.com/andlo/ha-meshcentral — category: Integration
  3. Install MeshCentral and restart Home Assistant

Manual

Copy custom_components/meshcentral/ into your HA custom_components/ directory and restart.

Lovelace card

A custom card is included in the www/ folder. Add it as a resource and use it in your dashboards.

Add as resource — Settings → Dashboards → Resources → Add resource:

  • URL: /local/meshcentral-card.js
  • Type: JavaScript module

Copy the card file to HA:

cp www/meshcentral-card.js /config/www/

Card configuration:

type: custom:meshcentral-card
title: My Computers
devices:
  - fedora
  - ASUS-GamerPC
  - ASRock

The card shows online/offline status, OS, IP, logged-in users, last boot, security badges, and hardware info (CPU, RAM, disk) for each device — if the hardware sensors are enabled.

Configuration

Go to Settings → Devices & Services → Add Integration → MeshCentral and enter:

Field Description
Host IP or hostname of your MeshCentral server
Port Default: 443
Username MeshCentral username
Password MeshCentral password
Login Key Server-level LoginKey for 3FA — leave empty if not used (see below)
Use SSL Enable for HTTPS/WSS (default: off)
Verify SSL Disable if using self-signed cert (default: off)

2FA accounts

If your account has two-factor authentication enabled, create a Login Token in MeshCentral → My Account → Login Tokens. Use the generated username (~t:...) and password as credentials in HA — this bypasses 2FA entirely.

LoginKey (3FA) — server-level access key

Some MeshCentral servers are configured with a LoginKey in config.json. This is a server-level 3FA feature that requires all requests — including the login page itself — to include a ?key=<value> query parameter. Without it, the server blocks access before any authentication can occur.

If your server uses this, you will see an auth failure even with correct username and password. Enter the LoginKey value in the Login Key field during setup.

LoginKey vs Login Token — these are two different things:

What it is Where to find it Used as
Login Key (3FA) Server-level URL access key config.json → run server with --logintokenkey The Login Key field in this integration
Login Token (2FA bypass) Per-user temporary token MeshCentral → My Account → Login Tokens The Username field (as ~t:...)

You may need both at the same time if your server uses LoginKey AND your account has 2FA enabled.

TLS offload / reverse proxy

If MeshCentral runs behind a reverse proxy (Nginx, Cloudflare Tunnel) with tlsOffload: true, set Use SSL = off and point directly at the internal plain HTTP port — even if that port is 443. The server accepts plain HTTP/WS on that port while the proxy handles TLS externally.

How it works

The integration uses two mechanisms in parallel:

  • Real-time WebSocket push — a persistent connection to MeshCentral's /control.ashx endpoint receives nodeconnect events the moment a device goes online or offline. Online/offline status updates are instant.
  • Polling fallback — a full device list refresh runs every 5 minutes to ensure nothing is missed if the WebSocket drops an event.
  • Hardware data — a separate getsysinfo call runs every 5 minutes for each online device to update the hardware detail sensors.

Automation examples

# Turn on desk lamp when PC comes online
automation:
  trigger:
    platform: state
    entity_id: binary_sensor.fedora_online
    to: "on"
  action:
    service: light.turn_on
    target:
      entity_id: light.desk_lamp

# Alert if Windows Defender is disabled
automation:
  trigger:
    platform: state
    entity_id: binary_sensor.asus_gamerpc_defender_real_time_protection
    to: "off"
  action:
    service: notify.mobile_app
    data:
      message: "⚠️ Windows Defender disabled on ASUS-GamerPC!"

# Run a command on a device
service: meshcentral.run_command
data:
  device_id: fedora
  command: "systemctl restart nginx"

Related

License

MIT

About

Home Assistant integration for MeshCentral — monitor and control your PCs and devices directly from HA. Real-time online/offline, power control, Wake-on-LAN, Windows security sensors.

Topics

Resources

License

Stars

6 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors