Nordpool electricity prices plugin

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

Post Reply
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Nordpool electricity prices plugin

Post by tjabas »

So I have been using a nordpool plugin which I found here, it has been working great but now when I have upgraded to bullseye then it doesn't work anymore, is there any other plugin I can use to get the electricity tariffs into domoticz?
I'm from Sweden.

Thanks
User avatar
waltervl
Posts: 5389
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Nordpool electricity prices plugin

Post by waltervl »

Did you notify the plugin ownrf ur issue?
Did you also upgrade th python modules the plugin perhaps needed?
Do you have a link to. GitHub repository?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by tjabas »

waltervl wrote: Monday 29 January 2024 19:25 Did you notify the plugin ownrf ur issue?
Did you also upgrade th python modules the plugin perhaps needed?
Do you have a link to. GitHub repository?
Yes I have talked to the writer of the plugin and he didn't have any plans of fixing this issue, the issue it that the plugin doesn't work with the upgraded phyton, I will look for a link to github.
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by tjabas »

User avatar
waltervl
Posts: 5389
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Nordpool electricity prices plugin

Post by waltervl »

I suppose the modules install goes wrong? This is because of the new python virtual environments in Bookworm.
Did you try adding

Code: Select all

--break-system-packages

to the install command?

So use

Code: Select all

sudo pip install -r requirements.txt --break-system-packages
Edit. You upgraded to Bullseye. Did you reinstall the plugin requirements? As they could be changed due to the upgrade of your OS.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
VintageLogicJason
Posts: 4
Joined: Wednesday 31 January 2024 12:16
Target OS: Windows
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by VintageLogicJason »

tjabas wrote: Monday 29 January 2024 18:41 So I have been using a nordpool plugin which I found here, it has been working great but now when I have upgraded to bullseye then it doesn't work anymore, is there any other plugin I can use to get the electricity tariffs into domoticz?
I'm from Sweden.

Thanks
Certainly! It seems like the Nordpool plugin might not be compatible with the Bullseye upgrade. You can try using the "domoticz-emoncms-plugin" for fetching electricity tariffs in Sweden. Make sure to update your plugin list and configuration settings accordingly.
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by tjabas »

i have encountered a problem a couple of days ago with this plugin , it doesnt update anymore, any idea? :

2024-10-16 23:43:54.067 Error: NordPool: return complexjson.loads(self.text, **kwargs)
2024-10-16 23:43:54.068 Error: NordPool: File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
2024-10-16 23:43:54.068 Error: NordPool: return _default_decoder.decode(s)
2024-10-16 23:43:54.068 Error: NordPool: File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
2024-10-16 23:43:54.068 Error: NordPool: obj, end = self.raw_decode(s)
2024-10-16 23:43:54.068 Error: NordPool: File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
2024-10-16 23:43:54.068 Error: NordPool: return self.scan_once(s, idx=_w(s, idx).end())
2024-10-16 23:43:54.068 Error: NordPool: simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2024-10-16 23:44:04.158 Error: NordPool: Call to function 'onHeartbeat' failed, exception details:
2024-10-16 23:44:04.160 Error: NordPool: Traceback (most recent call last):
2024-10-16 23:44:04.160 Error: NordPool: File "/home/pi/domoticz/plugins/NordPoolSpotPrice-Domoticz/plugin.py", line 287, in onHeartbeat
2024-10-16 23:44:04.160 Error: NordPool: _plugin.onHeartbeat()
2024-10-16 23:44:04.160 Error: NordPool: File "/home/pi/domoticz/plugins/NordPoolSpotPrice-Domoticz/plugin.py", line 142, in onHeartbeat
2024-10-16 23:44:04.160 Error: NordPool: CurrentPrice(HourNow)
2024-10-16 23:44:04.160 Error: NordPool: File "/home/pi/domoticz/plugins/NordPoolSpotPrice-Domoticz/plugin.py", line 185, in CurrentPrice
2024-10-16 23:44:04.160 Error: NordPool: price=prices_spot.hourly(end_date=datetime.now().date(),areas=[_plugin.Area])
2024-10-16 23:44:04.160 Error: NordPool: File "/usr/local/lib/python3.7/dist-packages/nordpool/elspot.py", line 132, in hourly
2024-10-16 23:44:04.160 Error: NordPool: return self.fetch(self.HOURLY, end_date, areas)
2024-10-16 23:44:04.160 Error: NordPool: File "/usr/local/lib/python3.7/dist-packages/nordpool/elspot.py", line 128, in fetch
2024-10-16 23:44:04.160 Error: NordPool: return self._parse_json(self._fetch_json(data_type, end_date), areas)
2024-10-16 23:44:04.160 Error: NordPool: File "/usr/local/lib/python3.7/dist-packages/nordpool/elspot.py", line 104, in _fetch_json
2024-10-16 23:44:04.160 Error: NordPool: return r.json()
2024-10-16 23:44:04.160 Error: NordPool: File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
2024-10-16 23:44:04.160 Error: NordPool: return complexjson.loads(self.text, **kwargs)
2024-10-16 23:44:04.160 Error: NordPool: File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
2024-10-16 23:44:04.160 Error: NordPool: return _default_decoder.decode(s)
2024-10-16 23:44:04.160 Error: NordPool: File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
2024-10-16 23:44:04.160 Error: NordPool: obj, end = self.raw_decode(s)
2024-10-16 23:44:04.160 Error: NordPool: File "/usr/
User avatar
waltervl
Posts: 5389
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Nordpool electricity prices plugin

Post by waltervl »

If you are Dutch you also could switch to the Enever hardware gateway, https://www.domoticz.com/wiki/Enever

Else you have to find the issue. It could be anything from noordpool stopping or switch API or python update issue etc
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by tjabas »

i also tried with an older backup version of domoticz but the problem where there to, so i guess that there has been a change at nordpool, is there any other plugin that works with nordpool?
i live in sweden.
JBN
Posts: 40
Joined: Saturday 13 July 2013 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Nordpool electricity prices plugin

Post by JBN »

@tjabas, I am curious. What are you using the plugin for? And do you use all the counters it creates?

I was playing around with https://www.elprisetjustnu.se/ yesterday since they have the data available online too.
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by tjabas »

Im using it to turn on and off some Electrical components when the price is low, the water heater, charging my car, turn on and off heatpumps.
So its kind of hard that the plugin doesnt work.
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by tjabas »

Is it possible to get the plugin the fetch the prices from. The link you provided?
JBN
Posts: 40
Joined: Saturday 13 July 2013 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Nordpool electricity prices plugin

Post by JBN »

I have not tested this thoroughly but if you want you can try: https://github.com/j-b-n/sweden_energyprice
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by tjabas »

JBN wrote: Sunday 20 October 2024 17:43 I have not tested this thoroughly but if you want you can try: https://github.com/j-b-n/sweden_energyprice
wow thanks alot, i have installed it but i dont get any prices in the switches that the plugin has made, i get these errors:


2024-10-20 19:34:11.437 Error: Elpriser: Call to function 'onStart' failed, exception details:
2024-10-20 19:34:11.439 Error: Elpriser: Traceback (most recent call last):
2024-10-20 19:34:11.439 Error: Elpriser: File "/home/pi/domoticz/plugins/sweden_energyprice/plugin.py", line 176, in onStart
2024-10-20 19:34:11.439 Error: Elpriser: _plugin.onStart()
2024-10-20 19:34:11.439 Error: Elpriser: File "/home/pi/domoticz/plugins/sweden_energyprice/plugin.py", line 115, in onStart
2024-10-20 19:34:11.439 Error: Elpriser: min_price = elprisetjustnu.get_min_energy_price(self.folder, self.price_zone)
2024-10-20 19:34:11.439 Error: Elpriser: File "/home/pi/domoticz/plugins/sweden_energyprice/elprisetjustnu.py", line 62, in get_min_energy_price
2024-10-20 19:34:11.439 Error: Elpriser: prices = update_energy_price(folder, price_zone)
2024-10-20 19:34:11.439 Error: Elpriser: File "/home/pi/domoticz/plugins/sweden_energyprice/elprisetjustnu.py", line 49, in update_energy_price
2024-10-20 19:34:11.439 Error: Elpriser: clean_folder(folder, price_zone)
2024-10-20 19:34:11.439 Error: Elpriser: File "/home/pi/domoticz/plugins/sweden_energyprice/elprisetjustnu.py", line 34, in clean_folder
2024-10-20 19:34:11.439 Error: Elpriser: for f in os.listdir(foldername):
2024-10-20 19:34:11.439 Error: Elpriser: FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/domoticz/plugins/sweden_energyprice/json/'
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by tjabas »

