Skip to content

Instantly share code, notes, and snippets.

@meee1
Created October 15, 2025 02:08
Show Gist options
  • Select an option

  • Save meee1/a971e73bb4dc529921c205ad5cd2affc to your computer and use it in GitHub Desktop.

Select an option

Save meee1/a971e73bb4dc529921c205ad5cd2affc to your computer and use it in GitHub Desktop.
HA entity counts
SELECT m.entity_id, COUNT(*) as count FROM states AS S
INNER JOIN states_meta AS M ON M.metadata_id = s.metadata_id
GROUP BY m.entity_id ORDER BY count DESC LIMIT 20;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment