Page 2 of 2

Re: How to retrieve ENTSOE electrical consumption of France?

Posted: Thursday 07 March 2024 11:18
by willemd
I just remembered where I have another script with variable number of data points.
I use this:

Code: Select all

    				    local response=item.json.result
				        for datehour,value in pairs(response) do
				            domoticz.log("solar forecast date "..domoticz.utils.stringSplit(datehour)[1].." hour "..domoticz.utils.stringSplit(domoticz.utils.stringSplit(datehour)[2],":")[1].." value "..value,domoticz.LOG_INFO)
				            local previousHour=domoticz.utils.stringSplit(domoticz.utils.stringSplit(datehour)[2],":")[1]-1
				            if previousHour<10 then 
				                previousHour="0"..tostring(previousHour)
				            else
				                previousHour=tostring(previousHour)
				            end    
				            domoticz.log("previousHour "..previousHour)    
				            if value>0 then
				                sensorDateHour=domoticz.utils.stringSplit(datehour)[1].." "..domoticz.utils.stringSplit(domoticz.utils.stringSplit(datehour)[2],":")[1]..":00:00"
				                sValueStr="0;"..value
				                domoticz.log("sensorDateHour "..sensorDateHour.." sValueStr "..sValueStr,domoticz.LOG_INFO)
				                domoticz.devices(idxSolarForecastCounter).updateHistory(sensorDateHour,sValueStr)
				                if sensorDateHour==currentHR then
				                    domoticz.devices(idxSolarForecastCounter).updateCounter(value)
				                end    
				            end    
				        end

Re: How to retrieve ENTSOE electrical consumption of France?

Posted: Friday 08 March 2024 10:18
by Wilop91
Hello willemd
Thanks for you reply.
I will have a look into later - for the time being I'm trying to adapt your script to retrieve the data for 2 or 3 production types for which I'm sure there are 24 values. This will take some time because of my limited skills....
Btw I have some very basic questions:
- I understand for each production type I need to create a "device". But do I need to create also a "hardware"?
- If I have 3 devices (representing 3 production types) how to I display them in a single log (i.e. with 3 curves)?

In advance thanks a lot for you valuable help.

BR

Willy

Re: How to retrieve ENTSOE electrical consumption of France?

Posted: Friday 08 March 2024 11:16
by willemd
You can use either an existing or create a new hardware setup of the type "dummy (does Nothing, used for virtual switches only)." and then create your devices linked to that hardware.

To display 3 devices in one graph you will have to use dashticz.

Re: How to retrieve ENTSOE electrical consumption of France?

Posted: Friday 08 March 2024 13:17
by Wilop91
Hello willemd
Thanks for your reply

I could create the devices for each production type creating a hardware as "dummy" and each device as "counter"

But in your script you have also a device called idxCurrentHourIndicator.

How did you create this device?

PS: for the time being I want to run the script which only gets the XML data (i.e. processing of the responseKey is empty)

BR

Willy

Re: How to retrieve ENTSOE electrical consumption of France?

Posted: Friday 08 March 2024 15:59
by Jan Jansen
willemd wrote: Wednesday 06 March 2024 10:58 Here is my latest dzvents script to load the prices onto a managed counter for later display in domoticz and dashticz.
@willemd,

Thanks for sharing the script I was looking for! However, I am amazed at the script's output. I created a user variable VAT (integer 21) and a user variable energy tax (string 13.2).
Output.png
Output.png (24.34 KiB) Viewed 349 times
I know the option to set a divisor. But I don't understand the result of the 2 counters on the right?

Thanks in advance.

Re: How to retrieve ENTSOE electrical consumption of France?

Posted: Friday 08 March 2024 19:25
by willemd
You need to adapt the counter divider on the managed counter to 100000.

The first counter is excluding tax (red line below), the second is including tax(blue line below). Both show the full list of available prices.

The third counter only shows the tariff of the current hour and is used as a sort of arrow in a dashtic graph to highlight the current hour, see the yellow line below in the graph.

Here is also the graph definition

Code: Select all

blocks['graph_ElPrice'] = {
    title: 'Dynamic El Price',
    width:12,
    height: '260px',
    graph: 'line',
    steppedLine: ['before','before','before'],
    buttonsText: ['last hours','today',''],
    devices: [177,179,184],
    beginAtZero: true,
    customHeader: 'devices[184].Data+" incl taxes"',
    range: 'today',
    legend: false
}

Re: How to retrieve ENTSOE electrical consumption of France?

Posted: Wednesday 03 April 2024 20:31
by Wilop91
I could complete my script after having solved a Domoticz crash:
https://www.domoticz.com/forum/viewtopic.php?t=42176