agentleFS
SukramJSukramJ/homematicip_local/.claude/skills/add-device/SKILL.md

add-device

Skill608 starsChanged 5 months agoMITView on GitHub

Add a new Homematic device type with DeviceProfileRegistry registration, custom data point class, and tests. Use when the user wants to add support for a new device model.

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create calculated class in aiohomematic/model/calculated/:

    line 70
  2. Very specific:

    Add tests in tests/test_model_*.py.

    line 92

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Adding a New Device Type

Device-to-profile mappings are managed via DeviceProfileRegistry. Most new devices can use existing CustomDataPoint subclasses.

Step 1: Register with DeviceProfileRegistry

Register in the appropriate entity module (e.g., aiohomematic/model/custom/switch.py, climate.py):

# In aiohomematic/model/custom/switch.py (or appropriate module)
from aiohomematic.const import DataPointCategory, DeviceProfile, Parameter
from aiohomematic.model.custom.registry import DeviceProfileRegistry, ExtendedDeviceConfig

# Simple registration
DeviceProfileRegistry.register(
    category=DataPointCategory.SWITCH,
    models="HmIP-NEW-SWITCH",           # Single model or tuple of models
    data_point_class=CustomDpSwitch,     # Existing or new CustomDataPoint class
    profile_type=DeviceProfile.IP_SWITCH,
    channels=(3,),                        # Channel(s) where STATE lives
)

# With extended configuration (additional data points)
DeviceProfileRegistry.register(
    category=DataPointCategory.CLIMATE,
    models=("HmIP-NEW-THERMO", "HmIP-NEW-THERMO-2"),
    data_point_class=CustomDpIpThermostat,
    profile_type=DeviceProfile.IP_THERMOSTAT,
    channels=(1,),
    schedule_channel_no=1,
    extended=ExtendedDeviceConfig(
        additional_data_points={
            0: (Parameter.SOME_EXTRA_PARAM,),
        },
    ),
)

Step 2: For Devices with Multiple Configurations

E.g., lock + button lock:

from aiohomematic.model.custom.registry import DeviceConfig, DeviceProfileRegistry

DeviceProfileRegistry.register_multiple(
    category=DataPointCategory.LOCK,
    models="HmIP-NEW-LOCK",
    configs=(
        DeviceConfig(
            data_point_class=CustomDpIpLock,
            profile_type=DeviceProfile.IP_LOCK,
        ),
        DeviceConfig(
            data_point_class=CustomDpButtonLock,
            profile_type=DeviceProfile.IP_BUTTON_LOCK,
            channels=(0,),
        ),
    ),
)

Step 3: Add a Calculated Data Point (if needed)

Create calculated class in aiohomematic/model/calculated/:

"""Calculated data point."""

from __future__ import annotations

from aiohomematic.model.calculated.data_point import CalculatedDataPoint


class NewCalculation(CalculatedDataPoint):
    """Calculate derived value."""

    async def calculate_value(self) -> float:
        """Calculate and return derived value."""
        value1 = await self._get_source_value("PARAMETER1")
        value2 = await self._get_source_value("PARAMETER2")
        return value1 + value2

Step 4: Add Tests

Add tests in tests/test_model_*.py.

Reference

See docs/developer/extension_points.md for detailed instructions and more examples.

Download now (ZIP)

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. deepmodeling/Uni-Lab-OS★ 178same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.