Skip to content

Conversation

@ghisch
Copy link

@ghisch ghisch commented Mar 3, 2025

Add support for tax-excluded prices (HT)

This PR adds support for tax-excluded prices (HT - Hors Taxes) alongside the existing tax-included prices (TTC - Toutes Taxes Comprises).

Changes

Added new sensors

  • Added HT (tax-excluded) versions of all price sensors
  • Added fixed rate sensors (in EUR/an) for all contract types
  • All HT sensors are disabled by default but can be enabled in the Home Assistant interface

Updated sensor naming and units

  • Updated all price units to use EUR instead of € for consistency
  • Fixed sensor names to match actual entity IDs
  • Added "(incl. taxes)" and "(excl. taxes)" to descriptions for clarity

Code improvements

  • Moved currency icon logic to the TarifEdfSensor class
  • Added automatic currency icon for sensors with EUR units
  • Added entity registry control to disable HT sensors by default

Documentation

  • Updated README with all new sensors
  • Added note about HT sensors being disabled by default
  • Fixed sensor names and descriptions to match actual implementation
  • Added fixed rate sensors to documentation
  • Improved clarity of sensor descriptions

Breaking Changes

The following sensor names have been updated to better reflect their content and maintain consistency. If you use these sensors in automations, dashboards, or scripts, you'll need to update their entity IDs:

Base Contract

Old Name New Name
sensor.tarif_base sensor.tarif_base_variable_ttc

HP/HC Contract

Old Name New Name
sensor.tarif_heures_creuses sensor.tarif_hphc_variable_hc_ttc
sensor.tarif_heures_pleines sensor.tarif_hphc_variable_hp_ttc

Tempo Contract

Old Name New Name
sensor.tarif_tempo_heures_creuses sensor.tempo_variable_hc_ttc
sensor.tarif_tempo_heures_pleines sensor.tempo_variable_hp_ttc
sensor.tarif_bleu_tempo_heures_creuses sensor.tarif_bleu_tempo_heures_creuses_ttc
sensor.tarif_bleu_tempo_heures_pleines sensor.tarif_bleu_tempo_heures_pleines_ttc
sensor.tarif_blanc_tempo_heures_creuses sensor.tarif_blanc_tempo_heures_creuses_ttc
sensor.tarif_blanc_tempo_heures_pleines sensor.tarif_blanc_tempo_heures_pleines_ttc
sensor.tarif_rouge_tempo_heures_creuses sensor.tarif_rouge_tempo_heures_creuses_ttc
sensor.tarif_rouge_tempo_heures_pleines sensor.tarif_rouge_tempo_heures_pleines_ttc

Action Required

  • Update any automations, scripts, or dashboards that reference the old sensor names
  • The new names include _ttc to distinguish them from the new tax-excluded (_ht) versions
  • All functionality remains the same, only the entity IDs have changed

Notes

  • Tested only on HPHC contract so far.
  • PR Created with the help of CursorAI
  • Initially did this PR because the VAT is not the same everywhere (in DOM & Corsica, VAT is reduced or non-existent), so the given price is incorrect (ref)

@ghisch
Copy link
Author

ghisch commented Apr 25, 2025

@delphiki 🆙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant