Files
ha_pstryk_card/AGENTS.md
Gemini Bot f6147a0787 Initial commit: Add Pstryk Energy Card v4.1.0
- Add main card implementation with full/compact/super_compact modes
- Support for sparkline and bars widgets with effects
- Price color coding based on best/worst price ranges
- Alert system for high/low price thresholds
- Polish/English translations support
- HACS integration configuration
- Development guidelines in AGENTS.md
2025-11-21 12:13:59 +01:00

27 lines
1.3 KiB
Markdown

# Agent Guidelines for Pstryk Energy Card
## Build/Test Commands
- No build system - single JavaScript file (`pstryk-card.js`)
- Test by adding card to Home Assistant dashboard
- Debug mode: set `debug: true` in card config
- No linting/formatting tools configured
## Code Style Guidelines
- **Language**: Vanilla JavaScript ES6+ (no frameworks)
- **File structure**: Single file with embedded CSS in template literals
- **Class naming**: PascalCase (e.g., `PstrykCard`)
- **Method naming**: camelCase with underscore prefix for private methods (e.g., `_getTranslations`)
- **Variables**: camelCase, use const/let appropriately
- **Comments**: Polish comments for user-facing text, English for technical notes
- **Error handling**: Throw descriptive Error objects in `setConfig()` for validation
- **Translations**: Support PL/EN via `_getTranslations()` method
- **CSS**: Use CSS custom properties for theming, embed in `<style>` tags
- **SVG**: Inline SVG for charts, use viewBox for responsiveness
- **Home Assistant**: Follow custom card conventions, register with `customElements.define()`
## Key Patterns
- Shadow DOM for encapsulation
- Lifecycle methods: `connectedCallback()`, `disconnectedCallback()`
- Config validation in `setConfig()`
- Performance optimization in `set hass()` with change detection
- Timer management for hourly refreshes