Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide retail pricing dummy sensor by applying a formula over PUN prices #11

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

Ocramius
Copy link
Contributor

Ref: #6
Ref: #10

As explained by @ virtualdj, retail prices depend on the current contract with the electricity retailer, and therefore need to be computed with a template sensor.

This patch provides an example, although it is unclear where this would be positioned in configuration.yml

…ices

Ref: virtualdj#6
Ref: virtualdj#10

As explained by @ virtualdj, retail prices depend on the current contract with the electricity retailer, and therefore need to be computed with a template sensor.

This patch provides an example, although it is unclear where this would be positioned in `configuration.yml`
Comment on lines +37 to +38
```yml
- unique_id: prezzo_attuale_energia_al_dettaglio
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit unclear to me under which key I'd configure such a template value.

Also: is this configurable by UI, or would we point people at adding this to their configuration.yml?

@Ocramius
Copy link
Contributor Author

Ocramius commented Jul 10, 2023

Meanwhile, my local formula, if I understood this correctly:

template:
  - sensor:
      # see https://github.com/virtualdj/pun_sensor/pull/11
      - unique_id: current_retail_electricity_price
        name: 'Current retail electricity price'
        icon: mdi:currency-eur
        unit_of_measurement: '€/kWh'
        # 1.102 = 10.2% spread
        # 1.038 = 3.8% MT (not sure what this is)
        # 0.073 = delivery fees
        # 0.042 = distribution/measurement fees
        state: >
          {{ (1.102 * 1.038 * (states('sensor.pun_prezzo_fascia_corrente')|float(0) + 0.073 + 0.042))|round(3) }}

Probably mixed up the formula a bit, so please do feel free to correct me, so I both get it right for myself and for others here :D

EDIT: in fact, I think it's like this

template:
  - sensor:
      # see https://github.com/virtualdj/pun_sensor/pull/11
      - unique_id: current_retail_electricity_price
        name: 'Current retail electricity price'
        icon: mdi:currency-eur
        unit_of_measurement: '€/kWh'
        # 1.102 = 10.2% spread
        # 1.038 = 3.8% MT (not sure what this is)
        # 0.073 = delivery fees
        # 0.042 = distribution/measurement fees
        state: >
-          {{ (1.102 * 1.038 * (states('sensor.pun_prezzo_fascia_corrente')|float(0) + 0.073 + 0.042))|round(3) }}
+          {{ (states('sensor.pun_prezzo_fascia_corrente')|float(0) * 1.102 * 1.038 + 0.073 + 0.042)|round(3) }}

@virtualdj
Copy link
Owner

To be honest, I don't remember at the moment where I found that formula... and I'm not sure it's actually perfect.
For example grid losses and dispatchment costs are based on the kWh (so they must be multiplied) but there are also monthly costs that are not included here.

Anyway, everything it's just an indication because you won't get the correct result until near the end of the month.

@virtualdj virtualdj merged commit fdab62d into virtualdj:master Oct 21, 2023
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.

2 participants