Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
User avatar
msnep
Posts: 9
Joined: Tuesday 30 November 2021 20:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: Netherlands
Contact:

Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

Post by msnep »

Hi, I've been using the Enever price feed for several months and I automate stuff based on the price. Perfect.
However, recently I noticed sometimes that there's something wrong with the timing of my automations.

After investigating I found that the Enever price feed for tomorrow (9-Feb-2025) has NULL values for 05:00 and 06:00 for all suppliers. (via https://enever.nl/api/stroomprijs_morgen.php?token=abc), like this for 05:00:

{
"datum": "2025-02-09 05:00:00",
"prijs": null,
"prijsANWB": null,
"prijsBE": null,
"prijsEE": null,
"prijsEN": null,
"prijsEVO": null,
"prijsEZ": null,
"prijsFR": null,
"prijsGSL": null,
"prijsMDE": null,
"prijsNE": null,
"prijsTI": null,
"prijsVDB": null,
"prijsVON": null,
"prijsWE": null,
"prijsZG": null,
"prijsZP": null
},


However, Domoticz doesn't seem to check the time-stamp in the JSON: there are 22 price points from 0:00 till 21:00 in the variable Enever_Electricity_tomorrow. And I use this variable as the basis for my automations.
So in the variable 22:00 and 23:00 are missing, instead of 05:00 and 06:00.
The price at 07:00 became 05:00 in the variable, 08:00 --> 06:00, etc. and therefore my automation timings are off by 2 hours.

Does anybody else experience this? Or should I skip the variable/Domoticz functionality and read from Enever directly?

Thanks!

(Domoticz 2024.7 on RPi)
User avatar
waltervl
Posts: 5847
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

Post by waltervl »

Better report this to Enever so that this situation is not happening. Probably a glitch on their side.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
msnep
Posts: 9
Joined: Tuesday 30 November 2021 20:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

Post by msnep »

I reported it to Enever.

Note - I checked a few different places for the electricity prices (anwb, tibber, and epexspot.com) and noticed that 4 - 5 - 6:00 has the exact same price today. It could mean that 5 and 6 were duplicated from 4 due to missing data, but who knows.
User avatar
msnep
Posts: 9
Joined: Tuesday 30 November 2021 20:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

Post by msnep »

Tomorrow it's the same thing again (10-Feb-2025).
I think that the handling by Domoticz is not "ideal", because due to the null values all following prices are incorrect in Domoticz' variable. It would be Ok if the data from Enever was taken 1 on 1, in my opinion.
I am probably going to read directly from Enever because then I can handle the null values. Hopefully it will eventually be fixed at the source.
HvdW
Posts: 612
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

Post by HvdW »

Pity that it stopped.
I have a dzVents script that relies on the Enever plugin.
I have this script that runs in the background and it returns the data correctly.

Code: Select all

return {
    on = {
        timer = { 'at 00:05' }, -- a new day yesterday, is an old day now 
        httpResponses = { 'EnergyPricesTodayReceived' }
    },
    logging = {
        level = domoticz.LOG_INFO,
        marker = 'EnergyPricesToday'
    },
    execute = function(domoticz, item)
        local energyProviders = {
            --prijs = "Beurs",
            AA = "Atoom Alliantie",
            AIP = "All in power",
            ANWB = "ANWB Energie",
            BE = "Budget Energie",
            EE = "EasyEnergy",
            EN = "Eneco",
            EVO = "Energie van Ons",
            EZ = "Energy Zero",
            FR = "Frank Energie",
            GSL = "Groenestroom Lokaal",
            MDE = "Mijndomein Energie",
            NE = "NextEnergy",
            TI = "Tibber",
            VDB = "Vandebron",
            VON = "Vrij op naam",
            WE = "Wout Energie",
            ZG = "ZonderGas",
            ZP = "Zonneplan"
        }

        if (item.isTimer) then
            domoticz.log('Starting energy prices update', domoticz.LOG_INFO)
            -- Doe het API verzoek
            domoticz.openURL({
                url = 'https://enever.nl/api/stroomprijs_vandaag.php?token=<your_token',
                method = 'GET',
                callback = 'EnergyPricesTodayReceived'
            })
        elseif (item.isHTTPResponse) then
            domoticz.log('Processing HTTP response', domoticz.LOG_INFO)
            if (item.ok) then
                local data = item.json
                if data.status == "true" then
                    -- Open het CSV-bestand om te schrijven
                    local file = io.open("/home/pi/Energy_Prices_Today.csv", "w")
                    if file then
                        -- Schrijf de header naar het bestand
                        file:write("Afkorting,Provider,00:00,01:00,02:00,03:00,04:00,05:00,06:00,07:00,08:00,09:00,10:00,11:00,12:00,13:00,14:00,15:00,16:00,17:00,18:00,19:00,20:00,21:00,22:00,23:00\n")
                        
                        -- Schrijf de data voor elke provider
                        for provider, name in pairs(energyProviders) do
                            file:write(provider .. "," .. name)
                            for _, hour in ipairs(data.data) do
                                file:write(string.format(",%s", hour["prijs" .. provider]))
                            end
                            file:write("\n")
                        end
                        -- Add another line with timestamp
                        local timestamp = os.date("%Y%m%d %H:%M")
                        file:write(string.format("Updated,%s\n", timestamp))
                        file:close()
                        domoticz.log('Energy prices saved to Energy_Prices_Today.csv', domoticz.LOG_INFO)
                    else
                        domoticz.log('ERROR: Could not open Energy_Prices_Today.csv for writing', domoticz.LOG_ERROR)
                    end
                else
                    domoticz.log('ERROR: Invalid response from API', domoticz.LOG_ERROR)
                end
            else
                domoticz.log('ERROR: HTTP request failed', domoticz.LOG_ERROR)
            end
        end
    end
}

Last edited by HvdW on Monday 10 February 2025 12:37, edited 1 time in total.
Bugs bug me.
User avatar
waltervl
Posts: 5847
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

Post by waltervl »

HvdW wrote: Monday 10 February 2025 12:05 Pity that it stopped.
I have a dzVents script that relies on their figures.
Who said that it stopped? It seems Enever only supplies some strange values sometimes ... Or do I miss something?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5847
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

Post by waltervl »

Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
msnep
Posts: 9
Joined: Tuesday 30 November 2021 20:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Enever NULL values cause time shift in Enever_Electricity_tomorrow variable

Post by msnep »

Thanks for the update!
The fix is the same as how I had fixed it temporarily (taking the price of the hour before) - I'm happy with the solution.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest