Skip to main content
Glama
ffleurey

ha-analytics-mcp

by ffleurey

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
HOSTNoHTTP mode only. Non-loopback values require MCP_HTTP_TOKEN.127.0.0.1
PORTNoHTTP mode only.3000
HA_URLYesBase URL of your instance, e.g. https://homeassistant.local:8123.
HA_NAMENoDisplay name used in tool descriptions and responses.Home
HA_TOKENYesHome Assistant long-lived access token.
HA_TIMEZONENoOverrides the timezone reported by Home Assistant.
MAX_RESULTSNoDefault row cap for time-series responses.100
MCP_HTTP_TOKENNoHTTP mode only. Bearer token required on every /mcp request when set.
HA_INSECURE_TLSNoSet to 1 to accept self-signed certificates. Certificates are verified by default.0
CACHE_MAX_ENTRIESNoIn-memory cache size (LRU eviction).500

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{}
resources
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
ha_history_get_current_timeA

Returns the current date and time from the Home Assistant server (Home). Call this before time-based queries that use relative or named periods such as "last month", "this winter", "yesterday", or "recently". Do not rely on your training data to infer the current date — it will often be wrong. Skip only if an absolute ISO date range has already been stated in this conversation.

ha_history_list_areasA

Lists the areas (rooms and locations) defined in Home. Use when the user wants to explore areas or when you need the exact area name for ha_history_list_devices. Narrow by name with search. Returns area names to reuse with area="" in ha_history_list_devices, which also surfaces ready entity_ids.

ha_history_list_devicesA

Lists devices in Home, filtered by area or search. Use area for room-based discovery and search for device or appliance lookup. Returns matched devices together with analytics-ready entity_ids on each device. Use the returned entity_ids directly with the analytics tools. Call ha_history_list_device_entities only when you need deeper per-device inspection.

ha_history_list_device_entitiesA

Lists entities (sensors and controls) on a specific device in Home. Use when ha_history_list_devices did not already surface the needed entity_ids or when you need a deeper per-device inspection. Returns entity_ids with their metric kind and analytics capability. Use measurement sensors with ha_history_get_sensor_stats and cumulative counters with ha_history_get_consumption.

ha_history_list_entitiesA

Primary discovery tool for the exact entity_ids that the ha_history_* analytics tools require. Filter by area, device, device_class, and search. Results are grouped by area and device and include entity_id, name, unit, and type. For one entity's live state, use ha_history_get_state after discovery. Not needed before device-control (Hass*) tools — those take plain names and areas, never entity_ids.

ha_history_get_stateA

Returns the current state of one Home entity by exact entity_id. Works for all entity domains, including entities not exposed to the voice assistant. Returns the state value, unit, last_changed/last_updated timestamps, and key attributes. If a GetLiveContext tool is available, prefer it for current values of exposed entities; use this tool for entities it cannot see, for staleness checks via timestamps, or when the entity_id is already resolved.

ha_history_get_sensor_statsA

Computes statistics for one or more instantaneous-value sensors such as temperature, humidity, CO₂, pressure, illuminance, or power in W. Always pass entity_ids as an array. Prefer one multi-entity call over repeated single-entity calls when units match. Use aggregations for several whole-period stats in one call. Use interval for time series and group_by for repeating patterns. Do not use for cumulative consumption in kWh; use ha_history_get_consumption. Do not use for event counting; use ha_history_detect_sessions.

ha_history_get_consumptionA

Calculates how much energy, water, gas, or other resource was consumed or produced in Home over a time period. Use for totals, interval breakdowns, and period-over-period comparisons of cumulative meters. Always returns consumption (the change over the period), never raw meter readings. Do NOT use for instantaneous sensors (temperature, power in Watts) → use ha_history_get_sensor_stats.

ha_history_detect_sessionsA

Detects activity sessions from a numeric sensor using a power/value threshold. Use for threshold-based activity questions such as charging sessions, appliance runs, or heating cycles. Uses long-term hourly statistics → full date range, no retention limit, ±1h precision. For binary sensors or person/zone state history, use ha_history_get_state_history instead. Returns event count, total duration, a compact session list, or a daily summary with group_by="day".

ha_history_get_state_historyA

Gets the state-change history for any discrete-state entity in Home. Use for binary sensors (motion, door, window, presence), person/device_tracker (zone and location history), and any entity with named states.

Two modes: session mode when state_value is set, timeline mode when it is omitted. Source: HA recorder state history — limited to ~10 days by default. Returns a timeline of transitions, or session counts and durations when state_value is set.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
Areas in HomeAll defined areas (rooms/locations) in Home with device counts. Read when you need the exact area names for room-based discovery.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ffleurey/ha-analytics-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server