Skip to content

API returns hardcoded UPS data when no UPS is connected #1825

@jandrop

Description

@jandrop

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions