Files
home-information/docs/dev/domain/entity-patterns.md
Tony C 535549e74c Documentation updates and pre-release tweaks (#146)
* Bug fix and some documentation improvements.

* Addd model diagrams.

* Documentation Updates and DB utility scripts added.

* Updated documentation.

* Documentation refinements.

* Added new screenshot images and updated docs.

* Added linkk to helper data export scripts.
2025-09-06 22:31:17 -05:00

1.5 KiB

Entity Patterns

Entity-State Relationships

Entities have zero or more EntityState variables representing hidden state that can be sensed or controlled.

Entity Positioning

Entities can be positioned in locations as icons or paths:

  • EntityPosition: Icon-based representation with position, scale, rotation
  • EntityPath: SVG path representation for areas or complex shapes

Entity Delegation

EntityStateDelegation allows one entity's state to proxy another's:

  • Delegate entity reflects principal entity's state
  • Used for visual representation (e.g., thermometer shows room temperature)
  • Supports one-to-one, one-to-many, many-to-one relationships

Adding New Entity Types

To add a new entity type to the system:

1. Add Enum Entry

Add new entry in this enum:

# hi.apps.entity.enums.EntityType

Add the new type to the appropriate group:

# hi.apps.entity.enums.EntityGroupType  

2. Configure Visual Representation

Entity types can be displayed as icons or paths. For visual configuration details including SVG icon creation, styling, and template setup, see Entity Visual Configuration.

3. Simulator Support (Optional)

If the new type should be supported by the simulator, add it to:

# hi.simulator.enums.SimEntityType