when i try to install: sudo python3 -m pip install -r requirements.txt --upgrade
i get error message:
Could not open requirements file: [Errno 2] Filen eller katalogen finns inte: 'requirements.txt'
JBN
Posts: 40
Joined: Saturday 13 July 2013 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Nordpool electricity prices plugin

Post by JBN »

Let's debug together, I have sent you a PM.
sumitrathore
Posts: 7
Joined: Tuesday 26 November 2024 11:07
Target OS: Windows
Domoticz version:
Location: India
Contact:

Re: Nordpool electricity prices plugin

Post by sumitrathore »

It looks like NordPool changed its API. You can try using the 'domoticz-emoncms-plugin' or find another plugin that works with the new data.
sumitrathore
Posts: 7
Joined: Tuesday 26 November 2024 11:07
Target OS: Windows
Domoticz version:
Location: India
Contact:

Re: Nordpool electricity prices plugin

Post by sumitrathore »

Hello everyone,
Has anyone found a reliable plugin or method to integrate with the new NordPool API? I’m specifically looking for something that can work seamlessly with Domoticz or a similar home automation platform.

Regards,
Sumit.
Evolverixw04c7i
Posts: 3
Joined: Wednesday 15 January 2025 9:19
Target OS: Linux
Domoticz version:
Contact:

Re: Nordpool electricity prices plugin

Post by Evolverixw04c7i »

Hi..

Here is my script to get the current electrical prices.

First create a dummy virtual utiluty sensor and note down the Idx to save the data to.

Then create a elpris.py file in for example the scripts folder in domoticz
Update the Domoticz url and the idx in the configurtaion parts.

The parameters is

currency - SEK NOK EUR PLN ...
area - If you browse to the area of interest on this page, you'll have the area id as the last part of the URL - something like SE or DE-LU
extra - Your fees per kWh in chosen currency, before VAT. Example: 0.05 for 5 cents per kWh
multiplier - Multiplier for spot price before adding fees and VAT. 1 is no multiplier, 1.02 is 2% added fee on spot price before adding extra fees and VAT.
factor - Factor for VAT. 1 is no VAT, 1.25 is 25% VAT and so on.
decimals - Precision for all price points, 2 will result in 0.05kWh, 4 -> 0.00521, and so on.

see more info on https://spot.56k.guru/homeassistant

The script is:

-------------------------------------------------------------------

Code: Select all

import requests

# Configuration for the Domoticz server
DOMOTICZ_URL = "http://192.168.30.240"
DOMOTICZ_IDX = 516  # IDX of your virtual sensor

def fetch_now_data():
    # Define the API endpoint
    api_url = "https://spot.56k.guru/api/v2/hass"

    # Define the query parameters
    params = {
        "currency": "SEK",
        "area": "SE2",
        "multiplier": 1,
        "extra": 0,
        "factor": 1.25,
        "decimals": 3
    }

    try:
        # Make the GET request
        response = requests.get(api_url, params=params)
        response.raise_for_status()  # Raise an error for bad HTTP response
        data = response.json()  # Parse the JSON response

        # Extract the "now" data
        if "now" in data:
            now_value = data["now"]
            print(f"Now Data: {now_value}")
            send_to_domoticz(now_value)
        else:
            print("The 'now' key is not present in the API response.")
    except requests.exceptions.RequestException as e:
        print(f"An error occurred while fetching data: {e}")

def send_to_domoticz(value):
    """
    Sends the 'now' data to Domoticz using the JSON API.
    """
    try:
        # Construct the URL for updating the device
        update_url = f"{DOMOTICZ_URL}/json.htm"
        params = {
            "type": "command",
            "param": "udevice",
            "idx": DOMOTICZ_IDX,
            "nvalue": 0,  # Typically 0 for text/float devices
            "svalue": str(value)  # Send the 'now' value as a string
        }

        # Send the update request
        response = requests.get(update_url, params=params)
        response.raise_for_status()  # Raise an error for bad HTTP response


        # Check the response
        if response.json().get("status") == "OK":
            print("Data successfully sent to Domoticz.")
        else:
            print(f"Failed to send data to Domoticz: {response.json()}")
    except requests.exceptions.RequestException as e:
        print(f"An error occurred while sending data to Domoticz: {e}")

# Run the script
if __name__ == "__main__":
    fetch_now_data()


----------------------------------------------------------------------------------------------------------------------------------
When add a crontab to run every 15 minutes (crontab -e)

*/15 * * * * /usr/bin/python3 /home/domoticz/scripts/elpris.py
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests