Skip to content

Add automatic temperature sensor selection for daemon#90

Open
leonardoman9 wants to merge 1 commit into
strodgers:mainfrom
leonardoman9:auto-temp-daemon
Open

Add automatic temperature sensor selection for daemon#90
leonardoman9 wants to merge 1 commit into
strodgers:mainfrom
leonardoman9:auto-temp-daemon

Conversation

@leonardoman9

Copy link
Copy Markdown
Contributor

Summary

Adds an optional automatic temperature sensor selection mode for the daemon:

epomakercontroller start-daemon --auto-temp

When enabled, the daemon chooses a temperature sensor automatically instead of requiring users to
manually inspect list-temp-devices and pass a key such as coretemp-0.

The selection policy is conservative:

  • prefer CPU/SoC sensors such as coretemp, k10temp, zenpower, cpu_thermal, soc_thermal, acpitz
  • then fall back to other non-GPU sensors
  • use GPU sensors only if no better sensor is available

This avoids choosing NVIDIA/AMD GPU sensors by default, since repeated GPU sensor polling can be more
disruptive on some systems.

Changes

  • Add --auto-temp to start-daemon
  • Add select_temp_device() in utils/sensors.py
  • Mark the automatically selected sensor with * in list-temp-devices
  • Add tests for automatic sensor selection
  • Update README with the new usage
  • Fix formatting in list-temp-devices
  • Resolve default config paths independent of the current working directory
  • Include configs/default.json in package metadata
  • Avoid requiring Pillow unless GIF upload is actually used
  • Prefer the RT100 screen/control HID endpoint when opening devices, with fallback to the previous
    behavior

Example

$ epomakercontroller list-temp-devices
DEVICE KEY CURRENT TEMPERATURE AUTO
coretemp-0 52.0°C *
coretemp-1 48.0°C
coretemp-2 49.0°C

$ epomakercontroller start-daemon --auto-temp

Testing

Tested locally on Arch Linux with an Epomaker RT100 Wired.

MPLBACKEND=Agg python -m pytest

Result:

26 passed, 2 warnings in 10.51s

Warnings observed:

  • python-dateutil deprecation warning for utcfromtimestamp
  • Matplotlib FigureCanvasAgg is non-interactive warning in tests/
    test_main.py::test_read_and_decode_bytes

Manual checks:

epomakercontroller send-time
epomakercontroller list-temp-devices
epomakercontroller start-daemon coretemp-0

@kbrddestroyer kbrddestroyer self-requested a review June 24, 2026 19:17

try:
gif = Image.open(gif_path)
from PIL import Image as PILImage

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is it here and not with other imports?

step = self.step

canvas = Image.new("RGBA", gif.size, (0, 0, 0, 255))
from PIL import Image as PILImage

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could be moved to other imports to avoid code duplication


RULE_FILE_PATH = ETC_FOLDER + "/udev/rules.d/99-epomaker-rt100.rules"
TMP_FILE_PATH = TMP_FOLDER + "/99-epomaker-rt100.rules"
PATH_TO_DEFAULT_CONFIG = "src/epomakercontroller/configs/default.json"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That could lead to errors when this file moved somewhere, I'd better leave it with path

Comment thread tests/test_sensors.py
from epomakercontroller.utils.sensors import select_temp_device


def test_select_temp_device_prefers_cpu_sensor() -> None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

use @pytest.mark.parametrise

home_dir = Path(os.path.abspath(os.curdir))
config_dir = home_dir / CONFIG_DIRECTORY
return config_dir
return Path.home() / CONFIG_DIRECTORY

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it would be better to leave previous functionality and not using home directory

@kbrddestroyer

Copy link
Copy Markdown
Collaborator

Was this code AI-generated by any chance?

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