esphome / esphome/feature-requests

Rest Api "GET /states" call

Open
#1,455 1 comment 3 reactions 0 assignees View on GitHub
component: web_server
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

A new Rest API call "GET /states" that enumerates over all current states and returns the result as a JSON array (or a JSON object with "id" as keys) whould be very useful.

I could be just a variant of "/events" that returns all states in one json datastructure and doesn't keep the connection open when finished.

**Please describe your use case for this integration and alternatives you've tried:**

Two use cases would be:

- easy monitoring: monitoring solutions like Zabbix could poll the device state with one call and use automatic sensor discovery. Currently monitoring different states on one device requires multiple calls and the sensor IDs have to be hardcoded in the monitoring system.

- quick console overview: when developing new automations, getting the state of a device using something like:
```python:
curl -s http://devname/states | python3 -m json.tool
```
... would be really useful.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing /events endpoint, then trace the API entry point that handles it. The work is done when GET /states returns all current states in one JSON structure and closes the connection after responding.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.