unraid / unraid/api

API returns hardcoded UPS data when no UPS is connected

Open
#1,825 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
113
Forks
22
Avg merge
10h 40m
Merged PRs (30d)
13

Description

Description

The GraphQL API returns hardcoded/fake UPS data when querying upsDevices even when no UPS device is actually connected to the system.

Steps to Reproduce

  1. Have apcupsd installed but no UPS device connected
  2. Query the upsDevices GraphQL endpoint

Expected Behavior

The API should return an empty array [] or indicate that no UPS is available.

Actual Behavior

The API returns:

{
  "data": {
    "upsDevices": [
      {
        "id": "ups1",
        "name": "My UPS",
        "model": "APC Back-UPS Pro 1500",
        "status": "COMMLOST",
        "battery": {
          "chargeLevel": 100,
          "estimatedRuntime": 3600,
          "health": "Good"
        },
        "power": {
          "inputVoltage": 120.5,
          "outputVoltage": 120.5,
          "loadPercentage": 25
        }
      }
    ]
  }
}

Impact

Client applications display a phantom UPS card with fake data ("My UPS" / "APC Back-UPS Pro 1500") to users who don't actually have a UPS device connected.

Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by searching the TypeScript GraphQL implementation of the upsDevices endpoint and the integration with apcupsd. Reproduce the no-UPS condition, then trace why the sample values such as "My UPS" are returned. Done means the query returns an empty array or clearly indicates that no UPS is available when no device is connected.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.