Rest-Electical prices

Yeah i have tried most of the day trying to find a way to add these two numbers as an attribute, but i havn’t succeeded… yet.

You probably can do it with the API but it won’t be persistent.
An option is three entities one for each and one for sum.
Or Node red.

Hi,
I have been using this api for quite a while now and very happy with that.
But it has stopped working recently.
Any knowledge of the reason, and how to fix it if possible,
or is there another alternative API for pulling prices from Andel energy for example.

Yeah i switched over to the nordpool integration using HACS to install it.

i have added the additional prices in order to give me the correct prices. They are as follows.

'{% set s = {
"afgift": 0.1,
"winter_lavlast": 0.2296,
"winter_hojlast": 0.6889,
"winter_spidslast": 2.0666,
"summer_lavlast": 0.2296,
"summer_hojlast": 0.3445,
"summer_spidslast": 0.8955,
"andel": 0.05,
"afrunding": 0.06
}
%}
    {% if now().month >= 4 and now().month <10 %}
        {% if now().hour >= 0 and now().hour <6 %}
            {{s.summer_lavlast+s.afgift+s.andel+s.afrunding|float}}
        {% elif now().hour >= 17 and now().hour <21 %}
            {{s.summer_spidslast+s.afgift+s.andel+s.afrunding|float}}
        {% else %}
            {{s.summer_hojlast+s.afgift+s.andel+s.afrunding|float}}
        {% endif %}
    {% else %}
        {% if now().hour >=0 and now().hour <6 %}
            {{s.winter_lavlast+s.afgift+s.andel+s.afrunding|float}}
        {% elif now().hour >= 17 and now().hour <21 %}
            {{s.winter_spidslast+s.afgift+s.andel+s.afrunding|float}}
        {%else%}
            {{s.winter_hojlast+s.afgift+s.andel+s.afrunding|float}}
        {% endif %}
    {% endif %}'

I have done a webscrape of radius webpage to get the current tariffs and i am working to integrate it into the additional costs in nordpool as well.

Hi @PuppetMaster,

Could you share the Scrape sensor for tarrif, or which url do you find these?

Hi @ghassan

Of cause, i haven’t figured a way to incorporate into the NordPool integration as there is a problem with quotations(as the nordpool integration requires additional costs to be in single quotations).

Settings → Devices & Services → + Add Integration → Search for Scrape
when you have added the first resource (Radius webpage) and one sensor, you can add more sensors on the scrape integration it self by clicking “configure”

Web Resource
URL Resource: https://radiuselnet.dk/elnetkunder/tariffer-og-netabonnement/
Method: GET
Leave rest with default settings.

Scrape sensors:
Tariff Vinter Lavlast:
Selector: #elementor-tab-content-8881 > table:nth-child(1) > tbody > tr:nth-child(2) > td:nth-child(2)
Value Template: {{ value.split(" ")[0] | replace(",", "") | int * 1.25 / 10000 | round(4) }}
Device Class: Monetary
State Class: Total
Unit of Measurement: DKK/kWh

Tariff Vinter højlast:
Selector: #elementor-tab-content-8881 > table:nth-child(1) > tbody > tr:nth-child(2) > td:nth-child(3)
Value Template: {{ value.split(" ")[0] | replace(",", "") | int * 1.25 / 10000 | round(4) }}
Device Class: Monetary
State Class: Total
Unit of Measurement: DKK/kWh

Tariff Vinter spidslast:
Selector: #elementor-tab-content-8881 > table:nth-child(1) > tbody > tr:nth-child(2) > td:nth-child(4)
Value Template: {{ value.split(" ")[0] | replace(",", "") | int * 1.25 / 10000 | round(4) }}
Device Class: Monetary
State Class: Total
Unit of Measurement: DKK/kWh

Tariff Sommer Lavlast:
Selector: #elementor-tab-content-8881 > table:nth-child(1) > tbody > tr:nth-child(3) > td:nth-child(2)
Value Template: {{ value.split(" ")[0] | replace(",", "") | int * 1.25 / 10000 | round(4) }}
Device Class: Monetary
State Class: Total
Unit of Measurement: DKK/kWh

Tariff Sommer højlast:
Selector: #elementor-tab-content-8881 > table:nth-child(1) > tbody > tr:nth-child(3) > td:nth-child(3)
Value Template: {{ value.split(" ")[0] | replace(",", "") | int * 1.25 / 10000 | round(4) }}
Device Class: Monetary
State Class: Total
Unit of Measurement: DKK/kWh

Tariff Sommer Spidslast:
Selector: #elementor-tab-content-8881 > table:nth-child(1) > tbody > tr:nth-child(3) > td:nth-child(4)
Value Template: {{ value.split(" ")[0] | replace(",", "") | int * 1.25 / 10000 | round(4) }}
Device Class: Monetary
State Class: Total
Unit of Measurement: DKK/kWh

@PuppetMaster — please format code snippets correctly.

@Troon Thanks, i have highlighted the code, but the codes format is like how i pasted it. It just need to be added in the web scrape integration sensor under “value template”

Please let me know if there is something i have missed in my formatting

Hi @PuppetMaster ,

Thanks,
I haven’t tried it yet, but I wonder why you multiply by 1.25 to add taxes.
Looks like the page by default shows prices including taxes!

Hello again,

I figured out that multiplying by 1.25 was necessary any way but you have to replace
elementor-tab-content-8881 by elementor-tab-content-2011
in order to get it to work now.

Furthermore I had to add some parenthesis to get the rounding to work. So my version of the value is like this:

{{ (value.split(" ")[0] | replace(",", "") | int * 1.25/ 10000) | round(4) }}

I don’t integrate these additional costs directly in the Nordpool integration but I make another sensor that combines data from the nordpool integration and theses scrape sensors.

Now my prices are exactly as those supplied by Andel my energy provider.
The result is then displayed on an apexcharts card and looks like this:

image

I am very glad for the result. Thank you for your help :slight_smile:

1 Like

@ghassan You’re welcome, and thank you for perfecting it :slight_smile: I wasn’t even thinking about combining them outside of the integration, which of cause makes sense in this instance :stuck_out_tongue: