Page 1 of 1

How can I retrieve Costs T1 and Costs T2

Posted: Saturday 07 December 2024 0:10
by HvdW
I tried to find the right Costs T1 attribute from Settings -> Meters/Counters using a dump() command.

Code: Select all

domoticz.devices('Costs T1').dump()
I used the wrong command.
Which is the right one?

Re: How can I retrieve Costs T1 and Costs T2

Posted: Saturday 07 December 2024 11:39
by HvdW
Let me ask the question in other words.
It is possible to extract latitude and longitude from settings.

Code: Select all

		local lat = dz.settings.location.latitude
		local long = dz.settings.location.longitude
What is the secret formula for costs T1 and costs T2?

Re: How can I retrieve Costs T1 and Costs T2

Posted: Saturday 07 December 2024 13:18
by waltervl
Are you asking for the tariffs for T1 and T2 that are stored in menu setup - settings, tab counters?

Or are you asking for the calculated costs of T1 and T2 of your P1 smart meter device that has T1 and T2 tarifs (and not using dynamic pricing)?

Re: How can I retrieve Costs T1 and Costs T2

Posted: Saturday 07 December 2024 16:37
by HvdW
waltervl wrote: Saturday 07 December 2024 13:18 Are you asking for the tariffs for T1 and T2 that are stored in menu setup - settings, tab counters?
Yes.
To be used in a dzvents script.

Re: How can I retrieve Costs T1 and Costs T2

Posted: Saturday 07 December 2024 19:11
by waltervl
There is no direct function for this. You probably have to use a Domoticz API call with openUrl() to read them.

Code: Select all

/json.htm?type=command&param=getsettings

Re: How can I retrieve Costs T1 and Costs T2

Posted: Saturday 07 December 2024 19:23
by HvdW
waltervl wrote: Saturday 07 December 2024 19:11 There is no direct function for this. You probably have to use a Domoticz API call with openUrl() to read them.
Any idea which?

Re: How can I retrieve Costs T1 and Costs T2

Posted: Saturday 07 December 2024 19:24
by waltervl
/json.htm?type=command&param=getsettings

Re: How can I retrieve Costs T1 and Costs T2

Posted: Saturday 07 December 2024 22:42
by HvdW
waltervl wrote: Saturday 07 December 2024 19:24 Domoticz-ip:8282/json.htm?type=command&param=getsettings
That's the one.
Thanks!

Next:

Code: Select all

 "Location": {
        "Latitude": "52.260183",
        "Longitude": "6.714728"
    },
and

Code: Select all

domoticz.log('domoticz.settings.location.latitude : '..domoticz.settings.location.longitude)
is correct
So with

Code: Select all

    "CostEnergy": "0.2752",
    "CostEnergyR1": "0.1650",
    "CostEnergyR2": "0.1235",
    "CostEnergyT2": "0.2335",
    "CostGas": "1.2153",
    "CostWater": "0.9000",
I'm curious about the correct spelling for

Code: Select all

domoticz.log('domoticz.settings.CostEnergyT2 : '..domoticz.settings.costEnergyT2, domoticz.LOG_INFO)
but I'm afraid latitude and longitude are the only options to choose from in the getsettings menu

Re: How can I retrieve Costs T1 and Costs T2

Posted: Sunday 08 December 2024 12:53
by habahabahaba
So why dont you want to take them from json answer ?

Re: How can I retrieve Costs T1 and Costs T2

Posted: Sunday 08 December 2024 15:29
by HvdW
habahabahaba wrote: Sunday 08 December 2024 12:53 So why dont you want to take them from json answer ?
Of course I can.
I'm just very curious.

Re: How can I retrieve Costs T1 and Costs T2

Posted: Sunday 08 December 2024 15:56
by waltervl
I think the Dzvents developer had a use case to use location as input into dzvents scripts (like weather, geofencing etc). So there was an interface made. For tariffs he did not have a use case so he did not create an interface.