# Ratings & Levels :::tip Entity ID tip `` is a placeholder for your Tibber home display name in Home Assistant. Entity IDs are derived from the displayed name (localized), so the exact slug may differ. **Can't find a sensor?** Use the **[Entity Reference (All Languages)](sensor-reference.md)** to search by name in your language. ::: The integration provides **two** classification systems for electricity prices. Both are useful, but serve different purposes. ## Ratings vs Levels at a Glance | | Ratings | Levels | |--|---------|--------| | **Source** | Calculated by integration | Provided by Tibber API | | **Scale** | 3 levels (LOW, NORMAL, HIGH) | 5 levels (VERY_CHEAP → VERY_EXPENSIVE) | | **Basis** | Trailing 24h average | Daily min/max range | | **Best for** | Automations (simple thresholds) | Dashboard displays (fine granularity) | | **Configurable** | Yes (thresholds) | Gap tolerance only | | **Automation attribute** | `rating_level` (always lowercase English) | `level` (always uppercase English) | **Which to use?** - **Automations**: Use **ratings** (3 simple states, configurable thresholds, hysteresis) - **Dashboards**: Use **levels** (5 color-coded states, more visual granularity) - **Advanced automations**: Combine both (e.g., "LOW rating AND VERY_CHEAP level") --- ## Rating Sensors Rating sensors classify prices relative to the **trailing 24-hour average**, answering: "Is the current price cheap, normal, or expensive compared to recent history?" ### How Ratings Work The integration calculates a **percentage difference** between the current price and the trailing 24-hour average:
Show formula: How Ratings Work ``` difference = ((current_price - trailing_avg) / abs(trailing_avg)) × 100% ```
This percentage is then classified: | Rating | Condition (default) | Meaning | |--------|---------------------|---------| | **LOW** | difference ≤ -10% | Significantly below recent average | | **NORMAL** | -10% < difference < +10% | Within normal range | | **HIGH** | difference ≥ +10% | Significantly above recent average | **Hysteresis** (default 2%) prevents flickering: once a rating enters LOW, it must cross -8% (not -10%) to return to NORMAL. This avoids rapid switching at threshold boundaries. ```mermaid stateDiagram-v2 direction LR LOW: 🟢 LOW
price ≤ −10% NORMAL: 🟡 NORMAL
−10% … +10% HIGH: 🔴 HIGH
price ≥ +10% LOW --> NORMAL: crosses −8%
(hysteresis) NORMAL --> LOW: drops below −10% NORMAL --> HIGH: rises above +10% HIGH --> NORMAL: crosses +8%
(hysteresis) ``` > **The 2% gap** between entering (−10%) and leaving (−8%) a state prevents the sensor from flickering back and forth when prices hover near a threshold. ### Available Rating Sensors | Sensor | Scope | Description | |--------|-------|-------------| | Current Price Rating | Current interval | Rating of the current 15-minute price | | Next Price Rating | Next interval | Rating for the upcoming 15-minute price | | Previous Price Rating | Previous interval | Rating for the past 15-minute price | | Current Hour Price Rating | Rolling 5-interval | Smoothed rating around the current hour | | Next Hour Price Rating | Rolling 5-interval | Smoothed rating around the next hour | | Yesterday's Price Rating | Calendar day | Aggregated rating for yesterday | | Today's Price Rating | Calendar day | Aggregated rating for today | | Tomorrow's Price Rating | Calendar day | Aggregated rating for tomorrow | ### Key Attributes | Attribute | Description | Example | |-----------|-------------|---------| | `rating_level` | Language-independent rating (always lowercase) | `low` | | `difference` | Percentage difference from trailing average | `-12.5` | | `trailing_avg_24h` | The reference average used for classification | `22.3` | ### Usage in Automations **Best Practice:** Always use the `rating_level` attribute (lowercase English) instead of the sensor state (which is translated to your HA language):
Show YAML: Usage in Automations ```yaml # ✅ Correct — language-independent condition: - condition: template value_template: > {{ state_attr('sensor._current_price_rating', 'rating_level') == 'low' }} # ❌ Avoid — breaks when HA language changes condition: - condition: state entity_id: sensor._current_price_rating state: "Low" # "Niedrig" in German, "Lav" in Norwegian... ```
### Configuration Rating thresholds can be adjusted in the options flow: 1. Go to **Settings → Devices & Services → Tibber Prices → Configure** 2. Navigate to **Price Rating Thresholds** 3. Adjust LOW/HIGH thresholds, hysteresis, and gap tolerance See [Price Rating Thresholds](config-price-rating.md) for details. --- ## Level Sensors Level sensors show the **Tibber API's own price classification** with a 5-level scale: | Level | Meaning | Numeric Value | |-------|---------|---------------| | **VERY_CHEAP** | Exceptionally low | -2 | | **CHEAP** | Below average | -1 | | **NORMAL** | Typical range | 0 | | **EXPENSIVE** | Above average | +1 | | **VERY_EXPENSIVE** | Exceptionally high | +2 | ### Available Level Sensors | Sensor | Scope | |--------|-------| | Current Price Level | Current interval | | Next Price Level | Next interval | | Previous Price Level | Previous interval | | Current Hour Price Level | Rolling 5-interval window | | Next Hour Price Level | Rolling 5-interval window | | Yesterday's Price Level | Calendar day (aggregated) | | Today's Price Level | Calendar day (aggregated) | | Tomorrow's Price Level | Calendar day (aggregated) | **Gap tolerance** smoothing is applied to prevent isolated level flickers (e.g., a single NORMAL between two CHEAPs → corrected to CHEAP). Configure in [Price Level Gap Tolerance](config-price-level.md).