Skip to content

feat: Replace /manage HTML scraping with REST API (v1.3.0) - #13

Merged
loryanstrant merged 1 commit into
mainfrom
feature/use-api-instead-of-html-scraping
May 15, 2026
Merged

feat: Replace /manage HTML scraping with REST API (v1.3.0)#13
loryanstrant merged 1 commit into
mainfrom
feature/use-api-instead-of-html-scraping

Conversation

@loryanstrant

@loryanstrant loryanstrant commented May 15, 2026

Copy link
Copy Markdown
Owner

Problem

The /manage page was removed in LocalAI v4.x, causing the following error to repeat every poll cycle:

No models found in /manage page - HTML structure may have changed

This was tracked upstream in LocalAI issue #9207 and addressed in LocalAI PR #9411.

Solution

Replace the HTML scraping approach with the stable REST API:

Previously (broken) Now (v1.3.0)
Scraped /manage HTML page for model names, status, backend, use cases Uses /system endpoint's loaded_models field for running status
Used custom ModelTableParser (HTMLParser subclass) Pure JSON REST API calls

Changes

  • Removed ModelTableParser HTML parser class (~65 lines of fragile HTML parsing code)
  • Removed /manage page fetch from the coordinator update loop
  • Running Models sensor: Now reads loaded_models from /system endpoint instead of the HTML table's status column
  • Models sensor: Enriches each model with Running/Idle status using the same loaded_models data
  • Version sensor: Already used /version endpoint — no change needed
  • Bump version: 1.2.01.3.0 in manifest.json
  • README: Updated to document LocalAI v4.2.0+ requirement and explain the migration from /manage page

Testing

Validated against LocalAI v4.2.4:

Sensor Value
Installed Backends 26
Installed Models 23
Running Models 1 (correctly identified loaded model)
Model Jobs 0
Resources 61.17%
System online
Version v4.2.4 (42a8db35...)

All 7 entities loaded successfully in a dev Home Assistant instance with no errors.

Breaking Change

This integration version (v1.3.0+) requires LocalAI v4.2.0 or newer. If running an older LocalAI version, use integration v1.2.0 or earlier.

The /manage page was removed in LocalAI v4.x. This commit updates the
integration to use the stable REST API instead:

- Remove ModelTableParser HTML scraping class and /manage page fetching
- Model running/idle status now determined via /system endpoint's
  loaded_models field
- Version sensor reads from /version endpoint
- All endpoints (/v1/models, /backends, /system, /resources, /version,
  /models/jobs) are stable REST APIs available in LocalAI v4.2.0+
- Bump integration version to 1.3.0
- Update README to document LocalAI v4.2.0+ requirement

Tested against LocalAI v4.2.4 with 23 models, 26 backends, running
model detection via loaded_models working correctly.

Fixes the recurring error: 'No models found in /manage page - HTML
structure may have changed'
Copilot AI review requested due to automatic review settings May 15, 2026 00:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the now-removed /manage HTML scraping with the stable /system REST endpoint to determine running model status, restoring functionality against LocalAI v4.x and bumping the integration to v1.3.0.

Changes:

  • Removes ModelTableParser and the _fetch_model_details HTML parsing path from the coordinator.
  • Updates the Models sensor to derive Running/Idle status from loaded_models in the /system response.
  • Bumps manifest.json to 1.3.0 and updates README to document the LocalAI v4.2.0+ requirement and migration.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
custom_components/localai_monitor/coordinator.py Removes the ModelTableParser class and /manage HTML fetch/parse logic.
custom_components/localai_monitor/sensor.py Replaces HTML-derived model details with running status pulled from /system loaded_models.
custom_components/localai_monitor/manifest.json Bumps integration version to 1.3.0.
README.md Documents new LocalAI v4.2.0+ requirement, removes references to scraped attributes, and adds a Compatibility section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@loryanstrant
loryanstrant merged commit 418e32c into main May 15, 2026
8 checks passed
@loryanstrant
loryanstrant deleted the feature/use-api-instead-of-html-scraping branch May 15, 2026 00:37
loryanstrant pushed a commit that referenced this pull request Jun 9, 2026
…onical main (for v1.4.0)' (#2) from feat/incorporate-pr13-rest-api into main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants