Skip to content

Conversation

@Bre77
Copy link
Contributor

@Bre77 Bre77 commented Jun 29, 2025

Proposed change

I got feedback that the tariff calandar PR (#145848) probably shouldnt be a calandar, so this PR refactors it into a sensor entity.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Bre77 and others added 6 commits June 15, 2025 09:33
Add calendar entities for energy site tariff schedules, providing:
- Buy tariff calendar showing energy purchase pricing periods
- Sell tariff calendar showing energy sell-back pricing periods

Features:
- Displays current active pricing period
- Shows seasonal pricing variations
- Handles time-of-use (TOU) periods
- Supports midnight crossing periods
- Update TeslemetryEnergyInfoCoordinator to preserve tariff structure during flattening
- Fix test file to only test energy tariff calendars
- Update snapshots for energy price calendar entities
Refactors the Teslemetry integration's tariff feature from a calendar
entity to a sensor entity. The new sensor displays the current
buy/sell tariff price.

Key changes:
- Removed `calendar.py` and its tests/snapshots.
- Modified `sensor.py` to include `TeslemetryTariffSensor`, which
  calculates and displays the current tariff price and related
  information (season, period) as attributes.
- Updated `__init__.py` to remove the CALENDAR platform.
- Updated `strings.json` to move tariff entity names to the sensor domain.
- Updated `test_sensor.py` to include tests for the new tariff sensors,
  and updated `test_sensor.ambr` snapshots accordingly.
- Ensured `coordinator.py` and `helpers.py` retain necessary changes
  for data flattening.
@Bre77 Bre77 closed this Jul 13, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant