nordpool icon indicating copy to clipboard operation
nordpool copied to clipboard

Multiple instances?

Open ruant opened this issue 2 years ago • 13 comments

I'm having trouble with running it multiple times. I want one with the pure spotprice, and a second one with some additional cost (including grid fee etc.)

Anyone been able to do this? It looks to work some times, but more often than not the second one (spot price only) doesn't load anything.

Maybe it's nordpool that limiting the request?

ruant avatar Aug 26 '22 11:08 ruant

I got the same problem.

Only the first instance gets populated with data. The second one does not

smulle48 avatar Aug 27 '22 12:08 smulle48

Might be api issues. Try reloading the sensor without data

Hellowlol avatar Aug 27 '22 12:08 Hellowlol

Still not working.

I've created 2 identical instances and just changed the precision on one of them. Here's the debug log:

nordpool-log.txt

If I use the GUI to setup the sensor, it's working with multiple instances, but not if I'm adding them in the yaml file.

Apparently only the first in the yaml file gets loaded.

I have tried to swap them in the yaml (the new one above the old working) and then the new gets populated and not the old.

Here's the config, if needed:

sensor:
  - platform: nordpool

    # Should the prices include vat? Default True
    VAT: True

    # What currency the api fetches the prices in
    # this is only need if you want a sensor in a non local currecy
    currency: "DKK"

    # Helper so you can set your "low" price
    # low_price = hour_price < average * low_price_cutoff
    low_price_cutoff: 0.95

    # What power regions your are interested in.
    # Possible values: "DK1", "DK2", "FI", "LT", "LV", "Oslo", "Kr.sand", "Bergen", "Molde", "Tr.heim", "Tromsø", "SE1", "SE2", "SE3","SE4", "SYS", "EE"
    region: "DK1"

    # How many decimals to use in the display of the price
    precision: 4

    # What the price should be displayed in default
    # Possible values: MWh, kWh and Wh
    # default: kWh
    price_type: kWh

    # This option allows the usage of a template to add a tariff.
    # now() always refers start of the hour of that price.
    # this way we can calculate the correct costs add that to graphs etc.
    # The price result of the additional_costs template expects this additional cost to be in kWh and not cents as a float
    # default {{0.0|float}}
    additional_costs: '{{0.0|float}}'
    
  - platform: nordpool

    # Should the prices include vat? Default True
    VAT: True

    # What currency the api fetches the prices in
    # this is only need if you want a sensor in a non local currecy
    currency: "DKK"

    # Helper so you can set your "low" price
    # low_price = hour_price < average * low_price_cutoff
    low_price_cutoff: 0.95

    # What power regions your are interested in.
    # Possible values: "DK1", "DK2", "FI", "LT", "LV", "Oslo", "Kr.sand", "Bergen", "Molde", "Tr.heim", "Tromsø", "SE1", "SE2", "SE3","SE4", "SYS", "EE"
    region: "DK1"

    # How many decimals to use in the display of the price
    precision: 3

    # What the price should be displayed in default
    # Possible values: MWh, kWh and Wh
    # default: kWh
    price_type: kWh

    # This option allows the usage of a template to add a tariff.
    # now() always refers start of the hour of that price.
    # this way we can calculate the correct costs add that to graphs etc.
    # The price result of the additional_costs template expects this additional cost to be in kWh and not cents as a float
    # default {{0.0|float}}
    additional_costs: '{{0.0|float}}'

smulle48 avatar Aug 27 '22 12:08 smulle48

My second one somehow started working today. I'll turn on some more debugging and we'll see what happens at around 13:00 CET tomorrow when new prices come.

ruant avatar Aug 27 '22 22:08 ruant

I think it just takes a bit longer, at least thats my experience

flippz avatar Aug 28 '22 18:08 flippz

It fails at first try, then it retries every hour it looks like and some times manages to get data then. So it looks like it eventually shows up.

But it isn't optimal, loosing the prices while it's trying to fetch isn't good. It's there a way to persiste the state of the sensor between restart? Of course there has to be something that checks that the dates stored is valid, if not retry/throw them out. But then you'll most likely have at least a few hours of valid hours available. Until the integartions gets a valid response from the API again.

ruant avatar Aug 29 '22 09:08 ruant

It fails at first try, then it retries every hour it looks like and some times manages to get data then.

So it looks like it eventually shows up.

But it isn't optimal, loosing the prices while it's trying to fetch isn't good.

It's there a way to persiste the state of the sensor between restart? Of course there has to be something that checks that the dates stored is valid, if not retry/throw them out.

But then you'll most likely have at least a few hours of valid hours available. Until the integartions gets a valid response from the API again.

The weird thing is that if you add multiple instances through the gui, it pulls the data right away for all instances.

It only when they are added through the yaml file it fails (at least here with me)

smulle48 avatar Aug 29 '22 09:08 smulle48

How do u add it through the gui?

flippz avatar Aug 29 '22 09:08 flippz

The weird thing is that if you add multiple instances through the gui, it pulls the data right away for all instances.

It only when they are added through the yaml file it fails (at least here with me)

Your totally correct, just tested. The only thing I don't like about the GUI, is that you don't get to configure it through the UI again. It's a one shot setup. But that's probably an easy way to fix a "Configure" button so you can for example change the additional costs template at a later time due to changes.

Or is there a hidden file in Home Assistant where this is stored and can be changed in a text editor?

Example of another integration that allows you to edit settings afterwards: image

nordpool, not so much: image

ruant avatar Aug 29 '22 09:08 ruant

The weird thing is that if you add multiple instances through the gui, it pulls the data right away for all instances.

It only when they are added through the yaml file it fails (at least here with me)

Your totally correct, just tested.

The only thing I don't like about the GUI, is that you don't get to configure it through the UI again.

It's a one shot setup. But that's probably an easy way to fix a "Configure" button so you can for example change the additional costs template at a later time due to changes.

Or is there a hidden file in Home Assistant where this is stored and can be changed in a text editor?

Yeah. Same here. Our taxes has changed quiet a lot lately and if I then deleted the instance from the gui and added a new, all the old price calculations are lost, so until you can modify through gui, I prefer to stick with the yaml file

smulle48 avatar Aug 29 '22 09:08 smulle48

The weird thing is that if you add multiple instances through the gui, it pulls the data right away for all instances.

It only when they are added through the yaml file it fails (at least here with me)

@smulle48 follow up questions. Does it also work immediately when you restart HA? On both instances through the UI. Or do you have to wait then?

ruant avatar Aug 29 '22 09:08 ruant

The weird thing is that if you add multiple instances through the gui, it pulls the data right away for all instances.

It only when they are added through the yaml file it fails (at least here with me)

@smulle48 follow up questions.

Does it also work immediately when you restart HA? On both instances through the UI.

Or do you have to wait then?

It gets populated immediately:-)

smulle48 avatar Aug 29 '22 09:08 smulle48

Tried moving mine over through the GUI now. I'm just getting one of them to show data after I restart HA 🤔

ruant avatar Aug 29 '22 13:08 ruant

Hi

I recommend using GUI for config as this allows for reload of sensor without rebooting the server. There was a bug that did so if you had multiple sensor one of them would often not work until next hours. This should now be fixed with 0.0.8

Hellowlol avatar Nov 10 '22 19:11 Hellowlol